From 178ca548f8ecf3287d356a4c475ffb454efe0918 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 16 May 2025 11:31:35 +0200 Subject: [PATCH 01/51] Prepare next development iteration. See #3136 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8c967f3d27..c9f875a30c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.0 + 3.5.1-SNAPSHOT Spring Data Redis Spring Data module for Redis From f33cc5fd27f743e5b35049c89a35a6620dc961a7 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 16 May 2025 11:31:36 +0200 Subject: [PATCH 02/51] After release cleanups. See #3136 --- Jenkinsfile | 2 +- pom.xml | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a4820853f1..c97e40ae1f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { triggers { pollSCM 'H/10 * * * *' - upstream(upstreamProjects: "spring-data-keyvalue/main", threshold: hudson.model.Result.SUCCESS) + upstream(upstreamProjects: "spring-data-keyvalue/3.5.x", threshold: hudson.model.Result.SUCCESS) } options { diff --git a/pom.xml b/pom.xml index c9f875a30c..8f2136feb1 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.0 + 3.5.1-SNAPSHOT - 3.5.0 - 3.5.0 + 3.5.1-SNAPSHOT + 3.5.1-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + From d771dc49da7c684bb83e80d9fd03310ae87057de Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 13 Jun 2025 13:39:14 +0200 Subject: [PATCH 03/51] Prepare 3.5.1 (2025.0.1). See #3157 --- pom.xml | 22 +++++----------------- src/main/resources/notice.txt | 3 ++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 8f2136feb1..6e35318275 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.1-SNAPSHOT + 3.5.1 - 3.5.1-SNAPSHOT - 3.5.1-SNAPSHOT + 3.5.1 + 3.5.1 1.9.4 1.4.21 2.11.1 @@ -388,19 +388,7 @@ - - spring-snapshot - https://repo.spring.io/snapshot - - true - - - false - - - - spring-milestone - https://repo.spring.io/milestone - + + diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index 0ef0648dea..00b550b1d5 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.5 GA (2025.0.0) +Spring Data Redis 3.5.1 (2025.0.1) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -60,5 +60,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + From 813fcede593c9a1d5552e615b8fa0d58c0f85932 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 13 Jun 2025 13:39:35 +0200 Subject: [PATCH 04/51] Release version 3.5.1 (2025.0.1). See #3157 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6e35318275..9071f47f9a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.1-SNAPSHOT + 3.5.1 Spring Data Redis Spring Data module for Redis From 375d0a3dba20717f6480fbb4c53dd209a452648d Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 13 Jun 2025 13:42:18 +0200 Subject: [PATCH 05/51] Prepare next development iteration. See #3157 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9071f47f9a..bdd73396ae 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.1 + 3.5.2-SNAPSHOT Spring Data Redis Spring Data module for Redis From 90bf0ec6c9801ed7f2ac01bc75c7758857b0179b Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 13 Jun 2025 13:42:19 +0200 Subject: [PATCH 06/51] After release cleanups. See #3157 --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index bdd73396ae..10acea41e6 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.1 + 3.5.2-SNAPSHOT - 3.5.1 - 3.5.1 + 3.5.2-SNAPSHOT + 3.5.2-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + From 461343e1a0aa20a67cd14ce833d56514c4af417a Mon Sep 17 00:00:00 2001 From: UHyeon Jeong Date: Tue, 27 May 2025 22:56:36 +0900 Subject: [PATCH 07/51] Fix `LettucePoolingConnectionProvider` and `ClusterCommandExecutor` disposal. Closes #3100 Original pull request: #3164 Signed-off-by: UHyeon Jeong --- .../lettuce/LettuceConnectionFactory.java | 27 +++---- .../LettucePoolingConnectionProvider.java | 77 +++++++++++++------ 2 files changed, 69 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java index befdfffe50..1c9dfb92c1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java @@ -116,6 +116,7 @@ * @author Chris Bono * @author John Blum * @author Zhian Chen + * @author UHyeon Jeong */ public class LettuceConnectionFactory implements RedisConnectionFactory, ReactiveRedisConnectionFactory, InitializingBean, DisposableBean, SmartLifecycle { @@ -979,6 +980,9 @@ public void stop() { dispose(reactiveConnectionProvider); reactiveConnectionProvider = null; + dispose(clusterCommandExecutor); + clusterCommandExecutor = null; + if (client != null) { try { Duration quietPeriod = clientConfiguration.getShutdownQuietPeriod(); @@ -1012,20 +1016,7 @@ public void afterPropertiesSet() { @Override public void destroy() { - stop(); - this.client = null; - - ClusterCommandExecutor clusterCommandExecutor = this.clusterCommandExecutor; - - if (clusterCommandExecutor != null) { - try { - clusterCommandExecutor.destroy(); - this.clusterCommandExecutor = null; - } catch (Exception ex) { - log.warn("Cannot properly close cluster command executor", ex); - } - } this.state.set(State.DESTROYED); } @@ -1043,6 +1034,16 @@ private void dispose(@Nullable LettuceConnectionProvider connectionProvider) { } } + private void dispose(@Nullable ClusterCommandExecutor commandExecutor) { + if (commandExecutor != null) { + try { + commandExecutor.destroy(); + } catch (Exception ex) { + log.warn("Cannot properly close cluster command executor", ex); + } + } + } + @Override public RedisConnection getConnection() { diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java index 086c9ce763..641a0e2e82 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java @@ -31,11 +31,13 @@ import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.springframework.beans.factory.DisposableBean; +import org.springframework.context.SmartLifecycle; import org.springframework.data.redis.connection.PoolException; import org.springframework.util.Assert; @@ -56,13 +58,16 @@ * @author Mark Paluch * @author Christoph Strobl * @author Asmir Mustafic + * @author UHyeon Jeong * @since 2.0 * @see #getConnection(Class) */ -class LettucePoolingConnectionProvider implements LettuceConnectionProvider, RedisClientProvider, DisposableBean { +class LettucePoolingConnectionProvider implements LettuceConnectionProvider, RedisClientProvider, DisposableBean, + SmartLifecycle { private static final Log log = LogFactory.getLog(LettucePoolingConnectionProvider.class); + private final AtomicReference state = new AtomicReference<>(State.CREATED); private final LettuceConnectionProvider connectionProvider; private final GenericObjectPoolConfig> poolConfig; private final Map, GenericObjectPool>> poolRef = new ConcurrentHashMap<>( @@ -76,6 +81,10 @@ class LettucePoolingConnectionProvider implements LettuceConnectionProvider, Red private final Map, AsyncPool>> asyncPools = new ConcurrentHashMap<>(32); private final BoundedPoolConfig asyncPoolConfig; + enum State { + CREATED, STARTING, STARTED, STOPPING, STOPPED, DESTROYED; + } + LettucePoolingConnectionProvider(LettuceConnectionProvider connectionProvider, LettucePoolingClientConfiguration clientConfiguration) { @@ -206,39 +215,51 @@ public CompletableFuture releaseAsync(StatefulConnection connection) @Override public void destroy() throws Exception { + stop(); + state.set(State.DESTROYED); + } - List> futures = new ArrayList<>(); - if (!poolRef.isEmpty() || !asyncPoolRef.isEmpty()) { - log.warn("LettucePoolingConnectionProvider contains unreleased connections"); - } - if (!inProgressAsyncPoolRef.isEmpty()) { + @Override + public void start() { + state.set(State.STARTED); + } - log.warn("LettucePoolingConnectionProvider has active connection retrievals"); - inProgressAsyncPoolRef.forEach((k, v) -> futures.add(k.thenApply(StatefulConnection::closeAsync))); - } + @Override + public void stop() { + if (state.compareAndSet(State.STARTED, State.STOPPING)) { + List> futures = new ArrayList<>(); + if (!poolRef.isEmpty() || !asyncPoolRef.isEmpty()) { + log.warn("LettucePoolingConnectionProvider contains unreleased connections"); + } - if (!poolRef.isEmpty()) { + if (!inProgressAsyncPoolRef.isEmpty()) { - poolRef.forEach((connection, pool) -> pool.returnObject(connection)); - poolRef.clear(); - } + log.warn("LettucePoolingConnectionProvider has active connection retrievals"); + inProgressAsyncPoolRef.forEach((k, v) -> futures.add(k.thenApply(StatefulConnection::closeAsync))); + } - if (!asyncPoolRef.isEmpty()) { + if (!poolRef.isEmpty()) { - asyncPoolRef.forEach((connection, pool) -> futures.add(pool.release(connection))); - asyncPoolRef.clear(); - } + poolRef.forEach((connection, pool) -> pool.returnObject(connection)); + poolRef.clear(); + } + + if (!asyncPoolRef.isEmpty()) { + + asyncPoolRef.forEach((connection, pool) -> futures.add(pool.release(connection))); + asyncPoolRef.clear(); + } - pools.forEach((type, pool) -> pool.close()); + pools.forEach((type, pool) -> pool.close()); - CompletableFuture + CompletableFuture .allOf(futures.stream().map(it -> it.exceptionally(LettuceFutureUtils.ignoreErrors())) - .toArray(CompletableFuture[]::new)) // + .toArray(CompletableFuture[]::new)) // .thenCompose(ignored -> { CompletableFuture[] poolClose = asyncPools.values().stream().map(AsyncPool::closeAsync) - .map(it -> it.exceptionally(LettuceFutureUtils.ignoreErrors())).toArray(CompletableFuture[]::new); + .map(it -> it.exceptionally(LettuceFutureUtils.ignoreErrors())).toArray(CompletableFuture[]::new); return CompletableFuture.allOf(poolClose); }) // @@ -248,6 +269,18 @@ public void destroy() throws Exception { }) // .join(); - pools.clear(); + pools.clear(); + } + state.set(State.STOPPED); + } + + @Override + public boolean isRunning() { + return State.STARTED.equals(this.state.get()); + } + + @Override + public boolean isAutoStartup() { + return true; } } From 9b54407de6bc91afeea235bb288fae89294f18b0 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 2 Jul 2025 08:41:03 +0200 Subject: [PATCH 08/51] Polishing. Dispose ClusterCommandExecutor before disposing connection provider. Extract RedisClient disposal to method. Use AtomicBoolean guard instead of state and Lifecycle to dispose LettucePoolingConnectionProvider. See #3100 Original pull request: #3164 --- .../jedis/JedisConnectionFactory.java | 66 ++++++++------- .../lettuce/LettuceConnectionFactory.java | 49 +++++++----- .../LettucePoolingConnectionProvider.java | 80 +++++++------------ 3 files changed, 93 insertions(+), 102 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java index 01cb4badec..93a4edd6e6 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java @@ -761,38 +761,16 @@ public void stop() { if (this.state.compareAndSet(State.STARTED, State.STOPPING)) { if (getUsePool() && !isRedisClusterAware()) { - if (this.pool != null) { - try { - this.pool.close(); - this.pool = null; - } catch (Exception ex) { - log.warn("Cannot properly close Jedis pool", ex); - } - } - } - - ClusterCommandExecutor clusterCommandExecutor = this.clusterCommandExecutor; - - if (clusterCommandExecutor != null) { - try { - clusterCommandExecutor.destroy(); - this.clusterCommandExecutor = null; - } catch (Exception ex) { - throw new RuntimeException(ex); - } + dispose(pool); + pool = null; } - if (this.cluster != null) { + dispose(clusterCommandExecutor); + clusterCommandExecutor = null; - this.topologyProvider = null; - - try { - this.cluster.close(); - this.cluster = null; - } catch (Exception ex) { - log.warn("Cannot properly close Jedis cluster", ex); - } - } + dispose(cluster); + topologyProvider = null; + cluster = null; this.state.set(State.STOPPED); } @@ -882,6 +860,36 @@ public void destroy() { state.set(State.DESTROYED); } + private void dispose(@Nullable ClusterCommandExecutor commandExecutor) { + if (commandExecutor != null) { + try { + commandExecutor.destroy(); + } catch (Exception ex) { + log.warn("Cannot properly close cluster command executor", ex); + } + } + } + + private void dispose(@Nullable JedisCluster cluster) { + if (cluster != null) { + try { + cluster.close(); + } catch (Exception ex) { + log.warn("Cannot properly close Jedis cluster", ex); + } + } + } + + private void dispose(@Nullable Pool pool) { + if (pool != null) { + try { + pool.close(); + } catch (Exception ex) { + log.warn("Cannot properly close Jedis pool", ex); + } + } + } + @Override public RedisConnection getConnection() { diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java index 1c9dfb92c1..8941695eac 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java @@ -974,33 +974,23 @@ public void stop() { resetConnection(); + dispose(clusterCommandExecutor); + clusterCommandExecutor = null; + dispose(connectionProvider); connectionProvider = null; dispose(reactiveConnectionProvider); reactiveConnectionProvider = null; - dispose(clusterCommandExecutor); - clusterCommandExecutor = null; - - if (client != null) { - try { - Duration quietPeriod = clientConfiguration.getShutdownQuietPeriod(); - Duration timeout = clientConfiguration.getShutdownTimeout(); - - client.shutdown(quietPeriod.toMillis(), timeout.toMillis(), TimeUnit.MILLISECONDS); - client = null; - } catch (Exception ex) { - if (log.isWarnEnabled()) { - log.warn(ClassUtils.getShortName(client.getClass()) + " did not shut down gracefully.", ex); - } - } - } + dispose(client); + client = null; } state.set(State.STOPPED); } + @Override public boolean isRunning() { return State.STARTED.equals(this.state.get()); @@ -1016,11 +1006,22 @@ public void afterPropertiesSet() { @Override public void destroy() { - stop(); + stop(); this.state.set(State.DESTROYED); } + private void dispose(@Nullable ClusterCommandExecutor commandExecutor) { + + if (commandExecutor != null) { + try { + commandExecutor.destroy(); + } catch (Exception ex) { + log.warn("Cannot properly close cluster command executor", ex); + } + } + } + private void dispose(@Nullable LettuceConnectionProvider connectionProvider) { if (connectionProvider instanceof DisposableBean disposableBean) { @@ -1034,12 +1035,18 @@ private void dispose(@Nullable LettuceConnectionProvider connectionProvider) { } } - private void dispose(@Nullable ClusterCommandExecutor commandExecutor) { - if (commandExecutor != null) { + private void dispose(@Nullable AbstractRedisClient client) { + + if (client != null) { try { - commandExecutor.destroy(); + Duration quietPeriod = clientConfiguration.getShutdownQuietPeriod(); + Duration timeout = clientConfiguration.getShutdownTimeout(); + + client.shutdown(quietPeriod.toMillis(), timeout.toMillis(), TimeUnit.MILLISECONDS); } catch (Exception ex) { - log.warn("Cannot properly close cluster command executor", ex); + if (log.isWarnEnabled()) { + log.warn(ClassUtils.getShortName(client.getClass()) + " did not shut down gracefully.", ex); + } } } } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java index 641a0e2e82..23d45c7286 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java @@ -30,14 +30,14 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; + import org.springframework.beans.factory.DisposableBean; -import org.springframework.context.SmartLifecycle; import org.springframework.data.redis.connection.PoolException; import org.springframework.util.Assert; @@ -62,12 +62,11 @@ * @since 2.0 * @see #getConnection(Class) */ -class LettucePoolingConnectionProvider implements LettuceConnectionProvider, RedisClientProvider, DisposableBean, - SmartLifecycle { +class LettucePoolingConnectionProvider implements LettuceConnectionProvider, RedisClientProvider, DisposableBean { private static final Log log = LogFactory.getLog(LettucePoolingConnectionProvider.class); - private final AtomicReference state = new AtomicReference<>(State.CREATED); + private final AtomicBoolean disposed = new AtomicBoolean(); private final LettuceConnectionProvider connectionProvider; private final GenericObjectPoolConfig> poolConfig; private final Map, GenericObjectPool>> poolRef = new ConcurrentHashMap<>( @@ -81,10 +80,6 @@ class LettucePoolingConnectionProvider implements LettuceConnectionProvider, Red private final Map, AsyncPool>> asyncPools = new ConcurrentHashMap<>(32); private final BoundedPoolConfig asyncPoolConfig; - enum State { - CREATED, STARTING, STARTED, STOPPING, STOPPED, DESTROYED; - } - LettucePoolingConnectionProvider(LettuceConnectionProvider connectionProvider, LettucePoolingClientConfiguration clientConfiguration) { @@ -215,51 +210,43 @@ public CompletableFuture releaseAsync(StatefulConnection connection) @Override public void destroy() throws Exception { - stop(); - state.set(State.DESTROYED); - } - - @Override - public void start() { - state.set(State.STARTED); - } + if (!disposed.compareAndSet(false, true)) { + return; + } - @Override - public void stop() { - if (state.compareAndSet(State.STARTED, State.STOPPING)) { - List> futures = new ArrayList<>(); - if (!poolRef.isEmpty() || !asyncPoolRef.isEmpty()) { - log.warn("LettucePoolingConnectionProvider contains unreleased connections"); - } + List> futures = new ArrayList<>(); + if (!poolRef.isEmpty() || !asyncPoolRef.isEmpty()) { + log.warn("LettucePoolingConnectionProvider contains unreleased connections"); + } - if (!inProgressAsyncPoolRef.isEmpty()) { + if (!inProgressAsyncPoolRef.isEmpty()) { - log.warn("LettucePoolingConnectionProvider has active connection retrievals"); - inProgressAsyncPoolRef.forEach((k, v) -> futures.add(k.thenApply(StatefulConnection::closeAsync))); - } + log.warn("LettucePoolingConnectionProvider has active connection retrievals"); + inProgressAsyncPoolRef.forEach((k, v) -> futures.add(k.thenApply(StatefulConnection::closeAsync))); + } - if (!poolRef.isEmpty()) { + if (!poolRef.isEmpty()) { - poolRef.forEach((connection, pool) -> pool.returnObject(connection)); - poolRef.clear(); - } + poolRef.forEach((connection, pool) -> pool.returnObject(connection)); + poolRef.clear(); + } - if (!asyncPoolRef.isEmpty()) { + if (!asyncPoolRef.isEmpty()) { - asyncPoolRef.forEach((connection, pool) -> futures.add(pool.release(connection))); - asyncPoolRef.clear(); - } + asyncPoolRef.forEach((connection, pool) -> futures.add(pool.release(connection))); + asyncPoolRef.clear(); + } - pools.forEach((type, pool) -> pool.close()); + pools.forEach((type, pool) -> pool.close()); - CompletableFuture + CompletableFuture .allOf(futures.stream().map(it -> it.exceptionally(LettuceFutureUtils.ignoreErrors())) - .toArray(CompletableFuture[]::new)) // + .toArray(CompletableFuture[]::new)) // .thenCompose(ignored -> { CompletableFuture[] poolClose = asyncPools.values().stream().map(AsyncPool::closeAsync) - .map(it -> it.exceptionally(LettuceFutureUtils.ignoreErrors())).toArray(CompletableFuture[]::new); + .map(it -> it.exceptionally(LettuceFutureUtils.ignoreErrors())).toArray(CompletableFuture[]::new); return CompletableFuture.allOf(poolClose); }) // @@ -269,18 +256,7 @@ public void stop() { }) // .join(); - pools.clear(); - } - state.set(State.STOPPED); - } - - @Override - public boolean isRunning() { - return State.STARTED.equals(this.state.get()); + pools.clear(); } - @Override - public boolean isAutoStartup() { - return true; - } } From b21f043445ee7ca4565394c5ddaf797de3405550 Mon Sep 17 00:00:00 2001 From: JavaNo0b <98101954+JavaNo0b@users.noreply.github.com> Date: Tue, 6 May 2025 19:26:47 +0900 Subject: [PATCH 09/51] Add performance warning to RedisOperations#keys() Javadoc. Closes #3142 Signed-off-by: JavaNo0b <98101954+JavaNo0b@users.noreply.github.com> --- .../data/redis/core/RedisOperations.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/core/RedisOperations.java b/src/main/java/org/springframework/data/redis/core/RedisOperations.java index 4ea682d900..cadfa9c2de 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisOperations.java +++ b/src/main/java/org/springframework/data/redis/core/RedisOperations.java @@ -262,11 +262,14 @@ T execute(RedisScript script, RedisSerializer argsSerializer, RedisSer DataType type(K key); /** - * Find all keys matching the given {@code pattern}. - * - * @param pattern must not be {@literal null}. - * @return {@literal null} when used in pipeline / transaction. - * @see Redis Documentation: KEYS + * Retrieve keys matching the given pattern via {@code KEYS} command. + *

+ * Note: This command scans the entire keyspace and may cause performance issues + * in production environments. Prefer using {@link #scan(ScanOptions)} for large datasets. + * + * @param pattern key pattern + * @return set of matching keys, or {@literal null} when used in pipeline / transaction + * @see Redis KEYS command */ @Nullable Set keys(K pattern); From c7b5fc6b2c11f54adc03e7e07802c8a750993303 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 30 May 2025 07:59:22 +0200 Subject: [PATCH 10/51] Update javadoc. See: #3142 --- .../data/redis/connection/ReactiveKeyCommands.java | 7 ++++--- .../data/redis/connection/RedisKeyCommands.java | 5 ++++- .../data/redis/connection/StringRedisConnection.java | 5 ++++- .../springframework/data/redis/core/ClusterOperations.java | 5 ++++- .../data/redis/core/ReactiveRedisOperations.java | 7 ++++--- .../springframework/data/redis/core/RedisOperations.java | 6 +++--- 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java index 3354cf9af1..877a787f5e 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveKeyCommands.java @@ -244,9 +244,10 @@ default Mono touch(Collection keys) { Flux, Long>> touch(Publisher> keys); /** - * Find all keys matching the given {@literal pattern}.
- * It is recommended to use {@link #scan(ScanOptions)} to iterate over the keyspace as {@link #keys(ByteBuffer)} is a - * non-interruptible and expensive Redis operation. + * Retrieve all keys matching the given pattern via {@code KEYS} command. + *

+ * IMPORTANT: This command is non-interruptible and scans the entire keyspace which may cause + * performance issues. Consider {@link #scan(ScanOptions)} for large datasets. * * @param pattern must not be {@literal null}. * @return diff --git a/src/main/java/org/springframework/data/redis/connection/RedisKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisKeyCommands.java index 4319dd8705..e79cf2c0f8 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisKeyCommands.java @@ -122,7 +122,10 @@ default Boolean exists(byte[] key) { Long touch(byte[]... keys); /** - * Find all keys matching the given {@code pattern}. + * Retrieve all keys matching the given pattern. + *

+ * IMPORTANT: The {@literal KEYS} command is non-interruptible and scans the entire keyspace which + * may cause performance issues. Consider {@link #scan(ScanOptions)} for large datasets. * * @param pattern must not be {@literal null}. * @return empty {@link Set} if no match found. {@literal null} when used in pipeline / transaction. diff --git a/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java index dfcc585130..dd483bdf89 100644 --- a/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java @@ -185,7 +185,10 @@ interface StringTuple extends Tuple { Long touch(String... keys); /** - * Find all keys matching the given {@code pattern}. + * Retrieve all keys matching the given pattern via {@code KEYS} command. + *

+ * IMPORTANT: This command is non-interruptible and scans the entire keyspace which may cause + * performance issues. Consider {@link #scan(ScanOptions)} for large datasets. * * @param pattern must not be {@literal null}. * @return diff --git a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java index f96c8c0d39..01ebb31246 100644 --- a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java @@ -38,7 +38,10 @@ public interface ClusterOperations { /** - * Get all keys located at given node. + * Retrieve all keys located at given node matching the given pattern. + *

+ * IMPORTANT: The {@literal KEYS} command is non-interruptible and scans the entire keyspace which + * may cause performance issues. * * @param node must not be {@literal null}. * @param pattern diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java index 686277f0df..55f126b636 100644 --- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java @@ -264,9 +264,10 @@ default Mono>> listenToPatternLater(String... Mono type(K key); /** - * Find all keys matching the given {@code pattern}.
- * IMPORTANT: It is recommended to use {@link #scan()} to iterate over the keyspace as - * {@link #keys(Object)} is a non-interruptible and expensive Redis operation. + * Retrieve all keys matching the given pattern via {@code KEYS} command. + *

+ * IMPORTANT: This command is non-interruptible and scans the entire keyspace which may cause + * performance issues. Consider {@link #scan(ScanOptions)} for large datasets. * * @param pattern must not be {@literal null}. * @return the {@link Flux} emitting matching keys one by one. diff --git a/src/main/java/org/springframework/data/redis/core/RedisOperations.java b/src/main/java/org/springframework/data/redis/core/RedisOperations.java index cadfa9c2de..18783d2c92 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisOperations.java +++ b/src/main/java/org/springframework/data/redis/core/RedisOperations.java @@ -262,10 +262,10 @@ T execute(RedisScript script, RedisSerializer argsSerializer, RedisSer DataType type(K key); /** - * Retrieve keys matching the given pattern via {@code KEYS} command. + * Retrieve all keys matching the given pattern via {@code KEYS} command. *

- * Note: This command scans the entire keyspace and may cause performance issues - * in production environments. Prefer using {@link #scan(ScanOptions)} for large datasets. + * IMPORTANT: This command is non-interruptible and scans the entire keyspace which may cause + * performance issues. Consider {@link #scan(ScanOptions)} for large datasets. * * @param pattern key pattern * @return set of matching keys, or {@literal null} when used in pipeline / transaction From 2cad2aaaae4d497ba549b5949ff99f4ecb2fa30b Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 17 Jul 2025 14:00:56 +0200 Subject: [PATCH 11/51] Upgrade to Maven Wrapper 3.9.11. See #3181 --- .mvn/wrapper/maven-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index f15f39b88f..b300b57322 100755 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -#Thu Nov 07 09:47:27 CET 2024 -distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip +#Thu Jul 17 14:00:56 CEST 2025 +distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip From 49a29e1c0e73cb51a12b3ad3a5b5e6ca36e7c461 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 17 Jul 2025 15:36:38 +0200 Subject: [PATCH 12/51] Refine Metrics Configuration documentation. Closes #3149 --- src/main/antora/modules/ROOT/pages/observability.adoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/antora/modules/ROOT/pages/observability.adoc b/src/main/antora/modules/ROOT/pages/observability.adoc index e3a43ae122..f7b53ada60 100644 --- a/src/main/antora/modules/ROOT/pages/observability.adoc +++ b/src/main/antora/modules/ROOT/pages/observability.adoc @@ -16,7 +16,7 @@ class ObservabilityConfiguration { public ClientResources clientResources(ObservationRegistry observationRegistry) { return ClientResources.builder() - .tracing(new MicrometerTracingAdapter(observationRegistry, "my-redis-cache")) + .tracing(new MicrometerTracing(observationRegistry, "my-redis-cache")) .build(); } @@ -31,15 +31,20 @@ class ObservabilityConfiguration { } ---- +NOTE: When using Spring Boot, `LettuceMetricsAutoConfiguration` configures Lettuce's `MicrometerCommandLatencyRecorder`. +Depending on whether you want only Metrics or Metrics and Tracing, you might want to exclude this auto-configuration class in your application. + +NOTE: Use Lettuce's built-in `MicrometerTracing` as `MicrometerTracingAdapter` has been deprecated for removal in future releases. + See also https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/database/#redis[OpenTelemetry Semantic Conventions] for further reference. [[observability-metrics]] == Observability - Metrics -Below you can find a list of all metrics declared by this project. +Below you can find a list of all metrics recorded by `MicrometerTracingAdapter`. [[observability-metrics-redis-command-observation]] -== Redis Command Observation +=== Redis Command Observation ____ Timer created around a Redis command execution. From 5e6f83cac3de45796baa48d1c3317cf7b1bd1ce0 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 18 Jul 2025 10:27:38 +0200 Subject: [PATCH 13/51] Prepare 3.5.2 (2025.0.2). See #3170 --- pom.xml | 22 +++++----------------- src/main/resources/notice.txt | 3 ++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 10acea41e6..4ad7a5e4cd 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.2-SNAPSHOT + 3.5.2 - 3.5.2-SNAPSHOT - 3.5.2-SNAPSHOT + 3.5.2 + 3.5.2 1.9.4 1.4.21 2.11.1 @@ -388,19 +388,7 @@ - - spring-snapshot - https://repo.spring.io/snapshot - - true - - - false - - - - spring-milestone - https://repo.spring.io/milestone - + + diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index 00b550b1d5..49606775b8 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.5.1 (2025.0.1) +Spring Data Redis 3.5.2 (2025.0.2) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -61,5 +61,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + From 3fbed1aa44184868f1732c4aa79c467371b2e45f Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 18 Jul 2025 10:27:58 +0200 Subject: [PATCH 14/51] Release version 3.5.2 (2025.0.2). See #3170 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ad7a5e4cd..be76cb91e6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.2-SNAPSHOT + 3.5.2 Spring Data Redis Spring Data module for Redis From 9a3d9fa272986680d5e54e4621d9d8bf97d3d748 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 18 Jul 2025 10:30:32 +0200 Subject: [PATCH 15/51] Prepare next development iteration. See #3170 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index be76cb91e6..4f0dff65e4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.2 + 3.5.3-SNAPSHOT Spring Data Redis Spring Data module for Redis From 9d40ab3568c536867b98c4802ba26eca87155d58 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 18 Jul 2025 10:30:33 +0200 Subject: [PATCH 16/51] After release cleanups. See #3170 --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 4f0dff65e4..592bea3a36 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.2 + 3.5.3-SNAPSHOT - 3.5.2 - 3.5.2 + 3.5.3-SNAPSHOT + 3.5.3-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + From 85d6d86398cd36f290a14d06c02f3301c6afb1d5 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 14 Aug 2025 16:50:27 +0200 Subject: [PATCH 17/51] Polishing. Refine antora documentation keys. See #3186 --- .../ROOT/pages/redis/redis-repositories/mapping.adoc | 2 +- src/main/antora/resources/antora-resources/antora.yml | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc index fb1a08c0f8..166786b1d0 100644 --- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/mapping.adoc @@ -183,7 +183,7 @@ NOTE: Custom conversions have no effect on index resolution. xref:redis/redis-re == Customizing Type Mapping If you want to avoid writing the entire Java class name as type information and would rather like to use a key, you can use the `@TypeAlias` annotation on the entity class being persisted. -If you need to customize the mapping even more, look at the https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/convert/TypeInformationMapper.html[`TypeInformationMapper`] interface. +If you need to customize the mapping even more, look at the {spring-data-commons-javadoc-base}/org/springframework/data/convert/TypeInformationMapper.html[`TypeInformationMapper`] interface. An instance of that interface can be configured at the `DefaultRedisTypeMapper`, which can be configured on `MappingRedisConverter`. The following example shows how to define a type alias for an entity: diff --git a/src/main/antora/resources/antora-resources/antora.yml b/src/main/antora/resources/antora-resources/antora.yml index 10dd13d032..f23d0ff822 100644 --- a/src/main/antora/resources/antora-resources/antora.yml +++ b/src/main/antora/resources/antora-resources/antora.yml @@ -3,20 +3,21 @@ prerelease: ${antora-component.prerelease} asciidoc: attributes: - copyright-year: ${current.year} + attribute-missing: 'warn' + chomp: 'all' version: ${project.version} + copyright-year: ${current.year} springversionshort: ${spring.short} springversion: ${spring} - attribute-missing: 'warn' commons: ${springdata.commons.docs} lettuce: ${lettuce} jedis: ${jedis} include-xml-namespaces: false - spring-data-commons-docs-url: https://docs.spring.io/spring-data/commons/reference - spring-data-commons-javadoc-base: https://docs.spring.io/spring-data/commons/docs/${springdata.commons}/api/ + spring-data-commons-docs-url: https://docs.spring.io/spring-data/commons/reference/{commons} + spring-data-commons-javadoc-base: '{spring-data-commons-docs-url}/api/java' springdocsurl: https://docs.spring.io/spring-framework/reference/{springversionshort} - springjavadocurl: https://docs.spring.io/spring-framework/docs/${spring}/javadoc-api spring-framework-docs: '{springdocsurl}' + springjavadocurl: https://docs.spring.io/spring-framework/docs/${spring}/javadoc-api spring-framework-javadoc: '{springjavadocurl}' springhateoasversion: ${spring-hateoas} releasetrainversion: ${releasetrain} From 1c27e42b55204610abe46a299d01f14c2509fafd Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 15 Aug 2025 10:01:14 +0200 Subject: [PATCH 18/51] Prepare 3.5.3 (2025.0.3). See #3185 --- pom.xml | 24 ++++++------------------ src/main/resources/notice.txt | 3 ++- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 592bea3a36..e67db97110 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.3-SNAPSHOT + 3.5.3 - 3.5.3-SNAPSHOT - 3.5.3-SNAPSHOT + 3.5.3 + 3.5.3 1.9.4 1.4.21 2.11.1 @@ -388,19 +388,7 @@ - - spring-snapshot - https://repo.spring.io/snapshot - - true - - - false - - - - spring-milestone - https://repo.spring.io/milestone - + + diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index 49606775b8..a04fcd7452 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.5.2 (2025.0.2) +Spring Data Redis 3.5.3 (2025.0.3) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -62,5 +62,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + From 15639ecf1ced097b1f7e19fb6eddc6194b9bf066 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 15 Aug 2025 10:01:35 +0200 Subject: [PATCH 19/51] Release version 3.5.3 (2025.0.3). See #3185 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e67db97110..d94c5e470c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.3-SNAPSHOT + 3.5.3 Spring Data Redis Spring Data module for Redis From 2a714b8614c92363a70930596474849a49b18d10 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 15 Aug 2025 10:04:15 +0200 Subject: [PATCH 20/51] Prepare next development iteration. See #3185 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d94c5e470c..68cc7dc48a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.3 + 3.5.4-SNAPSHOT Spring Data Redis Spring Data module for Redis From ab6061158dc73b87d2c79e7f5462a6599caf2de4 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 15 Aug 2025 10:04:16 +0200 Subject: [PATCH 21/51] After release cleanups. See #3185 --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 68cc7dc48a..4250d96c2d 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.3 + 3.5.4-SNAPSHOT - 3.5.3 - 3.5.3 + 3.5.4-SNAPSHOT + 3.5.4-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + From aa29bc5d94f63c9449316031519b72ed181dfe78 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 18 Aug 2025 09:32:30 +0200 Subject: [PATCH 22/51] Refine version properties for documentation build. See spring-projects/spring-data-build#2638 --- .../resources/antora-resources/antora.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/antora/resources/antora-resources/antora.yml b/src/main/antora/resources/antora-resources/antora.yml index f23d0ff822..a42895b13e 100644 --- a/src/main/antora/resources/antora-resources/antora.yml +++ b/src/main/antora/resources/antora-resources/antora.yml @@ -5,20 +5,20 @@ asciidoc: attributes: attribute-missing: 'warn' chomp: 'all' - version: ${project.version} - copyright-year: ${current.year} - springversionshort: ${spring.short} - springversion: ${spring} - commons: ${springdata.commons.docs} - lettuce: ${lettuce} - jedis: ${jedis} + version: '${project.version}' + copyright-year: '${current.year}' + springversionshort: '${spring.short}' + springversion: '${spring}' + commons: '${springdata.commons.docs}' + lettuce: '${lettuce}' + jedis: '${jedis}' include-xml-namespaces: false - spring-data-commons-docs-url: https://docs.spring.io/spring-data/commons/reference/{commons} + spring-data-commons-docs-url: '${documentation.baseurl}/spring-data/commons/reference/${springdata.commons.short}' spring-data-commons-javadoc-base: '{spring-data-commons-docs-url}/api/java' - springdocsurl: https://docs.spring.io/spring-framework/reference/{springversionshort} + springdocsurl: '${documentation.baseurl}/spring-framework/reference/{springversionshort}' spring-framework-docs: '{springdocsurl}' - springjavadocurl: https://docs.spring.io/spring-framework/docs/${spring}/javadoc-api + springjavadocurl: '${documentation.spring-javadoc-url}' spring-framework-javadoc: '{springjavadocurl}' - springhateoasversion: ${spring-hateoas} - releasetrainversion: ${releasetrain} + springhateoasversion: '${spring-hateoas}' + releasetrainversion: '${releasetrain}' store: Redis From 528c76d5013049c3ca61e03282b564ac9aef43b4 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Tue, 5 Aug 2025 14:29:34 +0200 Subject: [PATCH 23/51] Update RedisCommands. Add missing commands. Closes: #3191 Original pull request: #3193 --- .../data/redis/core/RedisCommand.java | 91 +++++++++++++++++-- .../redis/core/RedisCommandUnitTests.java | 2 +- 2 files changed, 86 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/core/RedisCommand.java b/src/main/java/org/springframework/data/redis/core/RedisCommand.java index 1454fd33c2..52d08ce6e8 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisCommand.java +++ b/src/main/java/org/springframework/data/redis/core/RedisCommand.java @@ -45,25 +45,43 @@ public enum RedisCommand { // -- A APPEND("rw", 2, 2), // AUTH("rw", 1, 1), // + // -- B BGREWRITEAOF("r", 0, 0, "bgwriteaof"), // BGSAVE("r", 0, 0), // BITCOUNT("r", 1, 3), // + BITFIELD("rw", 1), // + BITFIELD_RO("r", 1), BITOP("rw", 3), // BITPOS("r", 2, 4), // + BLMOVE("rw", 4), // + BLMPOP("rw", 4), // BLPOP("rw", 2), // BRPOP("rw", 2), // BRPOPLPUSH("rw", 3), // + BZMPOP("rw", 3), // + BZPOPMAX("rw", 2), // + BZPOPMIN("rw", 2), // + // -- C + CLIENT_GETREDIR("r", 0, 0), // + CLIENT_ID("r", 0, 0), // + CLIENT_INFO("r", 0, 0), // CLIENT_KILL("rw", 1, 1), // CLIENT_LIST("r", 0, 0), // CLIENT_GETNAME("r", 0, 0), // CLIENT_PAUSE("rw", 1, 1), // + CLIENT_SETINFO("w", 1), // CLIENT_SETNAME("w", 1, 1), // + CLIENT_NO_EVICT("w", 1, 1, "client no-evict"), // + CLIENT_NO_TOUCH("w", 1, 1, "client no-touch"), // + CLIENT_TRACKING("rw", 1), // CONFIG_GET("r", 1, 1, "getconfig"), // CONFIG_REWRITE("rw", 0, 0), // CONFIG_SET("w", 2, 2, "setconfig"), // CONFIG_RESETSTAT("w", 0, 0, "resetconfigstats"), // + COPY("rw", 2), // + // -- D DBSIZE("r", 0, 0), // DECR("w", 1, 1), // @@ -71,39 +89,62 @@ public enum RedisCommand { DEL("rw", 1), // DISCARD("rw", 0, 0), // DUMP("r", 1, 1), // + // -- E ECHO("r", 1, 1), // EVAL("rw", 2), // + EVAL_RO("r", 2), // EVALSHA("rw", 2), // + EVALSHA_RO("r", 2), // EXEC("rw", 0, 0), // EXISTS("r", 1, 1), // EXPIRE("rw", 2), // EXPIREAT("rw", 2), // + EXPIRETIME("r", 1), // + // -- F + FCALL("rw", 2), // + FCALL_RO("r", 2), // FLUSHALL("w", 0, 0), // FLUSHDB("w", 0, 0), // + FUNCTION_DELETE("w", 1), // + FUNCTION_DUMP("w", 0, 0), // + FUNCTION_FLUSH("w", 0, 0), // + FUNCTION_KILL("w", 0, 0), // + // -- G GET("r", 1, 1), // GETBIT("r", 2, 2), // + GETDEL("rw", 1), // + GETEX("rw", 1), // GETRANGE("r", 3, 3), // GETSET("rw", 2, 2), // GEOADD("w", 3), // GEODIST("r", 2), // GEOHASH("r", 2), // GEOPOS("r", 2), // - GEORADIUS("r", 4), // - GEORADIUSBYMEMBER("r", 3), // + GEORADIUS("rw", 4), // + GEORADIUS_RO("r", 4), // + GEORADIUSBYMEMBER("rw", 3), // + GEORADIUSBYMEMBER_RO("r", 3), // + GEOSEARCH("r", 1), // + GEOSEARCH_STORE("rw", 1), // + // -- H HDEL("rw", 2), // + HELLO("rw", 0, 0), // HEXISTS("r", 2, 2), // HGET("r", 2, 2), // HGETALL("r", 1, 1), // + HGETDEL("rw", 2), // + HGETEX("rw", 2), // HINCRBY("rw", 3, 3), // HINCBYFLOAT("rw", 3, 3), // HKEYS("r", 1), // HLEN("r", 1), // HMGET("r", 2), // HMSET("w", 3), // + HPOP("rw", 3), HSET("w", 3, 3), // HSETNX("w", 3, 3), // HVALS("r", 1, 1), // @@ -111,27 +152,39 @@ public enum RedisCommand { HEXPIREAT("w", 5), // HPEXPIRE("w", 5), // HPEXPIREAT("w", 5), // + HPEXPIRETIME("r", 4), // HPERSIST("w", 4), // HTTL("r", 4), // HPTTL("r", 4), // + HSCAN("r", 2), // + HSTRLEN("r", 2), // + // -- I INCR("rw", 1), // + INCRBY("rw", 2, 2), // INCRBYFLOAT("rw", 2, 2), // INFO("r", 0), // + // -- K KEYS("r", 1), // + // -- L + LCS("r", 2), // LASTSAVE("r", 0), // LINDEX("r", 2, 2), // LINSERT("rw", 4, 4), // LLEN("r", 1, 1), // + LMOVE("rw", 2), // + LMPOP("rw", 2), // LPOP("rw", 1, 1), // + LPOS("r", 2), // LPUSH("rw", 2), // LPUSHX("rw", 2), // LRANGE("r", 3, 3), // LREM("rw", 3, 3), // LSET("w", 3, 3), // LTRIM("w", 3, 3), // + // -- M MGET("r", 1), // MIGRATE("rw", 0), // @@ -140,19 +193,26 @@ public enum RedisCommand { MSET("w", 2), // MSETNX("w", 2), // MULTI("rw", 0, 0), // + // -- P PERSIST("rw", 1, 1), // PEXPIRE("rw", 2), // PEXPIREAT("rw", 2), // + PEXPIRETIME("r", 1), // + PFADD("w", 10), // + PFCOUNT("r", 1), // + PFMERGE("rw", 2), // PING("r", 0, 0), // PSETEX("w", 3), // PSUBSCRIBE("r", 1), // PTTL("r", 1, 1), // // -- Q QUIT("rw", 0, 0), // + // -- R RANDOMKEY("r", 0, 0), // - + READONLY("w", 0, 0), // + READWRITE("w", 0, 0), // RENAME("w", 2, 2), // RENAMENX("w", 2, 2), // REPLICAOF("w", 2), // @@ -161,9 +221,11 @@ public enum RedisCommand { RPOPLPUSH("rw", 2, 2), // RPUSH("rw", 2), // RPUSHX("rw", 2, 2), // + // -- S SADD("rw", 2), // SAVE("rw", 0, 0), // + SCAN("r", 1), // SCARD("r", 1, 1), // SCRIPT_EXISTS("r", 1), // SCRIPT_FLUSH("rw", 0, 0), // @@ -179,6 +241,7 @@ public enum RedisCommand { SETRANGE("rw", 3, 3), // SHUTDOWN("rw", 0), // SINTER("r", 1), // + SINTERCARD("r", 1), // SINTERSTORE("rw", 2), // SISMEMBER("r", 2), // SLAVEOF("w", 2), // @@ -186,21 +249,39 @@ public enum RedisCommand { SMEMBERS("r", 1, 1), // SMOVE("rw", 3, 3), // SORT("rw", 1), // + SORT_RO("r", 1), // SPOP("rw", 1, 1), // SRANDMEMBER("r", 1, 1), // SREM("rw", 2), // + SSCAN("r", 1), // STRLEN("r", 1, 1), // SUBSCRIBE("rw", 1), // + SUBSTR("r", 3), // SUNION("r", 1), // SUNIONSTORE("rw ", 2), // SYNC("rw", 0, 0), // + // -- T TIME("r", 0, 0), // TTL("r", 1, 1), // TYPE("r", 1, 1), // + // -- U + UNLINK("w", 1), // UNSUBSCRIBE("rw", 0), // UNWATCH("rw", 0, 0), // + + // -- V + VADD("w", 3), // + VCARD("r", 1), // + VDIM("r", 1), // + VEMB("r", 2), // + VISMEMBER("r", 2), // + VLINKS("r", 2, 3), // + VRANDMEMBER("r", 1, 2), // + VREM("w", 2), // + VSIM("w", 1), // + // -- W WATCH("rw", 1), // // -- Z @@ -220,10 +301,8 @@ public enum RedisCommand { ZREVRANK("r", 2, 2), // ZSCORE("r", 2, 2), // ZUNIONSTORE("rw", 3), // - SCAN("r", 1), // - SSCAN("r", 2), // - HSCAN("r", 2), // ZSCAN("r", 2), // + // -- UNKNOWN / DEFAULT UNKNOWN("rw", -1); diff --git a/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java index e4d376de82..5634301274 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java @@ -135,7 +135,7 @@ void commandRequiresExactNumberOfArgumentsIsCorrect() { Arrays.stream(RedisCommand.values()) .forEach(command -> assertThat(command.requiresExactNumberOfArguments()) - .describedAs("Redis command [%s] failed requires exact arguments check").isEqualTo( + .describedAs("Redis command [%s] failed requires exact arguments check".formatted(command.name())).isEqualTo( ReflectionTestUtils.getField(command, "minArgs") == ReflectionTestUtils.getField(command, "maxArgs"))); } From feeda02dc46827887ff1fbcd2f7663ecb1c11ef4 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 8 Sep 2025 11:14:07 +0200 Subject: [PATCH 24/51] Polishing. Use parametrized tests for Command enum verification. See #3191 Original pull request: #3193 --- .../redis/core/RedisCommandUnitTests.java | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java index 5634301274..fcff1471ff 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisCommandUnitTests.java @@ -17,9 +17,10 @@ import static org.assertj.core.api.Assertions.*; -import java.util.Arrays; - import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + import org.springframework.test.util.ReflectionTestUtils; /** @@ -106,37 +107,34 @@ void shouldThrowExceptionOnInvalidArgumentCountForZaddWhenExpectedMinimalMatch() .withMessageContaining("ZADD command requires at least 3 arguments"); } - @Test // GH-2644 - void isRepresentedByIsCorrectForAllCommandsAndTheirAliases() { - - for (RedisCommand command : RedisCommand.values()) { + @ParameterizedTest(name = "{0}") // GH-2644 + @EnumSource(RedisCommand.class) + void isRepresentedByIsCorrectForAllCommandsAndTheirAliases(RedisCommand command) { - assertThat(command.isRepresentedBy(command.name())).isTrue(); - assertThat(command.isRepresentedBy(command.name().toLowerCase())).isTrue(); + assertThat(command.isRepresentedBy(command.name())).isTrue(); + assertThat(command.isRepresentedBy(command.name().toLowerCase())).isTrue(); - for (String alias : command.getAliases()) { - assertThat(command.isRepresentedBy(alias)).isTrue(); - assertThat(command.isRepresentedBy(alias.toUpperCase())).isTrue(); - } + for (String alias : command.getAliases()) { + assertThat(command.isRepresentedBy(alias)).isTrue(); + assertThat(command.isRepresentedBy(alias.toUpperCase())).isTrue(); } } - @Test // GH-2646 - void commandRequiresArgumentsIsCorrect() { + @ParameterizedTest(name = "{0}") // GH-2646 + @EnumSource(RedisCommand.class) + void commandRequiresArgumentsIsCorrect(RedisCommand command) { - Arrays.stream(RedisCommand.values()) - .forEach(command -> assertThat(command.requiresArguments()) - .describedAs("Redis command [%s] failed required arguments check", command) - .isEqualTo((int) ReflectionTestUtils.getField(command, "minArgs") > 0)); + assertThat(command.requiresArguments()).describedAs("Redis command [%s] failed required arguments check", command) + .isEqualTo((int) ReflectionTestUtils.getField(command, "minArgs") > 0); } - @Test // GH-2646 - void commandRequiresExactNumberOfArgumentsIsCorrect() { + @ParameterizedTest(name = "{0}") // GH-2646 + @EnumSource(RedisCommand.class) + void commandRequiresExactNumberOfArgumentsIsCorrect(RedisCommand command) { - Arrays.stream(RedisCommand.values()) - .forEach(command -> assertThat(command.requiresExactNumberOfArguments()) - .describedAs("Redis command [%s] failed requires exact arguments check".formatted(command.name())).isEqualTo( - ReflectionTestUtils.getField(command, "minArgs") == ReflectionTestUtils.getField(command, "maxArgs"))); + assertThat(command.requiresExactNumberOfArguments()) + .describedAs("Redis command [%s] failed requires exact arguments check".formatted(command.name())).isEqualTo( + ReflectionTestUtils.getField(command, "minArgs") == ReflectionTestUtils.getField(command, "maxArgs")); } } From bd53d5ccd9f234b457be5a66728bf2dc82406b2f Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 12 Sep 2025 11:41:09 +0200 Subject: [PATCH 25/51] Prepare 3.5.4 (2025.0.4). See #3198 --- pom.xml | 22 +++++----------------- src/main/resources/notice.txt | 3 ++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 4250d96c2d..006b91accf 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.4-SNAPSHOT + 3.5.4 - 3.5.4-SNAPSHOT - 3.5.4-SNAPSHOT + 3.5.4 + 3.5.4 1.9.4 1.4.21 2.11.1 @@ -388,19 +388,7 @@ - - spring-snapshot - https://repo.spring.io/snapshot - - true - - - false - - - - spring-milestone - https://repo.spring.io/milestone - + + diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index a04fcd7452..8fcd1677e0 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.5.3 (2025.0.3) +Spring Data Redis 3.5.4 (2025.0.4) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -63,5 +63,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + From 7b13dab0b16a15ead32741b776f4cbfdcf5148c4 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 12 Sep 2025 11:41:39 +0200 Subject: [PATCH 26/51] Release version 3.5.4 (2025.0.4). See #3198 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 006b91accf..971ebe8f33 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.4-SNAPSHOT + 3.5.4 Spring Data Redis Spring Data module for Redis From 957aa83ac33406eff555941698968917d63e984f Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 12 Sep 2025 11:45:32 +0200 Subject: [PATCH 27/51] Prepare next development iteration. See #3198 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 971ebe8f33..c730f1e923 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.4 + 3.5.5-SNAPSHOT Spring Data Redis Spring Data module for Redis From 3d733ffd1f28f834f8b52947872adad861f8cdf1 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 12 Sep 2025 11:45:34 +0200 Subject: [PATCH 28/51] After release cleanups. See #3198 --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index c730f1e923..80016d8768 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.4 + 3.5.5-SNAPSHOT - 3.5.4 - 3.5.4 + 3.5.5-SNAPSHOT + 3.5.5-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + From 3b752e7677d40cc485c70aeac3127115ff174575 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 23 Sep 2025 10:51:47 +0200 Subject: [PATCH 29/51] Update GitHub Actions. See #3216 --- .github/workflows/codeql.yml | 21 +++++++++++++++++++++ .github/workflows/project.yml | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..411d4a9338 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,21 @@ +# GitHub Actions for CodeQL Scanning + +name: "CodeQL Advanced" + +on: + push: + pull_request: + workflow_dispatch: + schedule: + # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule + - cron: '0 5 * * *' + +permissions: read-all + +jobs: + codeql-analysis-call: + permissions: + actions: read + contents: read + security-events: write + uses: spring-io/github-actions/.github/workflows/codeql-analysis.yml@1 diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml index a5f764579a..4c8108d353 100644 --- a/.github/workflows/project.yml +++ b/.github/workflows/project.yml @@ -10,6 +10,11 @@ on: pull_request_target: types: [opened, edited, reopened] +permissions: + contents: read + issues: write + pull-requests: write + jobs: Inbox: runs-on: ubuntu-latest From 62fe04ab1d73bda3acac28c10d80bd4f5c01f095 Mon Sep 17 00:00:00 2001 From: facewise Date: Mon, 18 Aug 2025 15:26:06 +0900 Subject: [PATCH 30/51] Remove unnecessary usages of Optional. Signed-off-by: facewise Closes #3203 --- .../data/redis/cache/BatchStrategies.java | 19 +++++++++++-------- .../data/redis/connection/RedisPassword.java | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java b/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java index dc808e516e..2eaad39402 100644 --- a/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java +++ b/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java @@ -16,11 +16,10 @@ package org.springframework.data.redis.cache; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; -import java.util.Optional; +import java.util.Set; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.core.Cursor; @@ -33,6 +32,7 @@ * @author Mark Paluch * @author Christoph Strobl * @author John Blum + * @author Yong-Hyun Kim * @since 2.6 */ public abstract class BatchStrategies { @@ -79,14 +79,17 @@ static class Keys implements BatchStrategy { @Override public long cleanCache(RedisConnection connection, String name, byte[] pattern) { - byte[][] keys = Optional.ofNullable(connection.keys(pattern)).orElse(Collections.emptySet()) - .toArray(new byte[0][]); + RedisKeyCommands commands = connection.keyCommands(); - if (keys.length > 0) { - connection.del(keys); - } + Set keys = commands.keys(pattern); + + if (keys == null || keys.isEmpty()) { + return 0; + } + + commands.del(keys.toArray(new byte[0][])); - return keys.length; + return keys.size(); } } diff --git a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java index 3fcb4ce343..74d0fd0180 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java @@ -34,6 +34,7 @@ * * @author Mark Paluch * @author Christoph Strobl + * @author Yong-Hyun Kim * @since 2.0 */ public class RedisPassword { @@ -54,10 +55,11 @@ private RedisPassword(char[] thePassword) { */ public static RedisPassword of(@Nullable String passwordAsString) { - return Optional.ofNullable(passwordAsString) // - .filter(StringUtils::hasText) // - .map(it -> new RedisPassword(it.toCharArray())) // - .orElseGet(RedisPassword::none); + if (!StringUtils.hasText(passwordAsString)) { + return none(); + } + + return new RedisPassword(passwordAsString.toCharArray()); } /** @@ -68,10 +70,11 @@ public static RedisPassword of(@Nullable String passwordAsString) { */ public static RedisPassword of(@Nullable char[] passwordAsChars) { - return Optional.ofNullable(passwordAsChars) // - .filter(it -> !ObjectUtils.isEmpty(passwordAsChars)) // - .map(it -> new RedisPassword(Arrays.copyOf(it, it.length))) // - .orElseGet(RedisPassword::none); + if (ObjectUtils.isEmpty(passwordAsChars)) { + return none(); + } + + return new RedisPassword(Arrays.copyOf(passwordAsChars, passwordAsChars.length)); } /** From d136ea385aa929031c2c6ef16caf66743056c11d Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 26 Sep 2025 11:02:03 +0200 Subject: [PATCH 31/51] Polishing. Replace other occurences of Optional being used as conditional substitute. Reformat code to use tab indents instead of spaces. See #3203 --- .../data/redis/cache/BatchStrategies.java | 12 +++++++----- .../data/redis/connection/RedisPassword.java | 11 ++++++----- .../connection/lettuce/LettuceConnectionFactory.java | 10 +++++++--- .../support/QueryByExampleRedisExecutor.java | 1 - 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java b/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java index 2eaad39402..41b1cfe3eb 100644 --- a/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java +++ b/src/main/java/org/springframework/data/redis/cache/BatchStrategies.java @@ -22,9 +22,11 @@ import java.util.Set; import org.springframework.data.redis.connection.RedisConnection; +import org.springframework.data.redis.connection.RedisKeyCommands; import org.springframework.data.redis.core.Cursor; import org.springframework.data.redis.core.ScanOptions; import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; /** * Collection of predefined {@link BatchStrategy} implementations using the Redis {@code KEYS} or {@code SCAN} command. @@ -81,13 +83,13 @@ public long cleanCache(RedisConnection connection, String name, byte[] pattern) RedisKeyCommands commands = connection.keyCommands(); - Set keys = commands.keys(pattern); + Set keys = commands.keys(pattern); - if (keys == null || keys.isEmpty()) { - return 0; - } + if (CollectionUtils.isEmpty(keys)) { + return 0; + } - commands.del(keys.toArray(new byte[0][])); + commands.del(keys.toArray(new byte[0][])); return keys.size(); } diff --git a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java index 74d0fd0180..070fb6158c 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java @@ -141,11 +141,6 @@ public Optional toOptional() { return Optional.empty(); } - @Override - public String toString() { - return "%s[%s]".formatted(getClass().getSimpleName(), isPresent() ? "*****" : ""); - } - @Override public boolean equals(@Nullable Object o) { @@ -163,4 +158,10 @@ public boolean equals(@Nullable Object o) { public int hashCode() { return ObjectUtils.nullSafeHashCode(thePassword); } + + @Override + public String toString() { + return "%s[%s]".formatted(getClass().getSimpleName(), isPresent() ? "*****" : ""); + } + } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java index 8941695eac..d35041871b 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java @@ -64,7 +64,6 @@ import org.springframework.data.redis.connection.RedisConfiguration.ClusterConfiguration; import org.springframework.data.redis.connection.RedisConfiguration.WithDatabaseIndex; import org.springframework.data.redis.connection.RedisConfiguration.WithPassword; -import org.springframework.data.util.Optionals; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -1198,8 +1197,13 @@ public void resetConnection() { doInLock(() -> { - Optionals.toStream(Optional.ofNullable(this.connection), Optional.ofNullable(this.reactiveConnection)) - .forEach(SharedConnection::resetConnection); + if (this.connection != null) { + this.connection.resetConnection(); + } + + if (this.reactiveConnection != null) { + this.reactiveConnection.resetConnection(); + } this.connection = null; this.reactiveConnection = null; diff --git a/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.java b/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.java index 44704c6096..85831ed9ba 100644 --- a/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.java +++ b/src/main/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutor.java @@ -118,7 +118,6 @@ public void setBeanClassLoader(ClassLoader classLoader) { @Override public Optional findOne(Example example) { - return Optional.ofNullable(doFindOne(example)); } From c87d772050fbfab6d748f550cc727843702cb30a Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Tue, 30 Sep 2025 11:46:43 -0500 Subject: [PATCH 32/51] Add missing RedisCommand enum entries for ZSet WithScores methods. The rangeWithScores family of methods (zRangeWithScores, zRangeByScoreWithScores, zRevRangeWithScores, zRevRangeByScoreWithScores) were missing from the RedisCommand enumeration, causing ConnectionSplittingInterceptor to resolve them as UNKNOWN commands. This resulted in read-only methods being incorrectly queued in MULTI/EXEC blocks instead of executing immediately on separate connections, causing them to return null in transactional contexts. This commit adds the ZRANGEWITHSCORES, ZRANGEBYSCOREWITHSCORES, ZREVRANGEWITHSCORES, ZREVRANGEBYSCOREWITHSCORES enum entries to RedisCommand.java. The fix ensures these read-only methods are properly recognized and execute immediately in transactional contexts. Original Pull Request: #3225 Fixes: #3187 Signed-off-by: LeeHyungGeol (cherry picked from commit 96f250dddf7a79f0ba7002e57328b49485d844d8) Signed-off-by: Chris Bono --- .../org/springframework/data/redis/core/RedisCommand.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/springframework/data/redis/core/RedisCommand.java b/src/main/java/org/springframework/data/redis/core/RedisCommand.java index 52d08ce6e8..c1d63c1077 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisCommand.java +++ b/src/main/java/org/springframework/data/redis/core/RedisCommand.java @@ -35,6 +35,7 @@ * @author Oscar Cai * @author Sébastien Volle * @author John Blum + * @author LeeHyungGeol * @since 1.3 * @link Redis @@ -292,12 +293,16 @@ public enum RedisCommand { ZINTERSTORE("rw", 3), // ZRANGE("r", 3), // ZRANGEBYSCORE("r", 3), // + ZRANGEWITHSCORES("r", 3), // + ZRANGEBYSCOREWITHSCORES("r", 2), // ZRANK("r", 2, 2), // ZREM("rw", 2), // ZREMRANGEBYRANK("rw", 3, 3), // ZREMRANGEBYSCORE("rw", 3, 3), // ZREVRANGE("r", 3), // ZREVRANGEBYSCORE("r", 3), // + ZREVRANGEWITHSCORES("r", 3), // + ZREVRANGEBYSCOREWITHSCORES("r", 2), // ZREVRANK("r", 2, 2), // ZSCORE("r", 2, 2), // ZUNIONSTORE("rw", 3), // From 6ec1b08008b27f6cd561f4a2f77d1c5ba8462b86 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 17 Oct 2025 11:33:06 +0200 Subject: [PATCH 33/51] Prepare 3.5.5 (2025.0.5). See #3216 --- pom.xml | 22 +++++----------------- src/main/resources/notice.txt | 3 ++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 80016d8768..c713de244f 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.5-SNAPSHOT + 3.5.5 - 3.5.5-SNAPSHOT - 3.5.5-SNAPSHOT + 3.5.5 + 3.5.5 1.9.4 1.4.21 2.11.1 @@ -388,19 +388,7 @@ - - spring-snapshot - https://repo.spring.io/snapshot - - true - - - false - - - - spring-milestone - https://repo.spring.io/milestone - + + diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index 8fcd1677e0..aae80dfe9c 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.5.4 (2025.0.4) +Spring Data Redis 3.5.5 (2025.0.5) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -64,5 +64,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + From d42893cf4d156d896638df4df37697768ef7c09f Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 17 Oct 2025 11:34:13 +0200 Subject: [PATCH 34/51] Release version 3.5.5 (2025.0.5). See #3216 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c713de244f..9ef87f2aa7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.5-SNAPSHOT + 3.5.5 Spring Data Redis Spring Data module for Redis From 5a797b5fe674a33fc4850cb9479ff4c5e96dc4a4 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 17 Oct 2025 11:39:05 +0200 Subject: [PATCH 35/51] Prepare next development iteration. See #3216 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ef87f2aa7..750bbe8e8a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.5 + 3.5.6-SNAPSHOT Spring Data Redis Spring Data module for Redis From 8b47704f607d77bc817f5fd61056ea667d6d1527 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 17 Oct 2025 11:39:06 +0200 Subject: [PATCH 36/51] After release cleanups. See #3216 --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 750bbe8e8a..51ae113c44 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.5 + 3.5.6-SNAPSHOT - 3.5.5 - 3.5.5 + 3.5.6-SNAPSHOT + 3.5.6-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + From f047b4d0353f6776fe0dfec5f27ca2131ea95ff9 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 21 Oct 2025 09:25:14 +0200 Subject: [PATCH 37/51] Fixed nondetermistic tests in MappingRedisConverterUnitTests. Closes #3242 --- .../MappingRedisConverterUnitTests.java | 37 ++++--------------- .../data/redis/test/util/RedisTestData.java | 16 +++++--- 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java index c70b933f07..bad40ef82b 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java @@ -15,33 +15,9 @@ */ package org.springframework.data.redis.core.convert; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.when; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.AccountInfo; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Address; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.AddressWithId; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.AddressWithPostcode; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Device; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.ExipringPersonWithExplicitProperty; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.ExpiringPerson; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Gender; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.JustSomeDifferentPropertyTypes; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.KEYSPACE_ACCOUNT; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.KEYSPACE_PERSON; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Location; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Outer; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Person; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.PersonWithConstructorAndAddress; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.RecursiveConstructorPerson; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Size; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.Species; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.TaVeren; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.TheWheelOfTime; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.TypeWithMaps; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.TypeWithObjectValueTypes; -import static org.springframework.data.redis.core.convert.ConversionTestEntities.WithArrays; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; +import static org.springframework.data.redis.core.convert.ConversionTestEntities.*; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -1053,7 +1029,7 @@ void writeShouldHonorCustomConversionOnRootType() { address.country = "Tel'aran'rhiod"; address.city = "unknown"; - assertThat(write(address)).containsEntry("_raw", "{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}"); + assertThat(write(address).get("_raw")).contains("\"city\":\"unknown\"").contains("\"country\":\"Tel'aran'rhiod\""); } @Test // DATAREDIS-425, DATAREDIS-634 @@ -1074,7 +1050,7 @@ void writeShouldHonorCustomConversionOnNestedType() { address.city = "unknown"; rand.address = address; - assertThat(write(rand)).containsEntry("address", "{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}"); + assertThat(write(rand).get("address")).contains("\"city\":\"unknown\"").contains("\"country\":\"Tel'aran'rhiod\""); } @Test // DATAREDIS-425 @@ -1769,7 +1745,8 @@ void writeShouldWritePartialUpdatePathWithRegisteredCustomConversionCorrectly() PartialUpdate update = new PartialUpdate<>("123", Person.class).set("address", address); - assertThat(write(update)).containsEntry("address", "{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}"); + assertThat(write(update).get("address")).contains("\"city\":\"unknown\",") + .contains("\"country\":\"Tel'aran'rhiod\""); } @Test // DATAREDIS-471 diff --git a/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java b/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java index 959f0da9bb..f808bb23a6 100644 --- a/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java +++ b/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java @@ -37,9 +37,11 @@ public class RedisTestData implements AssertProvider { private final RedisData redisData; + private final Map stringMap; - RedisTestData(RedisData redisData) { + private RedisTestData(RedisData redisData) { this.redisData = redisData; + this.stringMap = toStringMap(redisData.getBucket().asMap()); } public static RedisTestData from(RedisData data) { @@ -48,7 +50,11 @@ public static RedisTestData from(RedisData data) { @Override public RedisBucketAssert assertThat() { - return new RedisBucketAssert(redisData); + return new RedisBucketAssert(redisData, stringMap); + } + + public String get(String key) { + return stringMap.get(key); } public Bucket getBucket() { @@ -69,9 +75,9 @@ public static class RedisBucketAssert extends MapAssert { private final RedisData redisData; - RedisBucketAssert(RedisData redisData) { + RedisBucketAssert(RedisData redisData, Map stringMap) { - super(toStringMap(redisData.getBucket().asMap())); + super(stringMap); this.redisData = redisData; } @@ -154,6 +160,6 @@ private static Map toStringMap(Map source) { @Override public String toString() { - return toStringMap(getBucket().asMap()).toString(); + return stringMap.toString(); } } From de70e48c095b8cd35d6d2dfd48b437e6bd4bd00e Mon Sep 17 00:00:00 2001 From: Seo Bo Gyeong Date: Wed, 20 Aug 2025 21:27:09 +0900 Subject: [PATCH 38/51] Add stream-key auto-conversion for ByteRecord. Add automatic type conversion logic in StreamRecords.ofBytes() method to handle different stream key types safely. Signed-off-by: Seo Bo Gyeong Closes #3204 --- .../connection/stream/StreamRecords.java | 21 +++++- .../connection/StreamRecordsUnitTests.java | 69 +++++++++++++++++++ 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java index 499119a1be..70108c891c 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java @@ -30,6 +30,7 @@ * {@link StreamRecords} provides utilities to create specific {@link Record} instances. * * @author Christoph Strobl + * @author Seo Bo Gyeong * @since 2.2 */ public class StreamRecords { @@ -197,8 +198,24 @@ public ObjectRecord ofObject(V value) { */ public ByteRecord ofBytes(Map value) { - // todo auto conversion of known values - return new ByteMapBackedRecord((byte[]) stream, id, value); + byte[] streamKey = convertStreamToByteArray(stream); + return new ByteMapBackedRecord(streamKey, id, value); + } + + private byte[] convertStreamToByteArray(@Nullable Object stream) { + if (stream instanceof byte[]) { + return (byte[]) stream; + } else if (stream instanceof String) { + return ((String) stream).getBytes(); + } else if (stream instanceof ByteBuffer buffer) { + byte[] result = new byte[buffer.remaining()]; + buffer.get(result); + return result; + } else if (stream == null) { + return null; + } else { + throw new IllegalArgumentException("Stream key %s cannot be converted to byte array".formatted(stream)); + } } /** diff --git a/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java index 02ab8faf5a..583b07a471 100644 --- a/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java @@ -18,6 +18,7 @@ import static org.assertj.core.api.Assertions.*; import java.io.Serializable; +import java.nio.ByteBuffer; import java.util.Collections; import java.util.Map; @@ -164,4 +165,72 @@ static HashMapper simpleString(String value) { } } + @Test // Stream key auto conversion for ofBytes method + void ofBytesWithStringStreamKey() { + + ByteRecord record = StreamRecords.newRecord() + .in(STRING_STREAM_KEY) + .withId(RECORD_ID) + .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); + + assertThat(record.getId()).isEqualTo(RECORD_ID); + assertThat(record.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); + assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); + assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + } + + @Test // Stream key auto conversion for ofBytes method with byte array + void ofBytesWithByteArrayStreamKey() { + + ByteRecord record = StreamRecords.newRecord() + .in(SERIALIZED_STRING_STREAM_KEY) + .withId(RECORD_ID) + .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); + + assertThat(record.getId()).isEqualTo(RECORD_ID); + assertThat(record.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); + assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); + assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + } + + @Test // Stream key auto conversion for ofBytes method with null stream key + void ofBytesWithNullStreamKey() { + + ByteRecord record = StreamRecords.newRecord() + .withId(RECORD_ID) + .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); + + assertThat(record.getId()).isEqualTo(RECORD_ID); + assertThat(record.getStream()).isNull(); + assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); + assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + } + + @Test // Stream key auto conversion for ofBytes method with ByteBuffer stream key + void ofBytesWithByteBufferStreamKey() { + + ByteBuffer streamKeyBuffer = ByteBuffer.wrap(SERIALIZED_STRING_STREAM_KEY); + + ByteRecord record = StreamRecords.newRecord() + .in(streamKeyBuffer) + .withId(RECORD_ID) + .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); + + assertThat(record.getId()).isEqualTo(RECORD_ID); + assertThat(record.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); + assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); + assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + } + + @Test // Stream key auto conversion for ofBytes method with unsupported type + void ofBytesWithUnsupportedStreamKeyType() { + + assertThatThrownBy(() -> StreamRecords.newRecord() + .in(123L) // Unsupported type + .withId(RECORD_ID) + .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL))) + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("Stream key 123 cannot be converted to byte array"); + } + } From 5a24a66b23509c28050813d4c508caf38b32118a Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 23 Oct 2025 09:45:22 +0200 Subject: [PATCH 39/51] Polishing. Unify byte array/buffer/String conversion. Simplify tests. See #3204 --- .../connection/stream/StreamRecords.java | 69 ++++++++------- .../connection/StreamRecordsUnitTests.java | 88 +++++++------------ 2 files changed, 70 insertions(+), 87 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java index 70108c891c..f2e125e3e2 100644 --- a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java +++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java @@ -21,6 +21,7 @@ import java.util.Map.Entry; import org.springframework.data.redis.util.ByteUtils; +import org.springframework.lang.Contract; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -178,7 +179,7 @@ public MapRecord ofMap(Map map) { * @see MapRecord */ public StringRecord ofStrings(Map map) { - return new StringMapBackedRecord(ObjectUtils.nullSafeToString(stream), id, map); + return new StringMapBackedRecord(toString(stream), id, map); } /** @@ -197,47 +198,56 @@ public ObjectRecord ofObject(V value) { * @return new instance of {@link ByteRecord}. */ public ByteRecord ofBytes(Map value) { + return new ByteMapBackedRecord(toByteArray(stream), id, value); + } - byte[] streamKey = convertStreamToByteArray(stream); - return new ByteMapBackedRecord(streamKey, id, value); + /** + * @param value + * @return new instance of {@link ByteBufferRecord}. + */ + public ByteBufferRecord ofBuffer(Map value) { + return new ByteBufferMapBackedRecord(toByteBuffer(stream), id, value); } - private byte[] convertStreamToByteArray(@Nullable Object stream) { - if (stream instanceof byte[]) { - return (byte[]) stream; - } else if (stream instanceof String) { - return ((String) stream).getBytes(); + @Contract("null -> null; !null -> !null") + @Nullable + private static byte[] toByteArray(@Nullable Object stream) { + + if (stream instanceof byte[] bytes) { + return bytes; } else if (stream instanceof ByteBuffer buffer) { - byte[] result = new byte[buffer.remaining()]; - buffer.get(result); - return result; + return ByteUtils.getBytes(buffer); + } else if (stream instanceof CharSequence s) { + return s.toString().getBytes(); } else if (stream == null) { return null; - } else { - throw new IllegalArgumentException("Stream key %s cannot be converted to byte array".formatted(stream)); } + + throw new IllegalArgumentException("Stream key '%s' cannot be converted to byte array".formatted(stream)); } - /** - * @param value - * @return new instance of {@link ByteBufferRecord}. - */ - public ByteBufferRecord ofBuffer(Map value) { + private static ByteBuffer toByteBuffer(@Nullable Object stream) { - ByteBuffer streamKey; + if (stream instanceof byte[] bytes) { + return ByteBuffer.wrap(bytes); + } else if (stream instanceof ByteBuffer bb) { + return bb; + } else if (stream instanceof CharSequence cs) { + return ByteUtils.getByteBuffer(cs.toString()); + } - if (stream instanceof ByteBuffer) { - streamKey = (ByteBuffer) stream; - } else if (stream instanceof String) { - streamKey = ByteUtils.getByteBuffer((String) stream); - } else if (stream instanceof byte[]) { - streamKey = ByteBuffer.wrap((byte[]) stream); - } else { - throw new IllegalArgumentException("Stream key %s cannot be converted to byte buffer".formatted(stream)); + throw new IllegalArgumentException("Stream key '%s' cannot be converted to byte buffer".formatted(stream)); + } + + private static String toString(@Nullable Object stream) { + + if (stream instanceof byte[] || stream instanceof ByteBuffer) { + return new String(toByteArray(stream)); } - return new ByteBufferMapBackedRecord(streamKey, id, value); + return ObjectUtils.nullSafeToString(stream); } + } /** @@ -359,8 +369,7 @@ public ByteMapBackedRecord withId(RecordId id) { static class ByteBufferMapBackedRecord extends MapBackedRecord implements ByteBufferRecord { - ByteBufferMapBackedRecord(@Nullable ByteBuffer stream, @Nullable RecordId recordId, - Map map) { + ByteBufferMapBackedRecord(@Nullable ByteBuffer stream, @Nullable RecordId recordId, Map map) { super(stream, recordId, map); } diff --git a/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java index 583b07a471..c121250d03 100644 --- a/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java @@ -21,8 +21,12 @@ import java.nio.ByteBuffer; import java.util.Collections; import java.util.Map; +import java.util.stream.Stream; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.springframework.data.redis.connection.stream.ByteRecord; import org.springframework.data.redis.connection.stream.MapRecord; @@ -39,6 +43,7 @@ * * @author Christoph Strobl * @author Romain Beghi + * @author Seo Bo Gyeong */ class StreamRecordsUnitTests { @@ -99,9 +104,7 @@ void serializeMapRecordStringAsHashValue() { ByteRecord target = source.serialize(RedisSerializer.string()); assertThat(target.getId()).isEqualTo(RECORD_ID); - assertThat(target.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); - assertThat(target.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); - assertThat(target.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + assertByteRecord(target); } @Test // DATAREDIS-993 @@ -137,14 +140,6 @@ static class StubValueReturningHashMapper implements HashMapper to; final T from; - public StubValueReturningHashMapper(Map to) { - this(to, (T) new Object()); - } - - public StubValueReturningHashMapper(T from) { - this(Collections.emptyMap(), from); - } - StubValueReturningHashMapper(Map to, T from) { this.to = to; this.from = from; @@ -165,72 +160,51 @@ static HashMapper simpleString(String value) { } } - @Test // Stream key auto conversion for ofBytes method - void ofBytesWithStringStreamKey() { + @Test // GH-3204 + void ofBytesWithNullStreamKey() { ByteRecord record = StreamRecords.newRecord() - .in(STRING_STREAM_KEY) .withId(RECORD_ID) .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); assertThat(record.getId()).isEqualTo(RECORD_ID); - assertThat(record.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); - assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); - assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + assertThat(record.getStream()).isNull(); } - @Test // Stream key auto conversion for ofBytes method with byte array - void ofBytesWithByteArrayStreamKey() { - - ByteRecord record = StreamRecords.newRecord() - .in(SERIALIZED_STRING_STREAM_KEY) - .withId(RECORD_ID) - .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); + @Test // GH-3204 + void ofBytesWithUnsupportedStreamKeyType() { - assertThat(record.getId()).isEqualTo(RECORD_ID); - assertThat(record.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); - assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); - assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + assertThatIllegalArgumentException().isThrownBy(() -> StreamRecords.newRecord().in(123L) // Unsupported type + .withId(RECORD_ID).ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL))) + .withMessageContaining("Stream key '123' cannot be converted to byte array"); } - @Test // Stream key auto conversion for ofBytes method with null stream key - void ofBytesWithNullStreamKey() { + @ParameterizedTest // GH-3204 + @MethodSource("ofBytesInStreamArgs") + void ofBytes(Object streamKey) { - ByteRecord record = StreamRecords.newRecord() - .withId(RECORD_ID) + ByteRecord record = StreamRecords.newRecord().in(streamKey).withId(RECORD_ID) .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); assertThat(record.getId()).isEqualTo(RECORD_ID); - assertThat(record.getStream()).isNull(); - assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); - assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + assertByteRecord(record); } - @Test // Stream key auto conversion for ofBytes method with ByteBuffer stream key - void ofBytesWithByteBufferStreamKey() { - - ByteBuffer streamKeyBuffer = ByteBuffer.wrap(SERIALIZED_STRING_STREAM_KEY); - - ByteRecord record = StreamRecords.newRecord() - .in(streamKeyBuffer) - .withId(RECORD_ID) - .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); - - assertThat(record.getId()).isEqualTo(RECORD_ID); - assertThat(record.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); - assertThat(record.getValue().keySet().iterator().next()).isEqualTo(SERIALIZED_STRING_MAP_KEY); - assertThat(record.getValue().values().iterator().next()).isEqualTo(SERIALIZED_STRING_VAL); + static Stream ofBytesInStreamArgs() { + return Stream.of(Arguments.argumentSet("ByteBuffer", ByteBuffer.wrap(SERIALIZED_STRING_STREAM_KEY)), // + Arguments.argumentSet("byte[]", new Object[] { SERIALIZED_STRING_STREAM_KEY }), // + Arguments.argumentSet("String", STRING_STREAM_KEY)); } - @Test // Stream key auto conversion for ofBytes method with unsupported type - void ofBytesWithUnsupportedStreamKeyType() { + private void assertByteRecord(ByteRecord target) { - assertThatThrownBy(() -> StreamRecords.newRecord() - .in(123L) // Unsupported type - .withId(RECORD_ID) - .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL))) - .isInstanceOf(IllegalArgumentException.class) - .hasMessageContaining("Stream key 123 cannot be converted to byte array"); + assertThat(target.getStream()).isEqualTo(SERIALIZED_STRING_STREAM_KEY); + assertThat(target.getValue()).hasSize(1); + + target.getValue().forEach((k, v) -> { + assertThat(k).isEqualTo(SERIALIZED_STRING_MAP_KEY); + assertThat(v).isEqualTo(SERIALIZED_STRING_VAL); + }); } } From 6441990d9f831febf8682f763a472658ae137f32 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 24 Oct 2025 10:20:40 +0200 Subject: [PATCH 40/51] Re-apply code formatter. Closes #3245. --- .../data/redis/ClusterRedirectException.java | 3 +- .../redis/ClusterStateFailureException.java | 3 +- .../TooManyClusterRedirectionsException.java | 3 +- .../data/redis/cache/CacheKeyPrefix.java | 26 +- .../redis/cache/RedisCacheConfiguration.java | 66 ++-- .../data/redis/cache/RedisCacheManager.java | 152 ++++---- .../connection/ClusterCommandExecutor.java | 3 +- .../redis/connection/ClusterSlotHashUtil.java | 10 +- .../DefaultStringRedisConnection.java | 26 +- .../connection/DefaultedRedisConnection.java | 6 +- .../ReactiveClusterKeyCommands.java | 4 +- .../ReactiveClusterStreamCommands.java | 3 +- .../redis/connection/ReactiveGeoCommands.java | 8 +- .../connection/ReactiveStreamCommands.java | 6 +- .../connection/ReactiveSubscription.java | 2 +- .../connection/ReactiveZSetCommands.java | 16 +- .../redis/connection/RedisClusterNode.java | 14 +- .../data/redis/connection/RedisCommands.java | 4 +- .../redis/connection/RedisHashCommands.java | 3 +- .../data/redis/connection/RedisPassword.java | 16 +- .../redis/connection/RedisSetCommands.java | 1 - .../RedisStandaloneConfiguration.java | 4 +- .../connection/StringRedisConnection.java | 3 +- .../redis/connection/convert/Converters.java | 11 +- .../DefaultJedisClientConfiguration.java | 7 +- .../jedis/JedisClusterConnection.java | 35 +- .../jedis/JedisClusterServerCommands.java | 3 +- .../jedis/JedisClusterStreamCommands.java | 6 +- .../jedis/JedisClusterZSetCommands.java | 20 +- .../connection/jedis/JedisConnection.java | 14 +- .../redis/connection/jedis/JedisInvoker.java | 1 + .../jedis/JedisScriptingCommands.java | 3 +- .../connection/jedis/JedisZSetCommands.java | 1 - .../lettuce/ClusterConnectionProvider.java | 9 +- .../lettuce/LettuceClusterConnection.java | 16 +- .../lettuce/LettuceConnectionFactory.java | 1 - .../connection/lettuce/LettuceConverters.java | 18 +- .../lettuce/LettuceKeyCommands.java | 1 - .../LettuceReactiveClusterSetCommands.java | 8 +- .../lettuce/LettuceReactiveListCommands.java | 2 +- ...LettuceReactiveRedisClusterConnection.java | 2 +- .../LettuceReactiveStreamCommands.java | 11 +- .../LettuceReactiveStringCommands.java | 65 ++-- .../lettuce/LettuceStreamCommands.java | 3 +- .../lettuce/LettuceStringCommands.java | 25 +- .../lettuce/StandaloneConnectionProvider.java | 3 +- .../data/redis/connection/package-info.java | 1 - .../connection/stream/StreamRecords.java | 3 +- .../redis/connection/util/package-info.java | 1 - .../data/redis/core/BoundGeoOperations.java | 13 +- .../data/redis/core/ClusterOperations.java | 6 +- .../data/redis/core/DefaultGeoOperations.java | 11 +- .../redis/core/DefaultHashOperations.java | 2 +- .../core/DefaultReactiveGeoOperations.java | 27 +- .../core/DefaultReactiveListOperations.java | 16 +- .../core/DefaultReactiveStreamOperations.java | 18 +- .../core/DefaultReactiveValueOperations.java | 37 +- .../core/DefaultReactiveZSetOperations.java | 46 ++- .../data/redis/core/DefaultSetOperations.java | 3 +- .../redis/core/DefaultStreamOperations.java | 2 +- .../redis/core/DefaultZSetOperations.java | 4 +- .../data/redis/core/GeoOperations.java | 6 +- .../data/redis/core/KeyScanOptions.java | 5 +- .../redis/core/ReactiveRedisTemplate.java | 4 +- .../redis/core/ReactiveStreamOperations.java | 32 +- .../data/redis/core/RedisAccessor.java | 4 +- .../data/redis/core/RedisCommand.java | 8 +- .../data/redis/core/RedisConnectionUtils.java | 3 +- .../redis/core/RedisKeyValueTemplate.java | 6 +- .../data/redis/core/ScanIteration.java | 2 +- .../data/redis/core/StreamObjectMapper.java | 6 +- .../data/redis/core/StreamOperations.java | 27 +- .../redis/core/convert/BinaryConverters.java | 6 +- .../data/redis/core/convert/Bucket.java | 6 +- .../core/convert/MappingRedisConverter.java | 3 +- .../redis/core/convert/PathIndexResolver.java | 2 +- .../redis/core/convert/RemoveIndexedData.java | 3 +- .../data/redis/core/query/QueryUtils.java | 4 +- .../data/redis/core/query/package-info.java | 1 - .../script/DefaultReactiveScriptExecutor.java | 4 +- .../data/redis/core/types/Expiration.java | 25 +- .../data/redis/domain/geo/BoundingBox.java | 6 +- .../data/redis/domain/geo/BoxShape.java | 1 - .../data/redis/domain/geo/GeoShape.java | 1 - .../data/redis/hash/Jackson2HashMapper.java | 41 +-- .../RedisMessageListenerContainer.java | 2 +- .../SynchronizingMessageListener.java | 6 +- .../cdi/RedisRepositoryExtension.java | 9 +- .../EnableRedisRepositories.java | 4 +- .../repository/query/RedisOperationChain.java | 6 +- .../DefaultRedisSerializationContext.java | 7 +- .../JdkSerializationRedisSerializer.java | 31 +- .../serializer/RedisSerializationContext.java | 15 +- ...sSerializerToSerializationPairAdapter.java | 8 +- .../redis/stream/DefaultStreamReceiver.java | 16 +- .../data/redis/stream/StreamPollTask.java | 1 - .../data/redis/stream/StreamReceiver.java | 3 +- .../support/atomic/RedisAtomicDouble.java | 3 +- .../support/atomic/RedisAtomicInteger.java | 3 +- .../redis/support/atomic/RedisAtomicLong.java | 3 +- .../support/collections/DefaultRedisList.java | 9 +- .../redis/support/collections/RedisList.java | 10 +- .../data/redis/util/RedisAssertions.java | 10 +- .../data/redis/SettingsUtils.java | 3 - .../data/redis/cache/CacheTestParams.java | 6 +- .../DefaultRedisCachWriterUnitTests.java | 29 +- .../redis/cache/LegacyRedisCacheTests.java | 3 +- .../RedisCacheConfigurationUnitTests.java | 17 +- .../cache/RedisCacheManagerUnitTests.java | 22 +- .../cache/RedisCacheWriterUnitTests.java | 17 +- .../config/NamespaceIntegrationTests.java | 5 - .../connection/ClusterSlotHashUtilsTests.java | 14 +- ...ultStringRedisConnectionPipelineTests.java | 8 +- ...tStringRedisConnectionPipelineTxTests.java | 334 ++++++------------ .../DefaultStringRedisConnectionTxTests.java | 8 +- .../RedisClusterNodeSlotRangeUnitTests.java | 25 +- ...edisElastiCacheConfigurationUnitTests.java | 6 +- .../redis/connection/RedisNodeUnitTests.java | 4 +- .../connection/RedisPasswordUnitTests.java | 3 +- .../connection/StreamRecordsUnitTests.java | 3 +- .../jedis/JedisClusterConnectionTests.java | 1 - .../JedisConnectionIntegrationTests.java | 14 +- ...ConnectionTransactionIntegrationTests.java | 37 +- .../jedis/JedisConnectionUnitTests.java | 11 +- .../jedis/JedisConvertersUnitTests.java | 11 +- .../LettuceClusterConnectionTests.java | 1 - .../LettuceConnectionFactoryTests.java | 3 +- .../LettuceConnectionIntegrationTests.java | 12 +- ...eConnectionPipelineTxIntegrationTests.java | 18 +- .../lettuce/LettuceConnectionUnitTests.java | 29 +- .../lettuce/LettuceConvertersUnitTests.java | 20 +- ...erHyperLogLogCommandsIntegrationTests.java | 2 +- .../LettuceReactiveCommandsTestSupport.java | 3 +- ...ceReactiveGeoCommandsIntegrationTests.java | 4 +- ...eReactiveHashCommandsIntegrationTests.java | 2 +- ...ttuceReactiveHyperLogLogCommandsTests.java | 2 +- ...ceReactiveListCommandIntegrationTests.java | 7 +- ...activeRedisClusterConnectionUnitTests.java | 3 +- ...eactiveServerCommandsIntegrationTests.java | 6 +- ...eactiveStreamCommandsIntegrationTests.java | 4 +- ...eactiveStringCommandsIntegrationTests.java | 37 +- ...eReactiveZSetCommandsIntegrationTests.java | 8 +- .../LettuceSentinelIntegrationTests.java | 7 +- .../core/AbstractOperationsTestParams.java | 1 - ...nnectionSplittingInterceptorUnitTests.java | 7 +- .../redis/core/ConvertingCursorUnitTests.java | 26 +- .../DefaultGeoOperationsIntegrationTests.java | 21 +- ...ReactiveGeoOperationsIntegrationTests.java | 3 +- ...activeValueOperationsIntegrationTests.java | 15 +- ...eactiveZSetOperationsIntegrationTests.java | 5 +- .../DefaultSetOperationsIntegrationTests.java | 6 +- .../core/DefaultTypedTupleUnitTests.java | 3 +- ...DefaultZSetOperationsIntegrationTests.java | 6 +- .../data/redis/core/IndexWriterUnitTests.java | 16 +- .../core/MappingExpirationListenerTest.java | 10 +- ...ReactiveRedisTemplateIntegrationTests.java | 13 +- ...veStringRedisTemplateIntegrationTests.java | 2 +- .../redis/core/RedisAccessorUnitTests.java | 19 +- .../RedisClusterTemplateIntegrationTests.java | 1 - .../core/RedisKeyExpiredEventUnitTests.java | 3 +- .../redis/core/RedisKeyValueAdapterTests.java | 6 +- .../core/RedisKeyValueTemplateTests.java | 76 ++-- .../data/redis/core/SessionUnitTests.java | 3 +- .../CompositeIndexResolverUnitTests.java | 8 +- .../core/convert/ConversionTestEntities.java | 35 +- .../MappingRedisConverterUnitTests.java | 256 +++++++------- .../convert/PathIndexResolverUnitTests.java | 17 +- .../index/IndexConfigurationUnitTests.java | 8 +- .../BasicRedisPersistentEntityUnitTests.java | 4 +- ...onfigAwareTimeToLiveAccessorUnitTests.java | 12 +- .../DefaultReactiveScriptExecutorTests.java | 4 +- .../DefaultScriptExecutorUnitTests.java | 12 +- .../redis/core/types/ExpirationUnitTests.java | 2 +- ...nEventMessageListenerIntegrationTests.java | 2 - ...edisMessageListenerContainerUnitTests.java | 4 +- .../adapter/MessageListenerUnitTests.java | 3 +- .../data/redis/listener/adapter/RedisMDP.java | 6 +- .../mapping/BeanUtilsHashMapperTests.java | 3 +- ...Jackson2HashMapperFlatteningUnitTests.java | 10 +- .../Jackson2HashMapperIntegrationTests.java | 12 +- ...kson2HashMapperNonFlatteningUnitTests.java | 11 +- .../mapping/Jackson2HashMapperUnitTests.java | 18 +- .../redis/mapping/ObjectHashMapperTests.java | 3 +- ...edisRepositoryClusterIntegrationTests.java | 4 +- .../RedisRepositoryIntegrationTests.java | 4 +- .../data/redis/repository/cdi/PersonDB.java | 1 - .../repository/cdi/RepositoryConsumer.java | 3 +- .../RedisRepositoriesRegistrarUnitTests.java | 3 +- .../query/ExampleQueryMapperUnitTests.java | 12 +- ...yExampleRedisExecutorIntegrationTests.java | 11 +- ...cJackson2JsonRedisSerializerUnitTests.java | 60 ++-- .../RedisSerializationContextUnitTests.java | 52 ++- .../SimpleRedisSerializerTests.java | 5 +- ...sageListenerContainerIntegrationTests.java | 12 +- .../StreamReceiverIntegrationTests.java | 7 +- .../support/atomic/AtomicCountersParam.java | 3 - .../RedisAtomicDoubleIntegrationTests.java | 1 - .../AbstractRedisCollectionUnitTests.java | 2 +- .../AbstractRedisListIntegrationTests.java | 5 +- .../AbstractRedisSetIntegrationTests.java | 4 +- .../RedisCollectionFactoryBeanTests.java | 2 +- .../collections/RedisMapIntegrationTests.java | 3 +- .../RedisPropertiesIntegrationTests.java | 21 +- .../EnabledOnRedisAvailableCondition.java | 7 +- .../EnabledOnRedisClusterCondition.java | 4 +- .../EnabledOnRedisDriverCondition.java | 4 +- .../EnabledOnRedisSentinelCondition.java | 7 +- .../EnabledOnRedisVersionCondition.java | 4 +- .../ParameterizedRedisTestExtension.java | 15 +- .../ParameterizedTestNameFormatter.java | 7 +- .../data/redis/test/util/RedisTestData.java | 1 - 211 files changed, 1180 insertions(+), 1694 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/ClusterRedirectException.java b/src/main/java/org/springframework/data/redis/ClusterRedirectException.java index 562347e86a..56774cdf00 100644 --- a/src/main/java/org/springframework/data/redis/ClusterRedirectException.java +++ b/src/main/java/org/springframework/data/redis/ClusterRedirectException.java @@ -29,8 +29,7 @@ */ public class ClusterRedirectException extends DataRetrievalFailureException { - @Serial - private static final long serialVersionUID = -857075813794333965L; + @Serial private static final long serialVersionUID = -857075813794333965L; private final int slot; private final String host; diff --git a/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java b/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java index 29543870d6..f46e9cde61 100644 --- a/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java +++ b/src/main/java/org/springframework/data/redis/ClusterStateFailureException.java @@ -30,8 +30,7 @@ */ public class ClusterStateFailureException extends DataAccessResourceFailureException { - @Serial - private static final long serialVersionUID = 333399051713240852L; + @Serial private static final long serialVersionUID = 333399051713240852L; /** * Creates new {@link ClusterStateFailureException}. diff --git a/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java b/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java index e985374ae7..410661bed4 100644 --- a/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java +++ b/src/main/java/org/springframework/data/redis/TooManyClusterRedirectionsException.java @@ -27,8 +27,7 @@ */ public class TooManyClusterRedirectionsException extends DataRetrievalFailureException { - @Serial - private static final long serialVersionUID = -2818933672669154328L; + @Serial private static final long serialVersionUID = -2818933672669154328L; /** * Creates new {@link TooManyClusterRedirectionsException}. diff --git a/src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java b/src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java index 6d340afdad..c9d25b9136 100644 --- a/src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java +++ b/src/main/java/org/springframework/data/redis/cache/CacheKeyPrefix.java @@ -18,8 +18,8 @@ import org.springframework.util.Assert; /** - * {@link CacheKeyPrefix} is a callback hook for creating custom prefixes prepended to the actual {@literal key} - * stored in Redis. + * {@link CacheKeyPrefix} is a callback hook for creating custom prefixes prepended to the actual {@literal key} stored + * in Redis. * * @author Christoph Strobl * @author Mark Paluch @@ -39,18 +39,15 @@ public interface CacheKeyPrefix { /** * Compute the {@link String prefix} for the actual {@literal cache key} stored in Redis. * - * @param cacheName {@link String name} of the cache in which the key is stored; - * will never be {@literal null}. - * @return the computed {@link String prefix} of the {@literal cache key} stored in Redis; - * never {@literal null}. + * @param cacheName {@link String name} of the cache in which the key is stored; will never be {@literal null}. + * @return the computed {@link String prefix} of the {@literal cache key} stored in Redis; never {@literal null}. */ String compute(String cacheName); /** - * Creates a default {@link CacheKeyPrefix} scheme that prefixes cache keys with the {@link String name} - * of the cache followed by double colons. - * - * For example, a cache named {@literal myCache} will prefix all cache keys with {@literal myCache::}. + * Creates a default {@link CacheKeyPrefix} scheme that prefixes cache keys with the {@link String name} of the cache + * followed by double colons. For example, a cache named {@literal myCache} will prefix all cache keys with + * {@literal myCache::}. * * @return the default {@link CacheKeyPrefix} scheme. */ @@ -59,12 +56,9 @@ static CacheKeyPrefix simple() { } /** - * Creates a {@link CacheKeyPrefix} scheme that prefixes cache keys with the given {@link String prefix}. - * - * The {@link String prefix} is prepended to the {@link String cacheName} followed by double colons. - * - * For example, a prefix {@literal redis-} with a cache named {@literal myCache} - * results in {@literal redis-myCache::}. + * Creates a {@link CacheKeyPrefix} scheme that prefixes cache keys with the given {@link String prefix}. The + * {@link String prefix} is prepended to the {@link String cacheName} followed by double colons. For example, a prefix + * {@literal redis-} with a cache named {@literal myCache} results in {@literal redis-myCache::}. * * @param prefix must not be {@literal null}. * @return the default {@link CacheKeyPrefix} scheme. diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java index b74ebf2d75..b2c5669f83 100644 --- a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java +++ b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java @@ -35,9 +35,9 @@ * Immutable {@link RedisCacheConfiguration} used to customize {@link RedisCache} behavior, such as caching * {@literal null} values, computing cache key prefixes and handling binary serialization. *

- * Start with {@link RedisCacheConfiguration#defaultCacheConfig()} and customize {@link RedisCache} behavior - * using the builder methods, such as {@link #entryTtl(Duration)}, {@link #serializeKeysWith(SerializationPair)} - * and {@link #serializeValuesWith(SerializationPair)}. + * Start with {@link RedisCacheConfiguration#defaultCacheConfig()} and customize {@link RedisCache} behavior using the + * builder methods, such as {@link #entryTtl(Duration)}, {@link #serializeKeysWith(SerializationPair)} and + * {@link #serializeValuesWith(SerializationPair)}. * * @author Christoph Strobl * @author Mark Paluch @@ -110,14 +110,10 @@ public static RedisCacheConfiguration defaultCacheConfig(@Nullable ClassLoader c registerDefaultConverters(conversionService); - return new RedisCacheConfiguration(TtlFunction.persistent(), - DEFAULT_CACHE_NULL_VALUES, - DEFAULT_ENABLE_TIME_TO_IDLE_EXPIRATION, - DEFAULT_USE_PREFIX, - CacheKeyPrefix.simple(), + return new RedisCacheConfiguration(TtlFunction.persistent(), DEFAULT_CACHE_NULL_VALUES, + DEFAULT_ENABLE_TIME_TO_IDLE_EXPIRATION, DEFAULT_USE_PREFIX, CacheKeyPrefix.simple(), SerializationPair.fromSerializer(RedisSerializer.string()), - SerializationPair.fromSerializer(RedisSerializer.java(classLoader)), - conversionService); + SerializationPair.fromSerializer(RedisSerializer.java(classLoader)), conversionService); } private final boolean cacheNullValues; @@ -189,9 +185,8 @@ DEFAULT_USE_PREFIX, cacheKeyPrefix, getKeySerializationPair(), getValueSerializa * @return new {@link RedisCacheConfiguration}. */ public RedisCacheConfiguration disableCachingNullValues() { - return new RedisCacheConfiguration(getTtlFunction(), DO_NOT_CACHE_NULL_VALUES, isTimeToIdleEnabled(), - usePrefix(), getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), - getConversionService()); + return new RedisCacheConfiguration(getTtlFunction(), DO_NOT_CACHE_NULL_VALUES, isTimeToIdleEnabled(), usePrefix(), + getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), getConversionService()); } /** @@ -203,21 +198,22 @@ public RedisCacheConfiguration disableCachingNullValues() { */ public RedisCacheConfiguration disableKeyPrefix() { return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), isTimeToIdleEnabled(), - DO_NOT_USE_PREFIX, getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), getConversionService()); + DO_NOT_USE_PREFIX, getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), + getConversionService()); } /** - * Enables {@literal time-to-idle (TTI) expiration} on {@link Cache} read operations, - * such as {@link Cache#get(Object)}. + * Enables {@literal time-to-idle (TTI) expiration} on {@link Cache} read operations, such as + * {@link Cache#get(Object)}. *

* Enabling this option applies the same {@link #getTtlFunction() TTL expiration policy} to {@link Cache} read * operations as it does for {@link Cache} write operations. In effect, this will invoke the Redis {@literal GETEX} * command in place of {@literal GET}. *

- * Redis does not support the concept of {@literal TTI}, only {@literal TTL}. However, if {@literal TTL} expiration - * is applied to all {@link Cache} operations, both read and write alike, and {@link Cache} operations passed with - * expiration are used consistently across the application, then in effect, an application can achieve - * {@literal TTI} expiration-like behavior. + * Redis does not support the concept of {@literal TTI}, only {@literal TTL}. However, if {@literal TTL} expiration is + * applied to all {@link Cache} operations, both read and write alike, and {@link Cache} operations passed with + * expiration are used consistently across the application, then in effect, an application can achieve {@literal TTI} + * expiration-like behavior. *

* Requires Redis 6.2.0 or newer. * @@ -227,8 +223,7 @@ public RedisCacheConfiguration disableKeyPrefix() { */ public RedisCacheConfiguration enableTimeToIdle() { return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), USE_TIME_TO_IDLE_EXPIRATION, - usePrefix(), getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), - getConversionService()); + usePrefix(), getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), getConversionService()); } /** @@ -256,9 +251,8 @@ public RedisCacheConfiguration entryTtl(TtlFunction ttlFunction) { Assert.notNull(ttlFunction, "TtlFunction must not be null"); - return new RedisCacheConfiguration(ttlFunction, getAllowCacheNullValues(), isTimeToIdleEnabled(), - usePrefix(), getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), - getConversionService()); + return new RedisCacheConfiguration(ttlFunction, getAllowCacheNullValues(), isTimeToIdleEnabled(), usePrefix(), + getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), getConversionService()); } /** @@ -271,8 +265,8 @@ public RedisCacheConfiguration serializeKeysWith(SerializationPair keySe Assert.notNull(keySerializationPair, "KeySerializationPair must not be null"); - return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), isTimeToIdleEnabled(), - usePrefix(), getKeyPrefix(), keySerializationPair, getValueSerializationPair(), getConversionService()); + return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), isTimeToIdleEnabled(), usePrefix(), + getKeyPrefix(), keySerializationPair, getValueSerializationPair(), getConversionService()); } /** @@ -285,8 +279,8 @@ public RedisCacheConfiguration serializeValuesWith(SerializationPair valueSer Assert.notNull(valueSerializationPair, "ValueSerializationPair must not be null"); - return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), isTimeToIdleEnabled(), - usePrefix(), getKeyPrefix(), getKeySerializationPair(), valueSerializationPair, getConversionService()); + return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), isTimeToIdleEnabled(), usePrefix(), + getKeyPrefix(), getKeySerializationPair(), valueSerializationPair, getConversionService()); } /** @@ -299,8 +293,8 @@ public RedisCacheConfiguration withConversionService(ConversionService conversio Assert.notNull(conversionService, "ConversionService must not be null"); - return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), isTimeToIdleEnabled(), - usePrefix(), getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), conversionService); + return new RedisCacheConfiguration(getTtlFunction(), getAllowCacheNullValues(), isTimeToIdleEnabled(), usePrefix(), + getKeyPrefix(), getKeySerializationPair(), getValueSerializationPair(), conversionService); } /** @@ -316,7 +310,7 @@ public boolean getAllowCacheNullValues() { * Use {@link #enableTimeToIdle()} to opt-in and enable {@literal time-to-idle (TTI) expiration} for caching. * * @return {@literal true} if {@literal time-to-idle (TTI) expiration} was configured and enabled for caching. - * Defaults to {@literal false}. + * Defaults to {@literal false}. * @see GETEX * @since 3.2.0 */ @@ -400,8 +394,8 @@ public TtlFunction getTtlFunction() { } /** - * Adds a {@link Converter} to extract the {@link String} representation of a {@literal cache key} - * if no suitable {@link Object#toString()} method is present. + * Adds a {@link Converter} to extract the {@link String} representation of a {@literal cache key} if no suitable + * {@link Object#toString()} method is present. * * @param cacheKeyConverter {@link Converter} used to convert a {@literal cache key} into a {@link String}. * @throws IllegalStateException if {@link #getConversionService()} does not allow {@link Converter} registration. @@ -415,8 +409,8 @@ public void addCacheKeyConverter(Converter cacheKeyConverter) { /** * Configure the underlying {@link ConversionService} used to extract the {@literal cache key}. * - * @param registryConsumer {@link Consumer} used to register a {@link Converter} - * with the configured {@link ConverterRegistry}; never {@literal null}. + * @param registryConsumer {@link Consumer} used to register a {@link Converter} with the configured + * {@link ConverterRegistry}; never {@literal null}. * @throws IllegalStateException if {@link #getConversionService()} does not allow {@link Converter} registration. * @see org.springframework.core.convert.converter.ConverterRegistry * @since 2.2 diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java b/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java index 3c9e3c5415..83dc0e9ec1 100644 --- a/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java +++ b/src/main/java/org/springframework/data/redis/cache/RedisCacheManager.java @@ -33,8 +33,8 @@ /** * {@link CacheManager} implementation for Redis backed by {@link RedisCache}. *

- * This {@link CacheManager} creates {@link Cache caches} on first write, by default. Empty {@link Cache caches} - * are not visible in Redis due to how Redis represents empty data structures. + * This {@link CacheManager} creates {@link Cache caches} on first write, by default. Empty {@link Cache caches} are not + * visible in Redis due to how Redis represents empty data structures. *

* {@link Cache Caches} requiring a different {@link RedisCacheConfiguration cache configuration} than the * {@link RedisCacheConfiguration#defaultCacheConfig() default cache configuration} can be specified via @@ -70,12 +70,12 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager *

* Allows {@link RedisCache cache} creation at runtime. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. - * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} - * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate + * Redis commands; must not be {@literal null}. + * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by + * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. * @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration} - * are {@literal null}. + * are {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheConfiguration * @see org.springframework.data.redis.cache.RedisCacheWriter */ @@ -84,17 +84,17 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d } /** - * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} - * and default {@link RedisCacheConfiguration} along with whether to allow cache creation at runtime. + * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and default + * {@link RedisCacheConfiguration} along with whether to allow cache creation at runtime. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. - * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} - * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate + * Redis commands; must not be {@literal null}. + * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by + * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. * @param allowRuntimeCacheCreation boolean specifying whether to allow creation of undeclared caches at runtime; - * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}. + * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}. * @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration} - * are {@literal null}. + * are {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheConfiguration * @see org.springframework.data.redis.cache.RedisCacheWriter * @since 2.0.4 @@ -113,19 +113,19 @@ private RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration /** * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and a default - * {@link RedisCacheConfiguration} along with an optional, initial set of {@link String cache names} - * used to create {@link RedisCache Redis caches} on startup. + * {@link RedisCacheConfiguration} along with an optional, initial set of {@link String cache names} used to create + * {@link RedisCache Redis caches} on startup. *

* Allows {@link RedisCache cache} creation at runtime. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. - * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} - * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate + * Redis commands; must not be {@literal null}. + * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by + * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. * @param initialCacheNames optional set of {@link String cache names} used to create {@link RedisCache Redis caches} - * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache. + * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache. * @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration} - * are {@literal null}. + * are {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheConfiguration * @see org.springframework.data.redis.cache.RedisCacheWriter */ @@ -139,19 +139,19 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d * Creates a new {@link RedisCacheManager} initialized with the given {@link RedisCacheWriter} and default * {@link RedisCacheConfiguration} along with whether to allow cache creation at runtime. *

- * Additionally, the optional, initial set of {@link String cache names} will be used to - * create {@link RedisCache Redis caches} on startup. + * Additionally, the optional, initial set of {@link String cache names} will be used to create {@link RedisCache + * Redis caches} on startup. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. - * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} - * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate + * Redis commands; must not be {@literal null}. + * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by + * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. * @param allowRuntimeCacheCreation boolean specifying whether to allow creation of undeclared caches at runtime; - * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}. + * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}. * @param initialCacheNames optional set of {@link String cache names} used to create {@link RedisCache Redis caches} - * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache. + * on startup. The default {@link RedisCacheConfiguration} will be applied to each cache. * @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration} - * are {@literal null}. + * are {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheConfiguration * @see org.springframework.data.redis.cache.RedisCacheWriter * @since 2.0.4 @@ -175,15 +175,15 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d *

* Allows {@link RedisCache cache} creation at runtime. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. - * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} - * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate + * Redis commands; must not be {@literal null}. + * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by + * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. * @param initialCacheConfigurations {@link Map} of declared, known {@link String cache names} along with associated - * {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Reds caches} on startup; - * must not be {@literal null}. + * {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Reds caches} on startup; + * must not be {@literal null}. * @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration} - * are {@literal null}. + * are {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheConfiguration * @see org.springframework.data.redis.cache.RedisCacheWriter */ @@ -200,17 +200,17 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d * Additionally, an initial {@link RedisCache} will be created and configured using the associated * {@link RedisCacheConfiguration} for each {@link String named} {@link RedisCache} in the given {@link Map}. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. - * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} - * by default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate + * Redis commands; must not be {@literal null}. + * @param defaultCacheConfiguration {@link RedisCacheConfiguration} applied to new {@link RedisCache Redis caches} by + * default when no cache-specific {@link RedisCacheConfiguration} is provided; must not be {@literal null}. * @param allowRuntimeCacheCreation boolean specifying whether to allow creation of undeclared caches at runtime; - * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}. + * {@literal true} by default. Maybe just use {@link RedisCacheConfiguration#defaultCacheConfig()}. * @param initialCacheConfigurations {@link Map} of declared, known {@link String cache names} along with the - * associated {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Redis caches} - * on startup; must not be {@literal null}. + * associated {@link RedisCacheConfiguration} used to create and configure {@link RedisCache Redis caches} on + * startup; must not be {@literal null}. * @throws IllegalArgumentException if either the given {@link RedisCacheWriter} or {@link RedisCacheConfiguration} - * are {@literal null}. + * are {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheConfiguration * @see org.springframework.data.redis.cache.RedisCacheWriter * @since 2.0.4 @@ -226,7 +226,9 @@ public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration d } /** - * @deprecated since 3.2. Use {@link RedisCacheManager#RedisCacheManager(RedisCacheWriter, RedisCacheConfiguration, boolean, Map)} instead. + * @deprecated since 3.2. Use + * {@link RedisCacheManager#RedisCacheManager(RedisCacheWriter, RedisCacheConfiguration, boolean, Map)} + * instead. */ @Deprecated(since = "3.2") public RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration, @@ -249,8 +251,8 @@ public static RedisCacheManagerBuilder builder() { * Factory method returning a {@literal Builder} used to construct and configure a {@link RedisCacheManager} * initialized with the given {@link RedisCacheWriter}. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing appropriate + * Redis commands; must not be {@literal null}. * @return new {@link RedisCacheManagerBuilder}. * @throws IllegalArgumentException if the given {@link RedisCacheWriter} is {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheWriter @@ -266,8 +268,8 @@ public static RedisCacheManagerBuilder builder(RedisCacheWriter cacheWriter) { * Factory method returning a {@literal Builder} used to construct and configure a {@link RedisCacheManager} * initialized with the given {@link RedisConnectionFactory}. * - * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} - * to acquire connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}. + * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} to acquire + * connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}. * @return new {@link RedisCacheManagerBuilder}. * @throws IllegalArgumentException if the given {@link RedisConnectionFactory} is {@literal null}. * @see org.springframework.data.redis.connection.RedisConnectionFactory @@ -297,8 +299,8 @@ public static RedisCacheManagerBuilder builder(RedisConnectionFactory connection *

enabled
* * - * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} - * to acquire connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}. + * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} to acquire + * connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}. * @return new {@link RedisCacheManager}. * @throws IllegalArgumentException if the given {@link RedisConnectionFactory} is {@literal null}. * @see org.springframework.data.redis.connection.RedisConnectionFactory @@ -326,8 +328,8 @@ public boolean isAllowRuntimeCacheCreation() { * Return an {@link Collections#unmodifiableMap(Map) unmodifiable Map} containing {@link String caches name} mapped to * the {@link RedisCache} {@link RedisCacheConfiguration configuration}. * - * @return unmodifiable {@link Map} containing {@link String cache name} - * / {@link RedisCacheConfiguration configuration} pairs. + * @return unmodifiable {@link Map} containing {@link String cache name} / {@link RedisCacheConfiguration + * configuration} pairs. */ public Map getCacheConfigurations() { @@ -353,8 +355,8 @@ protected RedisCacheConfiguration getDefaultCacheConfiguration() { } /** - * Gets a {@link Map} of {@link String cache names} to {@link RedisCacheConfiguration} objects as the initial set - * of {@link RedisCache Redis caches} to create on startup. + * Gets a {@link Map} of {@link String cache names} to {@link RedisCacheConfiguration} objects as the initial set of + * {@link RedisCache Redis caches} to create on startup. * * @return a {@link Map} of {@link String cache names} to {@link RedisCacheConfiguration} objects. */ @@ -363,8 +365,8 @@ protected Map getInitialCacheConfiguration() { } /** - * Returns a reference to the configured {@link RedisCacheWriter} used to perform {@link RedisCache} operations, - * such as reading from and writing to the cache. + * Returns a reference to the configured {@link RedisCacheWriter} used to perform {@link RedisCache} operations, such + * as reading from and writing to the cache. * * @return a reference to the configured {@link RedisCacheWriter}. * @see org.springframework.data.redis.cache.RedisCacheWriter @@ -382,8 +384,8 @@ protected RedisCache getMissingCache(String name) { * Creates a new {@link RedisCache} with given {@link String name} and {@link RedisCacheConfiguration}. * * @param name {@link String name} for the {@link RedisCache}; must not be {@literal null}. - * @param cacheConfiguration {@link RedisCacheConfiguration} used to configure the {@link RedisCache}; - * resolves to the {@link #getDefaultCacheConfiguration()} if {@literal null}. + * @param cacheConfiguration {@link RedisCacheConfiguration} used to configure the {@link RedisCache}; resolves to the + * {@link #getDefaultCacheConfiguration()} if {@literal null}. * @return a new {@link RedisCache} instance; never {@literal null}. */ protected RedisCache createRedisCache(String name, @Nullable RedisCacheConfiguration cacheConfiguration) { @@ -416,8 +418,8 @@ public static class RedisCacheManagerBuilder { * Factory method returning a new {@literal Builder} used to create and configure a {@link RedisCacheManager} using * the given {@link RedisCacheWriter}. * - * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations - * by executing appropriate Redis commands; must not be {@literal null}. + * @param cacheWriter {@link RedisCacheWriter} used to perform {@link RedisCache} operations by executing + * appropriate Redis commands; must not be {@literal null}. * @return new {@link RedisCacheManagerBuilder}. * @throws IllegalArgumentException if the given {@link RedisCacheWriter} is {@literal null}. * @see org.springframework.data.redis.cache.RedisCacheWriter @@ -433,8 +435,8 @@ public static RedisCacheManagerBuilder fromCacheWriter(RedisCacheWriter cacheWri * Factory method returning a new {@literal Builder} used to create and configure a {@link RedisCacheManager} using * the given {@link RedisConnectionFactory}. * - * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} - * to acquire connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}. + * @param connectionFactory {@link RedisConnectionFactory} used by the {@link RedisCacheManager} to acquire + * connections to Redis when performing {@link RedisCache} operations; must not be {@literal null}. * @return new {@link RedisCacheManagerBuilder}. * @throws IllegalArgumentException if the given {@link RedisConnectionFactory} is {@literal null}. * @see org.springframework.data.redis.connection.RedisConnectionFactory @@ -468,8 +470,8 @@ private RedisCacheManagerBuilder(RedisCacheWriter cacheWriter) { /** * Configure whether to allow cache creation at runtime. * - * @param allowRuntimeCacheCreation boolean to allow creation of undeclared caches at runtime; - * {@literal true} by default. + * @param allowRuntimeCacheCreation boolean to allow creation of undeclared caches at runtime; {@literal true} by + * default. * @return this {@link RedisCacheManagerBuilder}. */ public RedisCacheManagerBuilder allowCreateOnMissingCache(boolean allowRuntimeCacheCreation) { @@ -480,9 +482,9 @@ public RedisCacheManagerBuilder allowCreateOnMissingCache(boolean allowRuntimeCa /** * Disable {@link RedisCache} creation at runtime for non-configured, undeclared caches. *

- * {@link RedisCacheManager#getMissingCache(String)} returns {@literal null} for any non-configured, - * undeclared {@link Cache} instead of a new {@link RedisCache} instance. - * This allows the {@link org.springframework.cache.support.CompositeCacheManager} to participate. + * {@link RedisCacheManager#getMissingCache(String)} returns {@literal null} for any non-configured, undeclared + * {@link Cache} instead of a new {@link RedisCache} instance. This allows the + * {@link org.springframework.cache.support.CompositeCacheManager} to participate. * * @return this {@link RedisCacheManagerBuilder}. * @see #allowCreateOnMissingCache(boolean) @@ -583,8 +585,8 @@ public RedisCacheManagerBuilder transactionAware() { } /** - * Registers the given {@link String cache name} and {@link RedisCacheConfiguration} used to create - * and configure a {@link RedisCache} on startup. + * Registers the given {@link String cache name} and {@link RedisCacheConfiguration} used to create and configure a + * {@link RedisCache} on startup. * * @param cacheName {@link String name} of the cache to register for creation on startup. * @param cacheConfiguration {@link RedisCacheConfiguration} used to configure the new cache on startup. @@ -634,8 +636,8 @@ public Optional getCacheConfigurationFor(String cacheNa /** * Get the {@link Set} of cache names for which the builder holds {@link RedisCacheConfiguration configuration}. * - * @return an unmodifiable {@link Set} holding the name of caches - * for which a {@link RedisCacheConfiguration configuration} has been set. + * @return an unmodifiable {@link Set} holding the name of caches for which a {@link RedisCacheConfiguration + * configuration} has been set. * @since 2.2 */ public Set getConfiguredCaches() { diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java index b0d9c1a720..2bd3e93f35 100644 --- a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java +++ b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutor.java @@ -254,8 +254,7 @@ MultiNodeResult collectResults(Map>> } catch (ExecutionException ex) { entryIterator.remove(); exceptionCollector.addException(nodeExecution, ex.getCause()); - } catch (TimeoutException ignore) { - } catch (InterruptedException ex) { + } catch (TimeoutException ignore) {} catch (InterruptedException ex) { Thread.currentThread().interrupt(); exceptionCollector.addException(nodeExecution, ex); break OUT; diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterSlotHashUtil.java b/src/main/java/org/springframework/data/redis/connection/ClusterSlotHashUtil.java index 58b49520bf..aedf32e72c 100644 --- a/src/main/java/org/springframework/data/redis/connection/ClusterSlotHashUtil.java +++ b/src/main/java/org/springframework/data/redis/connection/ClusterSlotHashUtil.java @@ -101,8 +101,8 @@ public static boolean isSameSlotForAllKeys(ByteBuffer... keys) { /** * Determines whether all keys will hash to the same slot. * - * @param keys {@link Collection} of {@link ByteBuffer} objects containing the keys to evaluate; - * must not be {@literal null}. + * @param keys {@link Collection} of {@link ByteBuffer} objects containing the keys to evaluate; must not be + * {@literal null}. * @return a boolean value indicating whether all keys will hash to the same slot. * @throws IllegalArgumentException if the {@link Collection} of keys is {@literal null}. * @since 2.0 @@ -115,10 +115,8 @@ public static boolean isSameSlotForAllKeys(Collection keys) { return true; } - return isSameSlotForAllKeys(keys.stream() - .map(ByteBuffer::duplicate) - .map(ByteUtils::getBytes) - .toArray(byte[][]::new)); + return isSameSlotForAllKeys( + keys.stream().map(ByteBuffer::duplicate).map(ByteUtils::getBytes).toArray(byte[][]::new)); } /** diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java index c2ea198d8b..be2c8640bc 100644 --- a/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java @@ -1404,8 +1404,7 @@ private org.springframework.data.domain.Range.Bound rawBound( @SuppressWarnings("unchecked") private GeoReference serialize(GeoReference data) { return data instanceof GeoReference.GeoMemberReference - ? GeoReference - .fromMember(serializer.serialize(((GeoMemberReference) data).getMember())) + ? GeoReference.fromMember(serializer.serialize(((GeoMemberReference) data).getMember())) : (GeoReference) data; } @@ -2581,8 +2580,7 @@ public Long hStrLen(byte[] key, byte[] field) { } public @Nullable List applyHashFieldExpiration(byte[] key, - org.springframework.data.redis.core.types.Expiration expiration, - ExpirationOptions options, byte[]... fields) { + org.springframework.data.redis.core.types.Expiration expiration, ExpirationOptions options, byte[]... fields) { return this.delegate.applyHashFieldExpiration(key, expiration, options, fields); } @@ -2628,8 +2626,7 @@ public List hTtl(byte[] key, TimeUnit timeUnit, byte[]... fields) { } public @Nullable List applyExpiration(String key, - org.springframework.data.redis.core.types.Expiration expiration, - ExpirationOptions options, String... fields) { + org.springframework.data.redis.core.types.Expiration expiration, ExpirationOptions options, String... fields) { return this.applyHashFieldExpiration(serialize(key), expiration, options, serializeMulti(fields)); } @@ -2818,16 +2815,14 @@ public Set zRevRangeByLex(String key, org.springframework.data.domain.Ra } @Override - public Long zRangeStoreByLex(byte[] dstKey, byte[] srcKey, - org.springframework.data.domain.Range range, - org.springframework.data.redis.connection.Limit limit) { - return convertAndReturn(delegate.zRangeStoreByLex(dstKey, srcKey, range, limit), - Converters.identityConverter()); + public Long zRangeStoreByLex(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range range, + org.springframework.data.redis.connection.Limit limit) { + return convertAndReturn(delegate.zRangeStoreByLex(dstKey, srcKey, range, limit), Converters.identityConverter()); } @Override - public Long zRangeStoreByLex(String dstKey, String srcKey, - org.springframework.data.domain.Range range, org.springframework.data.redis.connection.Limit limit) { + public Long zRangeStoreByLex(String dstKey, String srcKey, org.springframework.data.domain.Range range, + org.springframework.data.redis.connection.Limit limit) { return convertAndReturn(delegate.zRangeStoreByLex(serialize(dstKey), serialize(srcKey), serialize(range), limit), Converters.identityConverter()); } @@ -2848,9 +2843,8 @@ public Long zRangeStoreRevByLex(String dstKey, String srcKey, org.springframewor @Override public Long zRangeStoreByScore(byte[] dstKey, byte[] srcKey, org.springframework.data.domain.Range range, - org.springframework.data.redis.connection.Limit limit) { - return convertAndReturn(delegate.zRangeStoreByScore(dstKey, srcKey, range, limit), - Converters.identityConverter()); + org.springframework.data.redis.connection.Limit limit) { + return convertAndReturn(delegate.zRangeStoreByScore(dstKey, srcKey, range, limit), Converters.identityConverter()); } @Override diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java index f3be7ab276..1c240dfbf1 100644 --- a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java @@ -1544,8 +1544,7 @@ default List hExpireAt(byte[] key, long unixTime, byte[]... fields) { /** @deprecated in favor of {@link RedisConnection#hashCommands()}}. */ @Override @Deprecated - default List hExpireAt(byte[] key, long unixTime, ExpirationOptions.Condition condition, - byte[]... fields) { + default List hExpireAt(byte[] key, long unixTime, ExpirationOptions.Condition condition, byte[]... fields) { return hashCommands().hExpireAt(key, unixTime, condition, fields); } @@ -1596,8 +1595,7 @@ default List hpTtl(byte[] key, byte[]... fields) { @Override @Deprecated default @Nullable List applyHashFieldExpiration(byte[] key, - org.springframework.data.redis.core.types.Expiration expiration, ExpirationOptions options, - byte[]... fields) { + org.springframework.data.redis.core.types.Expiration expiration, ExpirationOptions options, byte[]... fields) { return hashCommands().applyHashFieldExpiration(key, expiration, options, fields); } diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterKeyCommands.java index d650b738eb..23dd8e65e3 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterKeyCommands.java @@ -15,11 +15,11 @@ */ package org.springframework.data.redis.connection; +import reactor.core.publisher.Mono; + import java.nio.ByteBuffer; import java.util.List; -import reactor.core.publisher.Mono; - /** * @author Christoph Strobl * @since 2.0 diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStreamCommands.java index d2dacc7fad..42b29a7b91 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStreamCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterStreamCommands.java @@ -19,5 +19,4 @@ * @author Mark Paluch * @since 2.2 */ -public interface ReactiveClusterStreamCommands extends ReactiveStreamCommands { -} +public interface ReactiveClusterStreamCommands extends ReactiveStreamCommands {} diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveGeoCommands.java index 80c9fde257..c6172a677b 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveGeoCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveGeoCommands.java @@ -826,7 +826,7 @@ public Optional getLimit() { } /** - * @return can be {@literal null}. + * @return can be {@literal null}. */ @Nullable public Point getPoint() { @@ -1159,7 +1159,7 @@ public Optional getLimit() { } /** - * @return can be {@literal null}. + * @return can be {@literal null}. */ @Nullable public ByteBuffer getMember() { @@ -1229,7 +1229,7 @@ default Flux>> geoRadiusByMember(ByteBuffer ke return geoRadiusByMember( Mono.just(GeoRadiusByMemberCommand.within(distance).from(member).forKey(key).withArgs(geoRadiusArgs))) - .flatMap(CommandResponse::getOutput); + .flatMap(CommandResponse::getOutput); } /** @@ -1484,7 +1484,7 @@ default Mono geoSearchStore(ByteBuffer destKey, ByteBuffer key, GeoReferen GeoShape shape, GeoSearchStoreCommandArgs args) { return geoSearchStore( Mono.just(GeoSearchStoreCommand.within(shape).in(key).storeAt(destKey).at(reference).with(args))).next() - .map(CommandResponse::getOutput); + .map(CommandResponse::getOutput); } /** diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java index 2860dc691c..e091b6f7df 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveStreamCommands.java @@ -27,12 +27,13 @@ import java.util.Map; import org.reactivestreams.Publisher; + import org.springframework.data.domain.Range; import org.springframework.data.redis.connection.ReactiveRedisConnection.CommandResponse; import org.springframework.data.redis.connection.ReactiveRedisConnection.KeyCommand; import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse; -import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions; import org.springframework.data.redis.connection.RedisStreamCommands.XAddOptions; +import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions; import org.springframework.data.redis.connection.RedisStreamCommands.XPendingOptions; import org.springframework.data.redis.connection.stream.ByteBufferRecord; import org.springframework.data.redis.connection.stream.Consumer; @@ -411,8 +412,7 @@ default Mono xAdd(ByteBufferRecord record, XAddOptions xAddOptions) { Assert.notNull(xAddOptions, "XAddOptions must not be null"); AddStreamRecord addStreamRecord = AddStreamRecord.of(record) - .approximateTrimming(xAddOptions.isApproximateTrimming()) - .makeNoStream(xAddOptions.isNoMkStream()); + .approximateTrimming(xAddOptions.isApproximateTrimming()).makeNoStream(xAddOptions.isNoMkStream()); if (xAddOptions.hasMaxlen()) { addStreamRecord = addStreamRecord.maxlen(xAddOptions.getMaxlen()); diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java b/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java index 153d139e8f..c5e74e60de 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveSubscription.java @@ -15,13 +15,13 @@ */ package org.springframework.data.redis.connection; -import org.springframework.lang.Nullable; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.nio.ByteBuffer; import java.util.Set; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveZSetCommands.java index c4037e2c55..f9761d1896 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveZSetCommands.java @@ -1439,7 +1439,7 @@ default Flux zRevRangeByScoreWithScores(ByteBuffer key, Range ran return zRangeByScore( Mono.just(ZRangeByScoreCommand.reverseScoresWithin(range).withScores().from(key).limitTo(limit))) - .flatMap(CommandResponse::getOutput); + .flatMap(CommandResponse::getOutput); } /** @@ -2824,7 +2824,7 @@ default Flux zInterWithScores(List sets, List weights return zInterWithScores( Mono.just(ZAggregateCommand.sets(sets).aggregateUsing(aggregateFunction).applyWeights(weights))) - .flatMap(CommandResponse::getOutput); + .flatMap(CommandResponse::getOutput); } /** @@ -2843,7 +2843,7 @@ default Flux zInterWithScores(List sets, Weights weights, @Nu return zInterWithScores( Mono.just(ZAggregateCommand.sets(sets).aggregateUsing(aggregateFunction).applyWeights(weights))) - .flatMap(CommandResponse::getOutput); + .flatMap(CommandResponse::getOutput); } /** @@ -2993,7 +2993,7 @@ default Mono zInterStore(ByteBuffer destinationKey, List sets, return zInterStore(Mono.just( ZInterStoreCommand.sets(sets).aggregateUsing(aggregateFunction).applyWeights(weights).storeAs(destinationKey))) - .next().map(NumericResponse::getOutput); + .next().map(NumericResponse::getOutput); } /** @@ -3016,7 +3016,7 @@ default Mono zInterStore(ByteBuffer destinationKey, List sets, return zInterStore(Mono.just( ZInterStoreCommand.sets(sets).aggregateUsing(aggregateFunction).applyWeights(weights).storeAs(destinationKey))) - .next().map(NumericResponse::getOutput); + .next().map(NumericResponse::getOutput); } /** @@ -3099,7 +3099,7 @@ default Flux zUnionWithScores(List sets, List weights return zUnionWithScores( Mono.just(ZAggregateCommand.sets(sets).aggregateUsing(aggregateFunction).applyWeights(weights))) - .flatMap(CommandResponse::getOutput); + .flatMap(CommandResponse::getOutput); } /** @@ -3118,7 +3118,7 @@ default Flux zUnionWithScores(List sets, Weights weights, @Nu return zUnionWithScores( Mono.just(ZAggregateCommand.sets(sets).aggregateUsing(aggregateFunction).applyWeights(weights))) - .flatMap(CommandResponse::getOutput); + .flatMap(CommandResponse::getOutput); } /** @@ -3300,7 +3300,7 @@ default Mono zUnionStore(ByteBuffer destinationKey, List sets, return zUnionStore(Mono.just( ZUnionStoreCommand.sets(sets).aggregateUsing(aggregateFunction).applyWeights(weights).storeAs(destinationKey))) - .next().map(NumericResponse::getOutput); + .next().map(NumericResponse::getOutput); } /** diff --git a/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java index 7a6443d484..506d0c3cae 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterNode.java @@ -216,8 +216,8 @@ public SlotRange(BitSet range) { } /** - * Determines whether this {@link SlotRange} contains the given {@link Integer slot}, which implies - * this cluster nodes manages the slot holding data stored in Redis. + * Determines whether this {@link SlotRange} contains the given {@link Integer slot}, which implies this cluster + * nodes manages the slot holding data stored in Redis. * * @param slot {@link Integer slot} to evaluate. * @return true when slot is part of the range. @@ -286,14 +286,8 @@ public enum LinkState { */ public enum Flag { - MYSELF("myself"), - MASTER("master"), - REPLICA("slave"), - FAIL("fail"), - PFAIL("fail?"), - HANDSHAKE("handshake"), - NOADDR("noaddr"), - NOFLAGS("noflags"); + MYSELF("myself"), MASTER("master"), REPLICA("slave"), FAIL("fail"), PFAIL("fail?"), HANDSHAKE("handshake"), NOADDR( + "noaddr"), NOFLAGS("noflags"); private String raw; diff --git a/src/main/java/org/springframework/data/redis/connection/RedisCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisCommands.java index 1ebb48b83f..b6c0515304 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisCommands.java @@ -31,8 +31,8 @@ public interface RedisCommands extends RedisKeyCommands, RedisStringCommands, Re /** * {@literal Native} or {@literal raw} execution of the given Redis command along with the given arguments. *

- * The command is executed as is, with as little interpretation as possible - it is up to the caller to take care - * of any processing of arguments or the result. + * The command is executed as is, with as little interpretation as possible - it is up to the caller to take care of + * any processing of arguments or the result. * * @param command Redis {@link String command} to execute; must not be {@literal null}. * @param args optional array of command arguments; may be empty; diff --git a/src/main/java/org/springframework/data/redis/connection/RedisHashCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisHashCommands.java index cd99e4a516..c151c502b3 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisHashCommands.java @@ -500,8 +500,7 @@ default List hpExpireAt(byte[] key, long unixTimeInMillis, byte[]... field * @since 3.5 */ @Nullable - List hpExpireAt(byte[] key, long unixTimeInMillis, ExpirationOptions.Condition condition, - byte[]... fields); + List hpExpireAt(byte[] key, long unixTimeInMillis, ExpirationOptions.Condition condition, byte[]... fields); /** * Remove the expiration from given {@code field}. diff --git a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java index 070fb6158c..fc5280c28d 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisPassword.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisPassword.java @@ -55,11 +55,11 @@ private RedisPassword(char[] thePassword) { */ public static RedisPassword of(@Nullable String passwordAsString) { - if (!StringUtils.hasText(passwordAsString)) { - return none(); - } + if (!StringUtils.hasText(passwordAsString)) { + return none(); + } - return new RedisPassword(passwordAsString.toCharArray()); + return new RedisPassword(passwordAsString.toCharArray()); } /** @@ -70,11 +70,11 @@ public static RedisPassword of(@Nullable String passwordAsString) { */ public static RedisPassword of(@Nullable char[] passwordAsChars) { - if (ObjectUtils.isEmpty(passwordAsChars)) { - return none(); - } + if (ObjectUtils.isEmpty(passwordAsChars)) { + return none(); + } - return new RedisPassword(Arrays.copyOf(passwordAsChars, passwordAsChars.length)); + return new RedisPassword(Arrays.copyOf(passwordAsChars, passwordAsChars.length)); } /** diff --git a/src/main/java/org/springframework/data/redis/connection/RedisSetCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisSetCommands.java index 26dcb1976f..255b8f5f0b 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisSetCommands.java @@ -183,7 +183,6 @@ public interface RedisSetCommands { @Nullable Long sUnionStore(byte[] destKey, byte[]... keys); - /** * Get all elements of set at {@code key}. * diff --git a/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java b/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java index 8acb2a3be8..c52b9f0a9f 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisStandaloneConfiguration.java @@ -23,8 +23,8 @@ import org.springframework.util.ObjectUtils; /** - * Configuration class used to set up a {@link RedisConnection} with {@link RedisConnectionFactory} for connecting - * to a single node Redis instance. + * Configuration class used to set up a {@link RedisConnection} with {@link RedisConnectionFactory} for connecting to a + * single node Redis instance. * * @author Mark Paluch * @author Christoph Strobl diff --git a/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java index dd483bdf89..52878517bc 100644 --- a/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/StringRedisConnection.java @@ -2534,8 +2534,7 @@ default List hpExpireAt(String key, long unixTimeInMillis, String... field * @since 3.5 */ @Nullable - List hpExpireAt(String key, long unixTimeInMillis, ExpirationOptions.Condition condition, - String... fields); + List hpExpireAt(String key, long unixTimeInMillis, ExpirationOptions.Condition condition, String... fields); /** * Remove the expiration from given {@code field}. diff --git a/src/main/java/org/springframework/data/redis/connection/convert/Converters.java b/src/main/java/org/springframework/data/redis/connection/convert/Converters.java index 2d4eb2cb59..8a935f69f0 100644 --- a/src/main/java/org/springframework/data/redis/connection/convert/Converters.java +++ b/src/main/java/org/springframework/data/redis/connection/convert/Converters.java @@ -544,14 +544,11 @@ enum ClusterNodesConverter implements Converter { *

    *
  • {@code %s:%i} (Redis 3)
  • *
  • {@code %s:%i@%i} (Redis 4, with bus port)
  • - *
  • {@code %s:%i@%i,%s} (Redis 7, with announced hostname)
  • - * - * The output of the {@code CLUSTER NODES } command is just a space-separated CSV string, where each - * line represents a node in the cluster. The following is an example of output on Redis 7.2.0. - * You can check the latest here. - * + *
  • {@code %s:%i@%i,%s} (Redis 7, with announced hostname)
  • The output of the {@code CLUSTER NODES } command + * is just a space-separated CSV string, where each line represents a node in the cluster. The following is an + * example of output on Redis 7.2.0. You can check the latest + * here. * {@code ... } - * *
*/ private static final Map flagLookupMap; diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/DefaultJedisClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/jedis/DefaultJedisClientConfiguration.java index fee76a291f..3af45729db 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/DefaultJedisClientConfiguration.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/DefaultJedisClientConfiguration.java @@ -46,10 +46,9 @@ class DefaultJedisClientConfiguration implements JedisClientConfiguration { private final Duration connectTimeout; DefaultJedisClientConfiguration(@Nullable JedisClientConfigBuilderCustomizer customizer, boolean useSsl, - @Nullable SSLSocketFactory sslSocketFactory, - @Nullable SSLParameters sslParameters, @Nullable HostnameVerifier hostnameVerifier, boolean usePooling, - @Nullable GenericObjectPoolConfig poolConfig, @Nullable String clientName, Duration readTimeout, - Duration connectTimeout) { + @Nullable SSLSocketFactory sslSocketFactory, @Nullable SSLParameters sslParameters, + @Nullable HostnameVerifier hostnameVerifier, boolean usePooling, @Nullable GenericObjectPoolConfig poolConfig, + @Nullable String clientName, Duration readTimeout, Duration connectTimeout) { this.customizer = Optional.ofNullable(customizer); this.useSsl = useSsl; diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java index 51f6f3cd14..f03899c271 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterConnection.java @@ -171,8 +171,8 @@ public Object execute(String command, byte[]... args) { Assert.notNull(command, "Command must not be null"); Assert.notNull(args, "Args must not be null"); - JedisClusterCommandCallback commandCallback = jedis -> - jedis.sendCommand(JedisClientUtils.getCommand(command), args); + JedisClusterCommandCallback commandCallback = jedis -> jedis + .sendCommand(JedisClientUtils.getCommand(command), args); return this.clusterCommandExecutor.executeCommandOnArbitraryNode(commandCallback).getValue(); } @@ -190,8 +190,8 @@ public T execute(String command, byte[] key, Collection args) { RedisClusterNode keyMaster = this.topologyProvider.getTopology().getKeyServingMasterNode(key); - JedisClusterCommandCallback commandCallback = jedis -> - (T) jedis.sendCommand(JedisClientUtils.getCommand(command), commandArgs); + JedisClusterCommandCallback commandCallback = jedis -> (T) jedis + .sendCommand(JedisClientUtils.getCommand(command), commandArgs); return this.clusterCommandExecutor.executeCommandOnSingleNode(commandCallback, keyMaster).getValue(); } @@ -240,8 +240,8 @@ public List execute(String command, Collection keys, Collection commandCallback = (jedis, key) -> - (T) jedis.sendCommand(JedisClientUtils.getCommand(command), getCommandArguments(key, args)); + JedisMultiKeyClusterCommandCallback commandCallback = (jedis, + key) -> (T) jedis.sendCommand(JedisClientUtils.getCommand(command), getCommandArguments(key, args)); return this.clusterCommandExecutor.executeMultiKeyCommand(commandCallback, keys).resultsAsList(); @@ -418,7 +418,8 @@ public byte[] echo(byte[] message) { throw new InvalidDataAccessApiUsageException("Echo not supported in cluster mode"); } - @Override @Nullable + @Override + @Nullable public String ping() { JedisClusterCommandCallback command = Jedis::ping; @@ -462,8 +463,8 @@ public List clusterGetKeysInSlot(int slot, Integer count) { RedisClusterNode node = clusterGetNodeForSlot(slot); - JedisClusterCommandCallback> command = jedis -> - JedisConverters.stringListToByteList().convert(jedis.clusterGetKeysInSlot(slot, nullSafeIntValue(count))); + JedisClusterCommandCallback> command = jedis -> JedisConverters.stringListToByteList() + .convert(jedis.clusterGetKeysInSlot(slot, nullSafeIntValue(count))); NodeResult> result = this.clusterCommandExecutor.executeCommandOnSingleNode(command, node); @@ -555,8 +556,8 @@ public void clusterReplicate(RedisClusterNode master, RedisClusterNode replica) @Override public Integer clusterGetSlotForKey(byte[] key) { - JedisClusterCommandCallback command = jedis -> - Long.valueOf(jedis.clusterKeySlot(JedisConverters.toString(key))).intValue(); + JedisClusterCommandCallback command = jedis -> Long + .valueOf(jedis.clusterKeySlot(JedisConverters.toString(key))).intValue(); return this.clusterCommandExecutor.executeCommandOnArbitraryNode(command).getValue(); } @@ -566,7 +567,8 @@ public RedisClusterNode clusterGetNodeForKey(byte[] key) { return this.topologyProvider.getTopology().getKeyServingMasterNode(key); } - @Override @Nullable + @Override + @Nullable public RedisClusterNode clusterGetNodeForSlot(int slot) { for (RedisClusterNode node : topologyProvider.getTopology().getSlotServingNodes(slot)) { @@ -600,14 +602,13 @@ public Set clusterGetReplicas(RedisClusterNode master) { @Override public Map> clusterGetMasterReplicaMap() { - JedisClusterCommandCallback> command = jedis -> - JedisConverters.toSetOfRedisClusterNodes(jedis.clusterSlaves(jedis.clusterMyId())); + JedisClusterCommandCallback> command = jedis -> JedisConverters + .toSetOfRedisClusterNodes(jedis.clusterSlaves(jedis.clusterMyId())); Set activeMasterNodes = this.topologyProvider.getTopology().getActiveMasterNodes(); - List>> nodeResults = - this.clusterCommandExecutor.executeCommandAsyncOnNodes(command,activeMasterNodes) - .getResults(); + List>> nodeResults = this.clusterCommandExecutor + .executeCommandAsyncOnNodes(command, activeMasterNodes).getResults(); Map> result = new LinkedHashMap<>(); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java index 1c6045faf9..a3525928c1 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterServerCommands.java @@ -253,8 +253,7 @@ public Properties getConfig(String pattern) { JedisClusterCommandCallback> command = jedis -> jedis.configGet(pattern); List>> nodeResults = connection.getClusterCommandExecutor() - .executeCommandOnAllNodes(command) - .getResults(); + .executeCommandOnAllNodes(command).getResults(); Properties nodesConfiguration = new Properties(); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStreamCommands.java index 9d26a6cd8d..fcdf108bfb 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStreamCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterStreamCommands.java @@ -272,10 +272,8 @@ public PendingMessages xPending(byte[] key, String groupName, XPendingOptions op try { @SuppressWarnings("all") - XPendingParams pendingParams = new XPendingParams( - JedisConverters.toBytes(StreamConverters.getLowerValue(range)), - JedisConverters.toBytes(StreamConverters.getUpperValue(range)), - options.getCount().intValue()); + XPendingParams pendingParams = new XPendingParams(JedisConverters.toBytes(StreamConverters.getLowerValue(range)), + JedisConverters.toBytes(StreamConverters.getUpperValue(range)), options.getCount().intValue()); String consumerName = options.getConsumerName(); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterZSetCommands.java index b7bc9b5f92..c3a58d522a 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterZSetCommands.java @@ -59,8 +59,8 @@ */ class JedisClusterZSetCommands implements RedisZSetCommands { - private static final SetConverter TUPLE_SET_CONVERTER = - new SetConverter<>(JedisConverters::toTuple); + private static final SetConverter TUPLE_SET_CONVERTER = new SetConverter<>( + JedisConverters::toTuple); private final JedisClusterConnection connection; @@ -893,8 +893,8 @@ public Set zInterWithScores(byte[]... sets) { if (ClusterSlotHashUtil.isSameSlotForAllKeys(sets)) { try { - return JedisConverters.toSet(JedisConverters.toTupleList(connection.getCluster() - .zinterWithScores(new ZParams(), sets))); + return JedisConverters + .toSet(JedisConverters.toTupleList(connection.getCluster().zinterWithScores(new ZParams(), sets))); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -915,8 +915,8 @@ public Set zInterWithScores(Aggregate aggregate, Weights weights, byte[]. if (ClusterSlotHashUtil.isSameSlotForAllKeys(sets)) { try { - return JedisConverters.toSet(JedisConverters.toTupleList(connection.getCluster() - .zinterWithScores(toZParams(aggregate, weights), sets))); + return JedisConverters.toSet( + JedisConverters.toTupleList(connection.getCluster().zinterWithScores(toZParams(aggregate, weights), sets))); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -994,8 +994,8 @@ public Set zUnionWithScores(byte[]... sets) { if (ClusterSlotHashUtil.isSameSlotForAllKeys(sets)) { try { - return JedisConverters.toSet(JedisConverters.toTupleList(connection.getCluster() - .zunionWithScores(new ZParams(), sets))); + return JedisConverters + .toSet(JedisConverters.toTupleList(connection.getCluster().zunionWithScores(new ZParams(), sets))); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -1016,8 +1016,8 @@ public Set zUnionWithScores(Aggregate aggregate, Weights weights, byte[]. if (ClusterSlotHashUtil.isSameSlotForAllKeys(sets)) { try { - return JedisConverters.toSet(JedisConverters.toTupleList(connection.getCluster() - .zunionWithScores(toZParams(aggregate, weights), sets))); + return JedisConverters.toSet( + JedisConverters.toTupleList(connection.getCluster().zunionWithScores(toZParams(aggregate, weights), sets))); } catch (Exception ex) { throw convertJedisAccessException(ex); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java index 5888498d2b..1d90d91b2e 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java @@ -79,8 +79,8 @@ */ public class JedisConnection extends AbstractRedisConnection { - private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = - new FallbackExceptionTranslationStrategy(JedisExceptionConverter.INSTANCE); + private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new FallbackExceptionTranslationStrategy( + JedisExceptionConverter.INSTANCE); private boolean convertPipelineAndTxResults = true; @@ -110,8 +110,7 @@ public class JedisConnection extends AbstractRedisConnection { private final Log LOGGER = LogFactory.getLog(getClass()); - @SuppressWarnings("rawtypes") - private List pipelinedResults = new ArrayList<>(); + @SuppressWarnings("rawtypes") private List pipelinedResults = new ArrayList<>(); private final @Nullable Pool pool; @@ -327,8 +326,7 @@ public void close() throws DataAccessException { // Return connection to the pool if (this.pool != null) { jedis.close(); - } - else { + } else { doExceptionThrowingOperationSafely(jedis::disconnect, "Failed to disconnect during close"); } } @@ -709,15 +707,13 @@ private void doExceptionThrowingOperationSafely(ExceptionThrowingOperation opera try { operation.run(); - } - catch (Exception ex) { + } catch (Exception ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(logMessage, ex); } } } - @FunctionalInterface private interface ExceptionThrowingOperation { void run() throws Exception; diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java index 586a35eca2..5c1e977c6c 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java @@ -47,6 +47,7 @@ *

* Usage example: *

+ * *

  * JedisInvoker invoker = …;
  *
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
index 5f7b76d592..a8191dccf9 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
@@ -97,8 +97,7 @@ public  T evalSha(byte[] scriptSha, ReturnType returnType, int numKeys, byte[
 		JedisScriptReturnConverter converter = new JedisScriptReturnConverter(returnType);
 		return (T) connection.invoke()
 				.from(Jedis::evalsha, ScriptingKeyPipelineBinaryCommands::evalsha, scriptSha, numKeys, keysAndArgs)
-				.getOrElse(converter, () -> converter.convert(null)
-		);
+				.getOrElse(converter, () -> converter.convert(null));
 	}
 
 }
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
index e3cef50537..6f10947d30 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
@@ -565,7 +565,6 @@ public Cursor zScan(byte[] key, ScanOptions options) {
 		return zScan(key, CursorId.initial(), options);
 	}
 
-
 	/**
 	 * @param key
 	 * @param cursorId
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java
index 60564519fa..5348f0197e 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java
@@ -47,8 +47,7 @@ class ClusterConnectionProvider implements LettuceConnectionProvider, RedisClien
 
 	private final Lock lock = new ReentrantLock();
 
-	@Nullable
-	private final ReadFrom readFrom;
+	@Nullable private final ReadFrom readFrom;
 
 	private final RedisClusterClient client;
 
@@ -115,9 +114,9 @@ private Optional getReadFrom() {
 				|| connectionType.equals(StatefulConnection.class)) {
 
 			return client.connectAsync(codec).thenApply(connection -> {
-						getReadFrom().ifPresent(connection::setReadFrom);
-						return connectionType.cast(connection);
-					});
+				getReadFrom().ifPresent(connection::setReadFrom);
+				return connectionType.cast(connection);
+			});
 		}
 
 		return LettuceFutureUtils
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
index 41a7cb94e1..79791437af 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
@@ -305,8 +305,8 @@ public Set clusterGetReplicas(RedisClusterNode master) {
 
 		RedisClusterNode nodeToUse = this.topologyProvider.getTopology().lookup(master);
 
-		LettuceClusterCommandCallback> command = client ->
-			LettuceConverters.toSetOfRedisClusterNodes(client.clusterSlaves(nodeToUse.getId()));
+		LettuceClusterCommandCallback> command = client -> LettuceConverters
+				.toSetOfRedisClusterNodes(client.clusterSlaves(nodeToUse.getId()));
 
 		return this.clusterCommandExecutor.executeCommandOnSingleNode(command, master).getValue();
 	}
@@ -316,11 +316,11 @@ public Map> clusterGetMasterRepli
 
 		Set activeMasterNodes = this.topologyProvider.getTopology().getActiveMasterNodes();
 
-		LettuceClusterCommandCallback> command = client ->
-			Converters.toSetOfRedisClusterNodes(client.clusterSlaves(client.clusterMyId()));
+		LettuceClusterCommandCallback> command = client -> Converters
+				.toSetOfRedisClusterNodes(client.clusterSlaves(client.clusterMyId()));
 
-		List>> nodeResults =
-			this.clusterCommandExecutor.executeCommandAsyncOnNodes(command,activeMasterNodes).getResults();
+		List>> nodeResults = this.clusterCommandExecutor
+				.executeCommandAsyncOnNodes(command, activeMasterNodes).getResults();
 
 		Map> result = new LinkedHashMap<>();
 
@@ -353,8 +353,8 @@ public RedisClusterNode clusterGetNodeForKey(byte[] key) {
 	@Override
 	public ClusterInfo clusterGetClusterInfo() {
 
-		LettuceClusterCommandCallback command = client ->
-				new ClusterInfo(LettuceConverters.toProperties(client.clusterInfo()));
+		LettuceClusterCommandCallback command = client -> new ClusterInfo(
+				LettuceConverters.toProperties(client.clusterInfo()));
 
 		return this.clusterCommandExecutor.executeCommandOnArbitraryNode(command).getValue();
 	}
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java
index d35041871b..ea1361d352 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java
@@ -989,7 +989,6 @@ public void stop() {
 		state.set(State.STOPPED);
 	}
 
-
 	@Override
 	public boolean isRunning() {
 		return State.STARTED.equals(this.state.get());
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
index 5548d2d1f6..a11716133f 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
@@ -101,8 +101,7 @@ public abstract class LettuceConverters extends Converters {
 
 	public static Point geoCoordinatesToPoint(@Nullable GeoCoordinates geoCoordinate) {
 
-		return geoCoordinate != null
-				? new Point(geoCoordinate.getX().doubleValue(), geoCoordinate.getY().doubleValue())
+		return geoCoordinate != null ? new Point(geoCoordinate.getX().doubleValue(), geoCoordinate.getY().doubleValue())
 				: null;
 	}
 
@@ -172,8 +171,7 @@ public static List toBytesList(Collection source) {
 
 	public static Tuple toTuple(@Nullable ScoredValue source) {
 
-		return source != null && source.hasValue()
-				? new DefaultTuple(source.getValue(), Double.valueOf(source.getScore()))
+		return source != null && source.hasValue() ? new DefaultTuple(source.getValue(), Double.valueOf(source.getScore()))
 				: null;
 	}
 
@@ -635,8 +633,8 @@ static Converter, Long> toTimeConverter(TimeUnit timeUnit) {
 	 */
 	public static GeoArgs.Unit toGeoArgsUnit(Metric metric) {
 
-		Metric metricToUse = metric == null
-				|| ObjectUtils.nullSafeEquals(Metrics.NEUTRAL, metric) ? DistanceUnit.METERS : metric;
+		Metric metricToUse = metric == null || ObjectUtils.nullSafeEquals(Metrics.NEUTRAL, metric) ? DistanceUnit.METERS
+				: metric;
 
 		return ObjectUtils.caseInsensitiveValueOf(GeoArgs.Unit.values(), metricToUse.getAbbreviation());
 	}
@@ -716,7 +714,7 @@ public static BitFieldArgs toBitFieldArgs(BitFieldSubCommands subCommands) {
 						case SAT -> BitFieldArgs.OverflowType.SAT;
 						case FAIL -> BitFieldArgs.OverflowType.FAIL;
 						case WRAP -> BitFieldArgs.OverflowType.WRAP;
-          			};
+					};
 
 					args = args.overflow(type);
 				}
@@ -897,7 +895,7 @@ static FlushMode toFlushMode(@Nullable RedisServerCommands.FlushOption option) {
 		return switch (option) {
 			case ASYNC -> FlushMode.ASYNC;
 			case SYNC -> FlushMode.SYNC;
-    	};
+		};
 	}
 
 	/**
@@ -909,8 +907,8 @@ enum GeoResultsConverterFactory {
 		INSTANCE;
 
 		Converter>, GeoResults>> forMetric(Metric metric) {
-			return new GeoResultsConverter(metric == null
-					|| ObjectUtils.nullSafeEquals(Metrics.NEUTRAL, metric) ? DistanceUnit.METERS : metric);
+			return new GeoResultsConverter(
+					metric == null || ObjectUtils.nullSafeEquals(Metrics.NEUTRAL, metric) ? DistanceUnit.METERS : metric);
 		}
 
 		private static class GeoResultsConverter
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java
index 78d4e7006e..4ccd25e506 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java
@@ -95,7 +95,6 @@ public Long del(byte[]... keys) {
 		return connection.invoke().just(RedisKeyAsyncCommands::del, keys);
 	}
 
-
 	@Override
 	public Long unlink(byte[]... keys) {
 
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java
index 85d6feb3c1..c3f36a19e2 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java
@@ -118,8 +118,8 @@ public Flux>> sInter(Publisher intersecting : intersectings) {
 							source.retainAll(intersecting);
 						}
-				return source;
-			});
+						return source;
+					});
 
 			return Mono.just(new CommandResponse<>(command, result.concatMap(v -> Flux.fromStream(v.stream()))));
 		}));
@@ -179,8 +179,8 @@ public Flux>> sDiff(Publisher(command, result.concatMap(v -> Flux.fromStream(v.stream()))));
 
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java
index 77e6280491..9aaaa614b0 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java
@@ -300,7 +300,7 @@ public Flux bPop(Publisher commands) {
 			Mono mappedMono = (ObjectUtils.nullSafeEquals(Direction.RIGHT, command.getDirection())
 					? cmd.brpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new))
 					: cmd.blpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new)))
-							.map(kv -> Arrays.asList(kv.getKey(), kv.getValue())).map(PopResult::new);
+					.map(kv -> Arrays.asList(kv.getKey(), kv.getValue())).map(PopResult::new);
 
 			return mappedMono.map(value -> new PopResponse(command, value));
 		}));
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java
index b66d0827a0..3b24bd1f22 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java
@@ -286,7 +286,7 @@ public Mono clusterSetSlot(RedisClusterNode node, int slot, AddSlots mode)
 				case IMPORTING -> commands.clusterSetSlotImporting(slot, nodeId);
 				case NODE -> commands.clusterSetSlotNode(slot, nodeId);
 				case STABLE -> commands.clusterSetSlotStable(slot);
-      		};
+			};
 		}).then();
 	}
 
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
index 1f45c373cd..b286ad0be4 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
@@ -172,12 +172,8 @@ public Flux> xGroup(Publisher
-								new CommandResponse<>(command, it)
-						);
+				return cmd.xgroupCreate(offset, ByteUtils.getByteBuffer(command.getGroupName()),
+						XGroupCreateArgs.Builder.mkstream(command.isMkStream())).map(it -> new CommandResponse<>(command, it));
 			}
 
 			if (command.getAction().equals(GroupCommandAction.DELETE_CONSUMER)) {
@@ -361,7 +357,8 @@ public Flux> xTrim(Publisher comm
 			Assert.notNull(command.getKey(), "Key must not be null");
 			Assert.notNull(command.getCount(), "Count must not be null");
 
-			return cmd.xtrim(command.getKey(), command.isApproximateTrimming(), command.getCount()).map(value -> new NumericResponse<>(command, value));
+			return cmd.xtrim(command.getKey(), command.isApproximateTrimming(), command.getCount())
+					.map(value -> new NumericResponse<>(command, value));
 		}));
 	}
 
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java
index 9bb93f3987..20cee30e23 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java
@@ -115,8 +115,7 @@ public Flux> setGet(Publisher command
 			Assert.notNull(command.getValue(), "Value must not be null");
 
 			return reactiveCommands.setGet(command.getKey(), command.getValue())
-					.map(v -> new ByteBufferResponse<>(command, v))
-					.defaultIfEmpty(new AbsentByteBufferResponse<>(command));
+					.map(v -> new ByteBufferResponse<>(command, v)).defaultIfEmpty(new AbsentByteBufferResponse<>(command));
 		}));
 	}
 
@@ -145,8 +144,7 @@ public Flux> get(Publisher commands)
 
 			Assert.notNull(command.getKey(), "Key must not be null");
 
-			return reactiveCommands.get(command.getKey())
-					.map(value -> new ByteBufferResponse<>(command, value))
+			return reactiveCommands.get(command.getKey()).map(value -> new ByteBufferResponse<>(command, value))
 					.defaultIfEmpty(new AbsentByteBufferResponse<>(command));
 		}));
 	}
@@ -158,8 +156,7 @@ public Flux> getDel(Publisher command
 
 			Assert.notNull(command.getKey(), "Key must not be null");
 
-			return reactiveCommands.getdel(command.getKey())
-					.map(value -> new ByteBufferResponse<>(command, value))
+			return reactiveCommands.getdel(command.getKey()).map(value -> new ByteBufferResponse<>(command, value))
 					.defaultIfEmpty(new AbsentByteBufferResponse<>(command));
 		}));
 	}
@@ -173,8 +170,7 @@ public Flux> getEx(Publisher comm
 
 			GetExArgs args = LettuceConverters.toGetExArgs(command.getExpiration());
 
-			return reactiveCommands.getex(command.getKey(), args)
-					.map(value -> new ByteBufferResponse<>(command, value))
+			return reactiveCommands.getex(command.getKey(), args).map(value -> new ByteBufferResponse<>(command, value))
 					.defaultIfEmpty(new AbsentByteBufferResponse<>(command));
 		}));
 	}
@@ -204,8 +200,7 @@ public Flux> setEX(Publisher commands) {
 			long expirationTimeInSeconds = command.getExpiration().get().getExpirationTimeInSeconds();
 
 			return reactiveCommands.setex(command.getKey(), expirationTimeInSeconds, command.getValue())
-					.map(LettuceConverters::stringToBoolean)
-					.map((value) -> new BooleanResponse<>(command, value));
+					.map(LettuceConverters::stringToBoolean).map((value) -> new BooleanResponse<>(command, value));
 		}));
 	}
 
@@ -221,8 +216,7 @@ public Flux> pSetEX(Publisher commands)
 			long expirationTimeInSeconds = command.getExpiration().get().getExpirationTimeInMilliseconds();
 
 			return reactiveCommands.psetex(command.getKey(), expirationTimeInSeconds, command.getValue())
-					.map(LettuceConverters::stringToBoolean)
-					.map((value) -> new BooleanResponse<>(command, value));
+					.map(LettuceConverters::stringToBoolean).map((value) -> new BooleanResponse<>(command, value));
 		}));
 	}
 
@@ -233,8 +227,7 @@ public Flux> mSet(Publisher commands)
 
 			Assert.notEmpty(command.getKeyValuePairs(), "Pairs must not be null or empty");
 
-			return reactiveCommands.mset(command.getKeyValuePairs())
-					.map(LettuceConverters::stringToBoolean)
+			return reactiveCommands.mset(command.getKeyValuePairs()).map(LettuceConverters::stringToBoolean)
 					.map((value) -> new BooleanResponse<>(command, value));
 		}));
 	}
@@ -246,8 +239,7 @@ public Flux> mSetNX(Publisher commands
 
 			Assert.notEmpty(command.getKeyValuePairs(), "Pairs must not be null or empty");
 
-			return reactiveCommands.msetnx(command.getKeyValuePairs())
-					.map((value) -> new BooleanResponse<>(command, value));
+			return reactiveCommands.msetnx(command.getKeyValuePairs()).map((value) -> new BooleanResponse<>(command, value));
 		}));
 	}
 
@@ -304,8 +296,7 @@ public Flux> getBit(Publisher comm
 			Assert.notNull(command.getKey(), "Key must not be null");
 			Assert.notNull(command.getOffset(), "Offset must not be null");
 
-			return reactiveCommands.getbit(command.getKey(), command.getOffset())
-					.map(LettuceConverters::toBoolean)
+			return reactiveCommands.getbit(command.getKey(), command.getOffset()).map(LettuceConverters::toBoolean)
 					.map(value -> new BooleanResponse<>(command, value));
 		}));
 	}
@@ -332,9 +323,8 @@ public Flux> bitCount(Publisher range = command.getRange();
 
-			Mono bitcount = !Range.unbounded().equals(range)
-					? reactiveCommands.bitcount(command.getKey(), LettuceConverters.getLowerBoundIndex(range),
-							LettuceConverters.getUpperBoundIndex(range))
+			Mono bitcount = !Range.unbounded().equals(range) ? reactiveCommands.bitcount(command.getKey(),
+					LettuceConverters.getLowerBoundIndex(range), LettuceConverters.getUpperBoundIndex(range))
 					: reactiveCommands.bitcount(command.getKey());
 
 			return bitcount.map(responseValue -> new NumericResponse<>(command, responseValue));
@@ -351,9 +341,8 @@ public Flux> bitField(Publisher new MultiValueResponse<>(command, value.stream()
-							.map(v -> v.getValueOrElse(null))
-							.collect(Collectors.toList())));
+					.map(value -> new MultiValueResponse<>(command,
+							value.stream().map(v -> v.getValueOrElse(null)).collect(Collectors.toList())));
 		}));
 	}
 
@@ -391,30 +380,30 @@ public Flux> bitPos(Publisher Flux.from(commands).flatMap(command -> {
 
-				Range range = command.getRange();
-				Mono result;
+			Range range = command.getRange();
+			Mono result;
 
-				if (range.getLowerBound().isBounded()) {
+			if (range.getLowerBound().isBounded()) {
 
-					result = reactiveCommands.bitpos(command.getKey(), command.getBit(), getLowerValue(range));
+				result = reactiveCommands.bitpos(command.getKey(), command.getBit(), getLowerValue(range));
 
-					if (range.getUpperBound().isBounded()) {
-						result = reactiveCommands.bitpos(command.getKey(), command.getBit(),
-								getLowerValue(range), getUpperValue(range));
-					}
-				} else {
-					result = reactiveCommands.bitpos(command.getKey(), command.getBit());
+				if (range.getUpperBound().isBounded()) {
+					result = reactiveCommands.bitpos(command.getKey(), command.getBit(), getLowerValue(range),
+							getUpperValue(range));
 				}
+			} else {
+				result = reactiveCommands.bitpos(command.getKey(), command.getBit());
+			}
 
-				return result.map(respValue -> new NumericResponse<>(command, respValue));
-			}));
+			return result.map(respValue -> new NumericResponse<>(command, respValue));
+		}));
 	}
 
 	@Override
 	public Flux> strLen(Publisher commands) {
 
-		return this.connection.execute(reactiveCommands -> Flux.from(commands).concatMap(command ->
-				reactiveCommands.strlen(command.getKey()).map(respValue -> new NumericResponse<>(command, respValue))));
+		return this.connection.execute(reactiveCommands -> Flux.from(commands).concatMap(command -> reactiveCommands
+				.strlen(command.getKey()).map(respValue -> new NumericResponse<>(command, respValue))));
 	}
 
 	protected LettuceReactiveRedisConnection getConnection() {
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java
index ad5c2281c2..6292d673a3 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java
@@ -296,8 +296,7 @@ public List xRevRange(byte[] key, Range range, Limit limit)
 		io.lettuce.core.Range lettuceRange = RangeConverter.toRange(range, Function.identity());
 		io.lettuce.core.Limit lettuceLimit = LettuceConverters.toLimit(limit);
 
-		return connection.invoke()
-				.fromMany(RedisStreamAsyncCommands::xrevrange, key, lettuceRange, lettuceLimit)
+		return connection.invoke().fromMany(RedisStreamAsyncCommands::xrevrange, key, lettuceRange, lettuceLimit)
 				.toList(StreamConverters.byteRecordConverter());
 	}
 
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java
index 5dad73a71e..cb4699b2cd 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java
@@ -125,8 +125,8 @@ public byte[] setGet(byte[] key, byte[] value, Expiration expiration, SetOption
 		Assert.notNull(expiration, "Expiration must not be null");
 		Assert.notNull(option, "Option must not be null");
 
-		return connection.invoke()
-				.just(RedisStringAsyncCommands::setGet, key, value, LettuceConverters.toSetArgs(expiration, option));
+		return connection.invoke().just(RedisStringAsyncCommands::setGet, key, value,
+				LettuceConverters.toSetArgs(expiration, option));
 	}
 
 	@Override
@@ -295,18 +295,17 @@ public Long bitOp(BitOperation op, byte[] destination, byte[]... keys) {
 			throw new IllegalArgumentException("Bitop NOT should only be performed against one key");
 		}
 
-		return connection.invoke().just(it ->
-			switch (op) {
-				case AND -> it.bitopAnd(destination, keys);
-				case OR -> it.bitopOr(destination, keys);
-				case XOR -> it.bitopXor(destination, keys);
-				case NOT -> {
-					if (keys.length != 1) {
-						throw new IllegalArgumentException("Bitop NOT should only be performed against one key");
-					}
-					yield it.bitopNot(destination, keys[0]);
+		return connection.invoke().just(it -> switch (op) {
+			case AND -> it.bitopAnd(destination, keys);
+			case OR -> it.bitopOr(destination, keys);
+			case XOR -> it.bitopXor(destination, keys);
+			case NOT -> {
+				if (keys.length != 1) {
+					throw new IllegalArgumentException("Bitop NOT should only be performed against one key");
 				}
-      		});
+				yield it.bitopNot(destination, keys[0]);
+			}
+		});
 	}
 
 	@Nullable
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java
index e812b4946b..06690f07f7 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java
@@ -160,8 +160,7 @@ private StatefulRedisConnection masterReplicaConnection(RedisURI redisUri, ReadF
 			ReadFrom readFrom) {
 
 		CompletableFuture> connection = MasterReplica
-				.connectAsync(client,
-				codec, redisUri);
+				.connectAsync(client, codec, redisUri);
 
 		return connection.thenApply(conn -> {
 
diff --git a/src/main/java/org/springframework/data/redis/connection/package-info.java b/src/main/java/org/springframework/data/redis/connection/package-info.java
index e8ea570a95..3bf58057f0 100644
--- a/src/main/java/org/springframework/data/redis/connection/package-info.java
+++ b/src/main/java/org/springframework/data/redis/connection/package-info.java
@@ -6,4 +6,3 @@
 @org.springframework.lang.NonNullApi
 @org.springframework.lang.NonNullFields
 package org.springframework.data.redis.connection;
-
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
index f2e125e3e2..43d1ecdac4 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
@@ -369,7 +369,8 @@ public ByteMapBackedRecord withId(RecordId id) {
 	static class ByteBufferMapBackedRecord extends MapBackedRecord
 			implements ByteBufferRecord {
 
-		ByteBufferMapBackedRecord(@Nullable ByteBuffer stream, @Nullable RecordId recordId, Map map) {
+		ByteBufferMapBackedRecord(@Nullable ByteBuffer stream, @Nullable RecordId recordId,
+				Map map) {
 			super(stream, recordId, map);
 		}
 
diff --git a/src/main/java/org/springframework/data/redis/connection/util/package-info.java b/src/main/java/org/springframework/data/redis/connection/util/package-info.java
index b655016f04..270b01d4dc 100644
--- a/src/main/java/org/springframework/data/redis/connection/util/package-info.java
+++ b/src/main/java/org/springframework/data/redis/connection/util/package-info.java
@@ -4,4 +4,3 @@
 @org.springframework.lang.NonNullApi
 @org.springframework.lang.NonNullFields
 package org.springframework.data.redis.connection.util;
-
diff --git a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java
index d11a387f80..b6ba020263 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java
@@ -132,7 +132,6 @@ public interface BoundGeoOperations extends BoundKeyOperations {
 	@Nullable
 	List position(M... members);
 
-
 	/**
 	 * Get the {@literal member}s within the boundaries of a given {@link Circle}.
 	 *
@@ -247,8 +246,7 @@ default GeoResults> search(GeoReference reference, Distance ra
 	 * @see Redis Documentation: GEOSEARCH
 	 */
 	@Nullable
-	default GeoResults> search(GeoReference reference, Distance radius,
-			GeoSearchCommandArgs args) {
+	default GeoResults> search(GeoReference reference, Distance radius, GeoSearchCommandArgs args) {
 		return search(reference, GeoShape.byRadius(radius), args);
 	}
 
@@ -296,8 +294,7 @@ default GeoResults> search(GeoReference reference, BoundingBox
 	 * @see Redis Documentation: GEOSEARCH
 	 */
 	@Nullable
-	GeoResults> search(GeoReference reference, GeoShape geoPredicate,
-			GeoSearchCommandArgs args);
+	GeoResults> search(GeoReference reference, GeoShape geoPredicate, GeoSearchCommandArgs args);
 
 	/**
 	 * Get the {@literal member}s within the boundaries of a given {@link Circle} and store results at {@code destKey}.
@@ -340,8 +337,7 @@ default Long searchAndStore(K destKey, GeoReference reference, Distance radiu
 	 * @see Redis Documentation: GEOSEARCHSTORE
 	 */
 	@Nullable
-	default Long searchAndStore(K destKey, GeoReference reference, Distance radius,
-			GeoSearchStoreCommandArgs args) {
+	default Long searchAndStore(K destKey, GeoReference reference, Distance radius, GeoSearchStoreCommandArgs args) {
 		return searchAndStore(destKey, reference, GeoShape.byRadius(radius), args);
 	}
 
@@ -389,7 +385,6 @@ default Long searchAndStore(K destKey, GeoReference reference, BoundingBox bo
 	 * @see Redis Documentation: GEOSEARCHSTORE
 	 */
 	@Nullable
-	Long searchAndStore(K destKey, GeoReference reference, GeoShape geoPredicate,
-			GeoSearchStoreCommandArgs args);
+	Long searchAndStore(K destKey, GeoReference reference, GeoShape geoPredicate, GeoSearchStoreCommandArgs args);
 
 }
diff --git a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java
index 01ebb31246..4bde5e512b 100644
--- a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java
@@ -26,9 +26,9 @@
 
 /**
  * Redis operations for cluster specific operations. A {@link RedisClusterNode} can be obtained from
- * {@link RedisClusterCommands#clusterGetNodes() a connection} or it can be
- * constructed using either {@link RedisClusterNode#getHost() host} and {@link RedisClusterNode#getPort()} or the
- * {@link RedisClusterNode#getId() node Id}.
+ * {@link RedisClusterCommands#clusterGetNodes() a connection} or it can be constructed using either
+ * {@link RedisClusterNode#getHost() host} and {@link RedisClusterNode#getPort()} or the {@link RedisClusterNode#getId()
+ * node Id}.
  *
  * @author Christoph Strobl
  * @author Mark Paluch
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java
index 9456bff358..1b68901a7a 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java
@@ -191,8 +191,8 @@ public Long remove(K key, M... members) {
 	}
 
 	@Override
-	public GeoResults> search(K key, GeoReference reference,
-			GeoShape geoPredicate, RedisGeoCommands.GeoSearchCommandArgs args) {
+	public GeoResults> search(K key, GeoReference reference, GeoShape geoPredicate,
+			RedisGeoCommands.GeoSearchCommandArgs args) {
 
 		byte[] rawKey = rawKey(key);
 		GeoReference rawMember = getGeoReference(reference);
@@ -204,8 +204,8 @@ public GeoResults> search(K key, GeoReference reference,
 	}
 
 	@Override
-	public Long searchAndStore(K key, K destKey, GeoReference reference,
-			GeoShape geoPredicate, RedisGeoCommands.GeoSearchStoreCommandArgs args) {
+	public Long searchAndStore(K key, K destKey, GeoReference reference, GeoShape geoPredicate,
+			RedisGeoCommands.GeoSearchStoreCommandArgs args) {
 
 		byte[] rawKey = rawKey(key);
 		byte[] rawDestKey = rawKey(destKey);
@@ -217,8 +217,7 @@ public Long searchAndStore(K key, K destKey, GeoReference reference,
 	@SuppressWarnings("unchecked")
 	private GeoReference getGeoReference(GeoReference reference) {
 		return reference instanceof GeoReference.GeoMemberReference
-				? GeoReference
-						.fromMember(rawValue(((GeoMemberReference) reference).getMember()))
+				? GeoReference.fromMember(rawValue(((GeoMemberReference) reference).getMember()))
 				: (GeoReference) reference;
 	}
 }
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java
index ccdfbee704..f3a13fbff3 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java
@@ -277,7 +277,7 @@ public ExpireChanges persist(K key, Collection hashKeys) {
 	@Override
 	public Expirations getTimeToLive(K key, TimeUnit timeUnit, Collection hashKeys) {
 
-		if(timeUnit.compareTo(TimeUnit.MILLISECONDS) < 0) {
+		if (timeUnit.compareTo(TimeUnit.MILLISECONDS) < 0) {
 			throw new IllegalArgumentException("%s precision is not supported must be >= MILLISECONDS".formatted(timeUnit));
 		}
 
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java
index 6e92f6a749..8e46a315f0 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java
@@ -91,8 +91,7 @@ public Mono add(K key, Map memberCoordinateMap) {
 
 			Mono>> serializedList = Flux
 					.fromIterable(() -> memberCoordinateMap.entrySet().iterator())
-					.map(entry -> new GeoLocation<>(rawValue(entry.getKey()), entry.getValue()))
-					.collectList();
+					.map(entry -> new GeoLocation<>(rawValue(entry.getKey()), entry.getValue())).collectList();
 
 			return serializedList.flatMap(list -> geoCommands.geoAdd(rawKey(key), list));
 		});
@@ -107,8 +106,7 @@ public Mono add(K key, Iterable> geoLocations) {
 		return createMono(geoCommands -> {
 
 			Mono>> serializedList = Flux.fromIterable(geoLocations)
-					.map(location -> new GeoLocation<>(rawValue(location.getName()), location.getPoint()))
-					.collectList();
+					.map(location -> new GeoLocation<>(rawValue(location.getName()), location.getPoint())).collectList();
 
 			return serializedList.flatMap(list -> geoCommands.geoAdd(rawKey(key), list));
 		});
@@ -220,9 +218,8 @@ public Flux>> radius(K key, V member, double radius) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(member, "Member must not be null");
 
-		return createFlux(geoCommands ->
-				geoCommands.geoRadiusByMember(rawKey(key), rawValue(member), new Distance(radius)) //
-						.map(this::readGeoResult));
+		return createFlux(geoCommands -> geoCommands.geoRadiusByMember(rawKey(key), rawValue(member), new Distance(radius)) //
+				.map(this::readGeoResult));
 	}
 
 	@Override
@@ -271,29 +268,29 @@ public Mono delete(K key) {
 	}
 
 	@Override
-	public Flux>> search(K key, GeoReference reference,
-			GeoShape geoPredicate, RedisGeoCommands.GeoSearchCommandArgs args) {
+	public Flux>> search(K key, GeoReference reference, GeoShape geoPredicate,
+			RedisGeoCommands.GeoSearchCommandArgs args) {
 
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(reference, "GeoReference must not be null");
 
 		GeoReference rawReference = getGeoReference(reference);
 
-		return createFlux(geoCommands -> geoCommands.geoSearch(rawKey(key), rawReference, geoPredicate, args)
-				.map(this::readGeoResult));
+		return createFlux(
+				geoCommands -> geoCommands.geoSearch(rawKey(key), rawReference, geoPredicate, args).map(this::readGeoResult));
 	}
 
 	@Override
-	public Mono searchAndStore(K key, K destKey, GeoReference reference,
-			GeoShape geoPredicate, RedisGeoCommands.GeoSearchStoreCommandArgs args) {
+	public Mono searchAndStore(K key, K destKey, GeoReference reference, GeoShape geoPredicate,
+			RedisGeoCommands.GeoSearchStoreCommandArgs args) {
 
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(reference, "GeoReference must not be null");
 
 		GeoReference rawReference = getGeoReference(reference);
 
-		return createMono(geoCommands -> geoCommands.geoSearchStore(rawKey(destKey), rawKey(key),
-				rawReference, geoPredicate, args));
+		return createMono(
+				geoCommands -> geoCommands.geoSearchStore(rawKey(destKey), rawKey(key), rawReference, geoPredicate, args));
 	}
 
 	private  Mono createMono(Function> function) {
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java
index 1a26f750a7..23241fa106 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java
@@ -119,8 +119,8 @@ public Mono leftPush(K key, V pivot, V value) {
 
 		Assert.notNull(key, "Key must not be null");
 
-		return createMono(listCommands ->
-				listCommands.lInsert(rawKey(key), Position.BEFORE, rawValue(pivot), rawValue(value)));
+		return createMono(
+				listCommands -> listCommands.lInsert(rawKey(key), Position.BEFORE, rawValue(pivot), rawValue(value)));
 	}
 
 	@Override
@@ -162,8 +162,8 @@ public Mono rightPush(K key, V pivot, V value) {
 
 		Assert.notNull(key, "Key must not be null");
 
-		return createMono(listCommands ->
-				listCommands.lInsert(rawKey(key), Position.AFTER, rawValue(pivot), rawValue(value)));
+		return createMono(
+				listCommands -> listCommands.lInsert(rawKey(key), Position.AFTER, rawValue(pivot), rawValue(value)));
 	}
 
 	@Override
@@ -229,8 +229,8 @@ public Mono lastIndexOf(K key, V value) {
 
 		Assert.notNull(key, "Key must not be null");
 
-		return createMono(listCommands ->
-				listCommands.lPos(LPosCommand.lPosOf(rawValue(value)).from(rawKey(key)).rank(-1)));
+		return createMono(
+				listCommands -> listCommands.lPos(LPosCommand.lPosOf(rawValue(value)).from(rawKey(key)).rank(-1)));
 	}
 
 	@Override
@@ -294,8 +294,8 @@ public Mono rightPopAndLeftPush(K sourceKey, K destinationKey) {
 		Assert.notNull(sourceKey, "Source key must not be null");
 		Assert.notNull(destinationKey, "Destination key must not be null");
 
-		return createMono(connection -> connection.rPopLPush(rawKey(sourceKey), rawKey(destinationKey))
-				.map(this::readRequiredValue));
+		return createMono(
+				connection -> connection.rPopLPush(rawKey(sourceKey), rawKey(destinationKey)).map(this::readRequiredValue));
 	}
 
 	@Override
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java
index f7365adba5..976d3df37d 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java
@@ -32,8 +32,8 @@
 import org.springframework.data.domain.Range;
 import org.springframework.data.redis.connection.Limit;
 import org.springframework.data.redis.connection.ReactiveStreamCommands;
-import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
 import org.springframework.data.redis.connection.RedisStreamCommands.XAddOptions;
+import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
 import org.springframework.data.redis.connection.convert.Converters;
 import org.springframework.data.redis.connection.stream.ByteBufferRecord;
 import org.springframework.data.redis.connection.stream.Consumer;
@@ -268,8 +268,7 @@ public Flux> range(K key, Range range, Limit limit)
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createFlux(streamCommands ->
-				streamCommands.xRange(rawKey(key), range, limit).map(this::deserializeRecord));
+		return createFlux(streamCommands -> streamCommands.xRange(rawKey(key), range, limit).map(this::deserializeRecord));
 	}
 
 	@Override
@@ -289,8 +288,7 @@ public Flux> read(StreamReadOptions readOptions, StreamOffs
 
 	@Override
 	@SuppressWarnings("unchecked")
-	public Flux> read(Consumer consumer, StreamReadOptions readOptions,
-			StreamOffset... streams) {
+	public Flux> read(Consumer consumer, StreamReadOptions readOptions, StreamOffset... streams) {
 
 		Assert.notNull(consumer, "Consumer must not be null");
 		Assert.notNull(readOptions, "StreamReadOptions must not be null");
@@ -311,8 +309,8 @@ public Flux> reverseRange(K key, Range range, Limit
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createFlux(streamCommands ->
-				streamCommands.xRevRange(rawKey(key), range, limit).map(this::deserializeRecord));
+		return createFlux(
+				streamCommands -> streamCommands.xRevRange(rawKey(key), range, limit).map(this::deserializeRecord));
 	}
 
 	@Override
@@ -361,8 +359,7 @@ private ByteBuffer rawHashKey(HK key) {
 
 		try {
 			return serializationContext.getHashKeySerializationPair().write(key);
-		} catch (IllegalStateException ignore) {
-		}
+		} catch (IllegalStateException ignore) {}
 
 		return ByteBuffer.wrap(objectMapper.getConversionService().convert(key, byte[].class));
 	}
@@ -371,8 +368,7 @@ private ByteBuffer rawValue(HV value) {
 
 		try {
 			return serializationContext.getHashValueSerializationPair().write(value);
-		} catch (IllegalStateException ignore) {
-		}
+		} catch (IllegalStateException ignore) {}
 
 		return ByteBuffer.wrap(objectMapper.getConversionService().convert(value, byte[].class));
 	}
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java
index 8cf8d54985..87e1eb4cf4 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java
@@ -73,8 +73,8 @@ public Mono set(K key, V value, Duration timeout) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(timeout, "Duration must not be null");
 
-		return createMono(stringCommands ->
-				stringCommands.set(rawKey(key), rawValue(value), Expiration.from(timeout), SetOption.UPSERT));
+		return createMono(
+				stringCommands -> stringCommands.set(rawKey(key), rawValue(value), Expiration.from(timeout), SetOption.UPSERT));
 	}
 
 	@Override
@@ -84,9 +84,8 @@ public Mono setGet(K key, V value, Duration timeout) {
 		Assert.notNull(value, "Value must not be null");
 		Assert.notNull(timeout, "Duration must not be null");
 
-		return createMono(stringCommands ->
-				stringCommands.setGet(rawKey(key), rawValue(value), Expiration.from(timeout), SetOption.UPSERT))
-				.map(this::readRequiredValue);
+		return createMono(stringCommands -> stringCommands.setGet(rawKey(key), rawValue(value), Expiration.from(timeout),
+				SetOption.UPSERT)).map(this::readRequiredValue);
 	}
 
 	@Override
@@ -94,8 +93,8 @@ public Mono setIfAbsent(K key, V value) {
 
 		Assert.notNull(key, "Key must not be null");
 
-		return createMono(stringCommands ->
-				stringCommands.set(rawKey(key), rawValue(value), Expiration.persistent(), SetOption.SET_IF_ABSENT));
+		return createMono(stringCommands -> stringCommands.set(rawKey(key), rawValue(value), Expiration.persistent(),
+				SetOption.SET_IF_ABSENT));
 	}
 
 	@Override
@@ -104,8 +103,8 @@ public Mono setIfAbsent(K key, V value, Duration timeout) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(timeout, "Duration must not be null");
 
-		return createMono(stringCommands ->
-				stringCommands.set(rawKey(key), rawValue(value), Expiration.from(timeout), SetOption.SET_IF_ABSENT));
+		return createMono(stringCommands -> stringCommands.set(rawKey(key), rawValue(value), Expiration.from(timeout),
+				SetOption.SET_IF_ABSENT));
 	}
 
 	@Override
@@ -113,8 +112,8 @@ public Mono setIfPresent(K key, V value) {
 
 		Assert.notNull(key, "Key must not be null");
 
-		return createMono(stringCommands ->
-				stringCommands.set(rawKey(key), rawValue(value), Expiration.persistent(), SetOption.SET_IF_PRESENT));
+		return createMono(stringCommands -> stringCommands.set(rawKey(key), rawValue(value), Expiration.persistent(),
+				SetOption.SET_IF_PRESENT));
 	}
 
 	@Override
@@ -123,8 +122,8 @@ public Mono setIfPresent(K key, V value, Duration timeout) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(timeout, "Duration must not be null");
 
-		return createMono(stringCommands ->
-				stringCommands.set(rawKey(key), rawValue(value), Expiration.from(timeout), SetOption.SET_IF_PRESENT));
+		return createMono(stringCommands -> stringCommands.set(rawKey(key), rawValue(value), Expiration.from(timeout),
+				SetOption.SET_IF_PRESENT));
 	}
 
 	@Override
@@ -198,8 +197,7 @@ public Mono getAndSet(K key, V value) {
 
 		Assert.notNull(key, "Key must not be null");
 
-		return createMono(stringCommands -> stringCommands.getSet(rawKey(key), rawValue(value))
-				.mapNotNull(value()::read));
+		return createMono(stringCommands -> stringCommands.getSet(rawKey(key), rawValue(value)).mapNotNull(value()::read));
 	}
 
 	@Override
@@ -207,9 +205,8 @@ public Mono> multiGet(Collection keys) {
 
 		Assert.notNull(keys, "Keys must not be null");
 
-		return createMono(stringCommands ->
-				Flux.fromIterable(keys).map(key()::write).collectList().flatMap(stringCommands::mGet)
-						.map(this::deserializeValues));
+		return createMono(stringCommands -> Flux.fromIterable(keys).map(key()::write).collectList()
+				.flatMap(stringCommands::mGet).map(this::deserializeValues));
 	}
 
 	@Override
@@ -258,8 +255,8 @@ public Mono append(K key, String value) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(value, "Value must not be null");
 
-		return createMono(stringCommands ->
-				stringCommands.append(rawKey(key), serializationContext.getStringSerializationPair().write(value)));
+		return createMono(stringCommands -> stringCommands.append(rawKey(key),
+				serializationContext.getStringSerializationPair().write(value)));
 	}
 
 	@Override
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java
index 65ae76a139..f93530efd4 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java
@@ -210,8 +210,8 @@ public Flux> rangeByScoreWithScores(K key, Range range) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(range, "Range must not be null");
 
-		return createFlux(zSetCommands ->
-				zSetCommands.zRangeByScoreWithScores(rawKey(key), range).map(this::readTypedTuple));
+		return createFlux(
+				zSetCommands -> zSetCommands.zRangeByScoreWithScores(rawKey(key), range).map(this::readTypedTuple));
 	}
 
 	@Override
@@ -220,8 +220,8 @@ public Flux rangeByScore(K key, Range range, Limit limit) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(range, "Range must not be null");
 
-		return createFlux(zSetCommands -> zSetCommands.zRangeByScore(rawKey(key), range, limit)
-				.map(this::readRequiredValue));
+		return createFlux(
+				zSetCommands -> zSetCommands.zRangeByScore(rawKey(key), range, limit).map(this::readRequiredValue));
 	}
 
 	@Override
@@ -231,8 +231,8 @@ public Flux> rangeByScoreWithScores(K key, Range range, Li
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createFlux(zSetCommands ->
-				zSetCommands.zRangeByScoreWithScores(rawKey(key), range, limit).map(this::readTypedTuple));
+		return createFlux(
+				zSetCommands -> zSetCommands.zRangeByScoreWithScores(rawKey(key), range, limit).map(this::readTypedTuple));
 	}
 
 	@Override
@@ -250,8 +250,7 @@ public Flux> reverseRangeWithScores(K key, Range range) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(range, "Range must not be null");
 
-		return createFlux(zSetCommands ->
-				zSetCommands.zRevRangeWithScores(rawKey(key), range).map(this::readTypedTuple));
+		return createFlux(zSetCommands -> zSetCommands.zRevRangeWithScores(rawKey(key), range).map(this::readTypedTuple));
 	}
 
 	@Override
@@ -260,8 +259,7 @@ public Flux reverseRangeByScore(K key, Range range) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(range, "Range must not be null");
 
-		return createFlux(zSetCommands -> zSetCommands.zRevRangeByScore(rawKey(key), range)
-				.map(this::readRequiredValue));
+		return createFlux(zSetCommands -> zSetCommands.zRevRangeByScore(rawKey(key), range).map(this::readRequiredValue));
 	}
 
 	@Override
@@ -270,8 +268,8 @@ public Flux> reverseRangeByScoreWithScores(K key, Range ra
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(range, "Range must not be null");
 
-		return createFlux(zSetCommands ->
-				zSetCommands.zRevRangeByScoreWithScores(rawKey(key), range).map(this::readTypedTuple));
+		return createFlux(
+				zSetCommands -> zSetCommands.zRevRangeByScoreWithScores(rawKey(key), range).map(this::readTypedTuple));
 	}
 
 	@Override
@@ -280,8 +278,8 @@ public Flux reverseRangeByScore(K key, Range range, Limit limit) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(range, "Range must not be null");
 
-		return createFlux(zSetCommands -> zSetCommands.zRevRangeByScore(rawKey(key), range, limit)
-				.map(this::readRequiredValue));
+		return createFlux(
+				zSetCommands -> zSetCommands.zRevRangeByScore(rawKey(key), range, limit).map(this::readRequiredValue));
 	}
 
 	@Override
@@ -291,8 +289,8 @@ public Flux> reverseRangeByScoreWithScores(K key, Range ra
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createFlux(zSetCommands ->
-				zSetCommands.zRevRangeByScoreWithScores(rawKey(key), range, limit).map(this::readTypedTuple));
+		return createFlux(
+				zSetCommands -> zSetCommands.zRevRangeByScoreWithScores(rawKey(key), range, limit).map(this::readTypedTuple));
 	}
 
 	@Override
@@ -314,8 +312,7 @@ public Mono reverseRangeAndStoreByLex(K srcKey, K dstKey, Range ra
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createMono(zSetCommands ->
-				zSetCommands.zRangeStoreRevByLex(rawKey(srcKey), rawKey(dstKey), range, limit));
+		return createMono(zSetCommands -> zSetCommands.zRangeStoreRevByLex(rawKey(srcKey), rawKey(dstKey), range, limit));
 	}
 
 	@Override
@@ -326,8 +323,7 @@ public Mono rangeAndStoreByScore(K srcKey, K dstKey, Range range,
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createMono(zSetCommands ->
-				zSetCommands.zRangeStoreByScore(rawKey(srcKey), rawKey(dstKey), range, limit));
+		return createMono(zSetCommands -> zSetCommands.zRangeStoreByScore(rawKey(srcKey), rawKey(dstKey), range, limit));
 	}
 
 	@Override
@@ -338,8 +334,7 @@ public Mono reverseRangeAndStoreByScore(K srcKey, K dstKey, Range
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createMono(zSetCommands ->
-				zSetCommands.zRangeStoreRevByScore(rawKey(srcKey), rawKey(dstKey), range, limit));
+		return createMono(zSetCommands -> zSetCommands.zRangeStoreRevByScore(rawKey(srcKey), rawKey(dstKey), range, limit));
 	}
 
 	@Override
@@ -348,8 +343,7 @@ public Flux> scan(K key, ScanOptions options) {
 		Assert.notNull(key, "Key must not be null");
 		Assert.notNull(options, "ScanOptions must not be null");
 
-		return createFlux(zSetCommands ->
-				zSetCommands.zScan(rawKey(key), options).map(this::readTypedTuple));
+		return createFlux(zSetCommands -> zSetCommands.zScan(rawKey(key), options).map(this::readTypedTuple));
 	}
 
 	@Override
@@ -694,8 +688,8 @@ public Flux reverseRangeByLex(K key, Range range, Limit limit) {
 		Assert.notNull(range, "Range must not be null");
 		Assert.notNull(limit, "Limit must not be null");
 
-		return createFlux(zSetCommands -> zSetCommands.zRevRangeByLex(rawKey(key), range, limit)
-				.map(this::readRequiredValue));
+		return createFlux(
+				zSetCommands -> zSetCommands.zRevRangeByLex(rawKey(key), range, limit).map(this::readRequiredValue));
 	}
 
 	@Override
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java
index 9c8b87dad3..0170cc2c87 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java
@@ -219,8 +219,7 @@ public Set distinctRandomMembers(K key, long count) {
 	@Override
 	public List randomMembers(K key, long count) {
 
-		Assert.isTrue(count >= 0,
-				"Use a positive number for count; This method is already allowing duplicate elements");
+		Assert.isTrue(count >= 0, "Use a positive number for count; This method is already allowing duplicate elements");
 
 		byte[] rawKey = rawKey(key);
 		List rawValues = execute(connection -> connection.sRandMember(rawKey, -count));
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
index 3cb27d1dcd..bad0e18b9d 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
@@ -141,7 +141,7 @@ public RecordId add(Record record) {
 	@Nullable
 	@Override
 	@SuppressWarnings("unchecked")
-	public RecordId add(Record record, XAddOptions options) {
+	public RecordId add(Record record, XAddOptions options) {
 
 		Assert.notNull(record, "Record must not be null");
 		Assert.notNull(options, "XAddOptions must not be null");
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java
index 030974bf8c..c27937248b 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java
@@ -336,8 +336,8 @@ public Set> reverseRangeByScoreWithScores(K key, double min, doubl
 	public Set> reverseRangeByScoreWithScores(K key, double min, double max, long offset, long count) {
 
 		byte[] rawKey = rawKey(key);
-		Set rawValues = execute(connection ->
-				connection.zRevRangeByScoreWithScores(rawKey, min, max, offset, count));
+		Set rawValues = execute(
+				connection -> connection.zRevRangeByScoreWithScores(rawKey, min, max, offset, count));
 
 		return deserializeTupleValues(rawValues);
 	}
diff --git a/src/main/java/org/springframework/data/redis/core/GeoOperations.java b/src/main/java/org/springframework/data/redis/core/GeoOperations.java
index 6b20c07789..6088a362a4 100644
--- a/src/main/java/org/springframework/data/redis/core/GeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/GeoOperations.java
@@ -283,8 +283,7 @@ default GeoResults> search(K key, GeoReference reference, Dist
 	 * @see Redis Documentation: GEOSEARCH
 	 */
 	@Nullable
-	default GeoResults> search(K key, GeoReference reference,
-			BoundingBox boundingBox) {
+	default GeoResults> search(K key, GeoReference reference, BoundingBox boundingBox) {
 		return search(key, reference, boundingBox, GeoSearchCommandArgs.newGeoSearchArgs());
 	}
 
@@ -319,8 +318,7 @@ default GeoResults> search(K key, GeoReference reference, Boun
 	 * @see Redis Documentation: GEOSEARCH
 	 */
 	@Nullable
-	GeoResults> search(K key, GeoReference reference,
-			GeoShape geoPredicate, GeoSearchCommandArgs args);
+	GeoResults> search(K key, GeoReference reference, GeoShape geoPredicate, GeoSearchCommandArgs args);
 
 	/**
 	 * Get the {@literal member}s within the boundaries of a given {@link Circle} and store results at {@code destKey}.
diff --git a/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java b/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java
index 888157c525..0c7ca45584 100644
--- a/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java
+++ b/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java
@@ -37,8 +37,7 @@ public class KeyScanOptions extends ScanOptions {
 
 	private final @Nullable String type;
 
-	KeyScanOptions(@Nullable Long count, @Nullable String pattern, @Nullable byte[] bytePattern,
-			@Nullable String type) {
+	KeyScanOptions(@Nullable Long count, @Nullable String pattern, @Nullable byte[] bytePattern, @Nullable String type) {
 
 		super(count, pattern, bytePattern);
 		this.type = type;
@@ -47,7 +46,7 @@ public class KeyScanOptions extends ScanOptions {
 	/**
 	 * Static factory method that returns a new {@link ScanOptionsBuilder}.
 	 *
-	 * @param type 
+	 * @param type
 	 * @return
 	 */
 	public static ScanOptionsBuilder scanOptions(DataType type) {
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java
index 3741aa751d..a70bb00f9e 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java
@@ -410,7 +410,7 @@ public Mono delete(Publisher keys) {
 		return doCreateFlux(connection -> connection.keyCommands() //
 				.mDel(Flux.from(keys).map(this::rawKey).buffer(128)) //
 				.map(CommandResponse::getOutput)) //
-						.collect(Collectors.summingLong(value -> value));
+				.collect(Collectors.summingLong(value -> value));
 	}
 
 	@Override
@@ -437,7 +437,7 @@ public Mono unlink(Publisher keys) {
 		return doCreateFlux(connection -> connection.keyCommands() //
 				.mUnlink(Flux.from(keys).map(this::rawKey).buffer(128)) //
 				.map(CommandResponse::getOutput)) //
-						.collect(Collectors.summingLong(value -> value));
+				.collect(Collectors.summingLong(value -> value));
 	}
 
 	@Override
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
index 341eafe6b7..e798d33d78 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
@@ -23,26 +23,16 @@
 import java.util.Map;
 
 import org.reactivestreams.Publisher;
+
 import org.springframework.data.domain.Range;
 import org.springframework.data.redis.connection.Limit;
-import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
 import org.springframework.data.redis.connection.RedisStreamCommands.XAddOptions;
-import org.springframework.data.redis.connection.stream.ByteBufferRecord;
-import org.springframework.data.redis.connection.stream.Consumer;
-import org.springframework.data.redis.connection.stream.MapRecord;
-import org.springframework.data.redis.connection.stream.ObjectRecord;
-import org.springframework.data.redis.connection.stream.PendingMessage;
-import org.springframework.data.redis.connection.stream.PendingMessages;
-import org.springframework.data.redis.connection.stream.PendingMessagesSummary;
-import org.springframework.data.redis.connection.stream.ReadOffset;
+import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
+import org.springframework.data.redis.connection.stream.*;
 import org.springframework.data.redis.connection.stream.Record;
-import org.springframework.data.redis.connection.stream.RecordId;
 import org.springframework.data.redis.connection.stream.StreamInfo.XInfoConsumer;
 import org.springframework.data.redis.connection.stream.StreamInfo.XInfoGroup;
 import org.springframework.data.redis.connection.stream.StreamInfo.XInfoStream;
-import org.springframework.data.redis.connection.stream.StreamOffset;
-import org.springframework.data.redis.connection.stream.StreamReadOptions;
-import org.springframework.data.redis.connection.stream.StreamRecords;
 import org.springframework.data.redis.hash.HashMapper;
 import org.springframework.lang.Nullable;
 import org.springframework.util.Assert;
@@ -125,8 +115,8 @@ default Mono add(MapRecord record, XAdd
 	}
 
 	/**
-	 * Append the record, backed by the given value, to the stream with the specified options.
-	 * The value will be hashed and serialized.
+	 * Append the record, backed by the given value, to the stream with the specified options. The value will be hashed
+	 * and serialized.
 	 *
 	 * @param record must not be {@literal null}.
 	 * @param xAddOptions parameters for the {@literal XADD} call. Must not be {@literal null}.
@@ -185,11 +175,9 @@ default Mono add(MapRecord record) {
 	Mono add(Record record);
 
 	/**
-	 * Changes the ownership of a pending message so that the new owner is the consumer specified as
-	 * the command argument.
-	 *
-	 * The message is claimed only if its idle time (ms) is greater than the {@link Duration minimum idle time}
-	 * specified when calling {@literal XCLAIM}.
+	 * Changes the ownership of a pending message so that the new owner is the consumer specified as the command argument.
+	 * The message is claimed only if its idle time (ms) is greater than the {@link Duration minimum idle time} specified
+	 * when calling {@literal XCLAIM}.
 	 *
 	 * @param key {@link K key} to the steam.
 	 * @param consumerGroup {@link String name} of the consumer group.
@@ -210,9 +198,7 @@ default Flux> claim(K key, String consumerGroup, String new
 	}
 
 	/**
-	 * Changes the ownership of a pending message so that the new owner is the consumer specified as
-	 * the command argument.
-
+	 * Changes the ownership of a pending message so that the new owner is the consumer specified as the command argument.
 	 * The message is claimed only if its idle time (ms) is greater than the given {@link Duration minimum idle time}
 	 * specified when calling {@literal XCLAIM}.
 	 *
diff --git a/src/main/java/org/springframework/data/redis/core/RedisAccessor.java b/src/main/java/org/springframework/data/redis/core/RedisAccessor.java
index 5753347654..e12b9a3e04 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisAccessor.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisAccessor.java
@@ -52,8 +52,8 @@ public RedisConnectionFactory getConnectionFactory() {
 	}
 
 	/**
-	 * Returns the required {@link RedisConnectionFactory}, throwing an {@link IllegalStateException}
-	 * if the {@link RedisConnectionFactory} is not set.
+	 * Returns the required {@link RedisConnectionFactory}, throwing an {@link IllegalStateException} if the
+	 * {@link RedisConnectionFactory} is not set.
 	 *
 	 * @return the configured {@link RedisConnectionFactory}.
 	 * @throws IllegalStateException if the {@link RedisConnectionFactory} is not set.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisCommand.java b/src/main/java/org/springframework/data/redis/core/RedisCommand.java
index c1d63c1077..4eaf3009d4 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisCommand.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisCommand.java
@@ -52,8 +52,7 @@ public enum RedisCommand {
 	BGSAVE("r", 0, 0), //
 	BITCOUNT("r", 1, 3), //
 	BITFIELD("rw", 1), //
-	BITFIELD_RO("r", 1),
-	BITOP("rw", 3), //
+	BITFIELD_RO("r", 1), BITOP("rw", 3), //
 	BITPOS("r", 2, 4), //
 	BLMOVE("rw", 4), //
 	BLMPOP("rw", 4), //
@@ -75,7 +74,7 @@ public enum RedisCommand {
 	CLIENT_SETINFO("w", 1), //
 	CLIENT_SETNAME("w", 1, 1), //
 	CLIENT_NO_EVICT("w", 1, 1, "client no-evict"), //
-	CLIENT_NO_TOUCH("w", 1, 1,  "client no-touch"), //
+	CLIENT_NO_TOUCH("w", 1, 1, "client no-touch"), //
 	CLIENT_TRACKING("rw", 1), //
 	CONFIG_GET("r", 1, 1, "getconfig"), //
 	CONFIG_REWRITE("rw", 0, 0), //
@@ -145,8 +144,7 @@ public enum RedisCommand {
 	HLEN("r", 1), //
 	HMGET("r", 2), //
 	HMSET("w", 3), //
-	HPOP("rw", 3),
-	HSET("w", 3, 3), //
+	HPOP("rw", 3), HSET("w", 3, 3), //
 	HSETNX("w", 3, 3), //
 	HVALS("r", 1, 1), //
 	HEXPIRE("w", 5), //
diff --git a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java
index 3e8193a15e..a5c3d5ed65 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java
@@ -510,8 +510,7 @@ public Object intercept(Object obj, Method method, Object[] args) throws Throwab
 			try {
 
 				if (commandInterfaceMethod != null) {
-					target = ReflectionUtils.invokeMethod(commandInterfaceMethod,
-							connection);
+					target = ReflectionUtils.invokeMethod(commandInterfaceMethod, connection);
 				}
 
 				return invoke(method, target, args);
diff --git a/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java b/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java
index 4e1454f533..902789e7b7 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java
@@ -105,13 +105,15 @@ public List doInRedis(RedisKeyValueAdapter adapter) {
 				}
 
 				Iterable ids = ClassUtils.isAssignable(Iterable.class, callbackResult.getClass())
-						? (Iterable) callbackResult : Collections.singleton(callbackResult);
+						? (Iterable) callbackResult
+						: Collections.singleton(callbackResult);
 
 				List result = new ArrayList<>();
 				for (Object id : ids) {
 
 					String idToUse = adapter.getConverter().getConversionService().canConvert(id.getClass(), String.class)
-							? adapter.getConverter().getConversionService().convert(id, String.class) : id.toString();
+							? adapter.getConverter().getConversionService().convert(id, String.class)
+							: id.toString();
 
 					findById(idToUse, type).ifPresent(result::add);
 				}
diff --git a/src/main/java/org/springframework/data/redis/core/ScanIteration.java b/src/main/java/org/springframework/data/redis/core/ScanIteration.java
index 3e0b5a5929..2b2ca85403 100644
--- a/src/main/java/org/springframework/data/redis/core/ScanIteration.java
+++ b/src/main/java/org/springframework/data/redis/core/ScanIteration.java
@@ -65,7 +65,7 @@ public ScanIteration(CursorId cursorId, @Nullable Collection items) {
 	 * @return
 	 * @deprecated since 3.3.0, use {@link #getId()} instead as the cursorId can exceed {@link Long#MAX_VALUE}.
 	 */
-	@Deprecated(since="3.3.3")
+	@Deprecated(since = "3.3.3")
 	public long getCursorId() {
 		return Long.parseLong(getId().getCursorId());
 	}
diff --git a/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java b/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java
index 4b72930993..bdf3e3a99b 100644
--- a/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java
+++ b/src/main/java/org/springframework/data/redis/core/StreamObjectMapper.java
@@ -84,9 +84,9 @@ public Map toHash(Object object) {
 				@Override
 				public Object fromHash(Map hash) {
 
-					Map map = hash.entrySet().stream().collect(Collectors.toMap(
-							keyMapper -> conversionService.convert(keyMapper.getKey(), byte[].class),
-							valueMapper -> conversionService.convert(valueMapper.getValue(), byte[].class)));
+					Map map = hash.entrySet().stream()
+							.collect(Collectors.toMap(keyMapper -> conversionService.convert(keyMapper.getKey(), byte[].class),
+									valueMapper -> conversionService.convert(valueMapper.getValue(), byte[].class)));
 
 					return ohm.fromHash(map);
 				}
diff --git a/src/main/java/org/springframework/data/redis/core/StreamOperations.java b/src/main/java/org/springframework/data/redis/core/StreamOperations.java
index 59a0647f29..0a4715b8ff 100644
--- a/src/main/java/org/springframework/data/redis/core/StreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/StreamOperations.java
@@ -24,24 +24,13 @@
 
 import org.springframework.data.domain.Range;
 import org.springframework.data.redis.connection.Limit;
-import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
 import org.springframework.data.redis.connection.RedisStreamCommands.XAddOptions;
-import org.springframework.data.redis.connection.stream.ByteRecord;
-import org.springframework.data.redis.connection.stream.Consumer;
-import org.springframework.data.redis.connection.stream.MapRecord;
-import org.springframework.data.redis.connection.stream.ObjectRecord;
-import org.springframework.data.redis.connection.stream.PendingMessage;
-import org.springframework.data.redis.connection.stream.PendingMessages;
-import org.springframework.data.redis.connection.stream.PendingMessagesSummary;
-import org.springframework.data.redis.connection.stream.ReadOffset;
+import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
+import org.springframework.data.redis.connection.stream.*;
 import org.springframework.data.redis.connection.stream.Record;
-import org.springframework.data.redis.connection.stream.RecordId;
 import org.springframework.data.redis.connection.stream.StreamInfo.XInfoConsumers;
 import org.springframework.data.redis.connection.stream.StreamInfo.XInfoGroups;
 import org.springframework.data.redis.connection.stream.StreamInfo.XInfoStream;
-import org.springframework.data.redis.connection.stream.StreamOffset;
-import org.springframework.data.redis.connection.stream.StreamReadOptions;
-import org.springframework.data.redis.connection.stream.StreamRecords;
 import org.springframework.data.redis.hash.HashMapper;
 import org.springframework.lang.Nullable;
 import org.springframework.util.Assert;
@@ -129,8 +118,8 @@ default RecordId add(MapRecord record, XAddOption
 	}
 
 	/**
-	 * Append the record, backed by the given value, to the stream with the specified options.
-	 * The value will be hashed and serialized.
+	 * Append the record, backed by the given value, to the stream with the specified options. The value will be hashed
+	 * and serialized.
 	 *
 	 * @param record must not be {@literal null}.
 	 * @param xAddOptions parameters for the {@literal XADD} call. Must not be {@literal null}.
@@ -184,9 +173,7 @@ default RecordId add(MapRecord record) {
 	RecordId add(Record record);
 
 	/**
-	 * Changes the ownership of a pending message so that the new owner is the consumer specified as
-	 * the command argument.
-	 *
+	 * Changes the ownership of a pending message so that the new owner is the consumer specified as the command argument.
 	 * The message is claimed only if its idle time (ms) is greater than the given {@link Duration minimum idle time}
 	 * specified when calling {@literal XCLAIM}.
 	 *
@@ -208,9 +195,7 @@ default List> claim(K key, String consumerGroup, String new
 	}
 
 	/**
-	 * Changes the ownership of a pending message so that the new owner is the consumer specified as
-	 * the command argument.
-	 *
+	 * Changes the ownership of a pending message so that the new owner is the consumer specified as the command argument.
 	 * The message is claimed only if its idle time (ms) is greater than the given {@link Duration minimum idle time}
 	 * specified when calling {@literal XCLAIM}.
 	 *
diff --git a/src/main/java/org/springframework/data/redis/core/convert/BinaryConverters.java b/src/main/java/org/springframework/data/redis/core/convert/BinaryConverters.java
index 0befb22a44..72bdbf520b 100644
--- a/src/main/java/org/springframework/data/redis/core/convert/BinaryConverters.java
+++ b/src/main/java/org/springframework/data/redis/core/convert/BinaryConverters.java
@@ -281,13 +281,11 @@ public Date convert(byte[] source) {
 			String value = toString(source);
 			try {
 				return new Date(NumberUtils.parseNumber(value, Long.class));
-			} catch (NumberFormatException ignore) {
-			}
+			} catch (NumberFormatException ignore) {}
 
 			try {
 				return DateFormat.getInstance().parse(value);
-			} catch (ParseException ignore) {
-			}
+			} catch (ParseException ignore) {}
 
 			throw new IllegalArgumentException("Cannot parse date out of %s".formatted(Arrays.toString(source)));
 		}
diff --git a/src/main/java/org/springframework/data/redis/core/convert/Bucket.java b/src/main/java/org/springframework/data/redis/core/convert/Bucket.java
index 5b832b2d62..a7bd2c8b41 100644
--- a/src/main/java/org/springframework/data/redis/core/convert/Bucket.java
+++ b/src/main/java/org/springframework/data/redis/core/convert/Bucket.java
@@ -57,8 +57,7 @@ public class Bucket {
 	/**
 	 * The Redis data as {@link Map} sorted by the keys.
 	 */
-	private final NavigableMap data = new TreeMap<>(
-			COMPARATOR);
+	private final NavigableMap data = new TreeMap<>(COMPARATOR);
 
 	/**
 	 * Creates a new empty bucket.
@@ -306,8 +305,7 @@ private static String toUtf8String(byte[] raw) {
 
 		try {
 			return new String(raw, CHARSET);
-		} catch (Exception ignore) {
-		}
+		} catch (Exception ignore) {}
 
 		return null;
 	}
diff --git a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java
index 1cea9a221a..5e250196cc 100644
--- a/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java
+++ b/src/main/java/org/springframework/data/redis/core/convert/MappingRedisConverter.java
@@ -571,8 +571,7 @@ RedisPersistentProperty getTargetPropertyOrNullForPath(String path, Class typ
 			PersistentPropertyPath persistentPropertyPath = mappingContext
 					.getPersistentPropertyPath(path, type);
 			return persistentPropertyPath.getLeafProperty();
-		} catch (Exception ignore) {
-		}
+		} catch (Exception ignore) {}
 
 		return null;
 	}
diff --git a/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.java b/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.java
index 00c1964217..0fb668f10d 100644
--- a/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.java
+++ b/src/main/java/org/springframework/data/redis/core/convert/PathIndexResolver.java
@@ -228,7 +228,7 @@ else if (property != null && value != null && property.isAnnotationPresent(Index
 			indexConfiguration.addIndexDefinition(indexDefinition);
 
 			data.add(indexedDataFactoryProvider.getIndexedDataFactory(indexDefinition).createIndexedDataFor(value));
-		} else if (property != null &&  value != null && property.isAnnotationPresent(GeoIndexed.class)) {
+		} else if (property != null && value != null && property.isAnnotationPresent(GeoIndexed.class)) {
 
 			GeoIndexDefinition indexDefinition = new GeoIndexDefinition(keyspace, path);
 			indexConfiguration.addIndexDefinition(indexDefinition);
diff --git a/src/main/java/org/springframework/data/redis/core/convert/RemoveIndexedData.java b/src/main/java/org/springframework/data/redis/core/convert/RemoveIndexedData.java
index d8d5820c96..06ba6cf739 100644
--- a/src/main/java/org/springframework/data/redis/core/convert/RemoveIndexedData.java
+++ b/src/main/java/org/springframework/data/redis/core/convert/RemoveIndexedData.java
@@ -18,7 +18,8 @@
 import org.springframework.data.redis.core.index.IndexDefinition;
 
 /**
- * {@link RemoveIndexedData} represents a removed index entry from a secondary index for a property path in a given keyspace.
+ * {@link RemoveIndexedData} represents a removed index entry from a secondary index for a property path in a given
+ * keyspace.
  *
  * @author Christoph Strobl
  * @author Mark Paluch
diff --git a/src/main/java/org/springframework/data/redis/core/query/QueryUtils.java b/src/main/java/org/springframework/data/redis/core/query/QueryUtils.java
index 9aa364f578..5dcbf58f7a 100644
--- a/src/main/java/org/springframework/data/redis/core/query/QueryUtils.java
+++ b/src/main/java/org/springframework/data/redis/core/query/QueryUtils.java
@@ -32,8 +32,8 @@ public abstract class QueryUtils {
 
 	public static  SortParameters convertQuery(SortQuery query, RedisSerializer stringSerializer) {
 
-		return new DefaultSortParameters(stringSerializer.serialize(query.getBy()), query.getLimit(), serialize(
-				query.getGetPattern(), stringSerializer), query.getOrder(), query.isAlphabetic());
+		return new DefaultSortParameters(stringSerializer.serialize(query.getBy()), query.getLimit(),
+				serialize(query.getGetPattern(), stringSerializer), query.getOrder(), query.isAlphabetic());
 	}
 
 	private static byte[][] serialize(List strings, RedisSerializer stringSerializer) {
diff --git a/src/main/java/org/springframework/data/redis/core/query/package-info.java b/src/main/java/org/springframework/data/redis/core/query/package-info.java
index 73208952ac..9f36b5337d 100644
--- a/src/main/java/org/springframework/data/redis/core/query/package-info.java
+++ b/src/main/java/org/springframework/data/redis/core/query/package-info.java
@@ -4,4 +4,3 @@
 @org.springframework.lang.NonNullApi
 @org.springframework.lang.NonNullFields
 package org.springframework.data.redis.core.query;
-
diff --git a/src/main/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutor.java b/src/main/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutor.java
index bf1f28a55d..b2095e08e3 100644
--- a/src/main/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutor.java
+++ b/src/main/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutor.java
@@ -112,8 +112,8 @@ protected  Flux eval(ReactiveRedisConnection connection, RedisScript sc
 				return connection.scriptingCommands().eval(scriptBytes(script), returnType, numKeys, keysAndArgs);
 			}
 
-			return Flux.error(cause instanceof RuntimeException ? cause
-					: new RedisSystemException(cause.getMessage(), cause));
+			return Flux
+					.error(cause instanceof RuntimeException ? cause : new RedisSystemException(cause.getMessage(), cause));
 		});
 
 		return script.returnsRawValue() ? result : deserializeResult(resultReader, result);
diff --git a/src/main/java/org/springframework/data/redis/core/types/Expiration.java b/src/main/java/org/springframework/data/redis/core/types/Expiration.java
index 2e4627dbc5..fc2fac6acb 100644
--- a/src/main/java/org/springframework/data/redis/core/types/Expiration.java
+++ b/src/main/java/org/springframework/data/redis/core/types/Expiration.java
@@ -74,27 +74,26 @@ public static Expiration unixTimestamp(long unixTimestamp, TimeUnit timeUnit) {
 	 *
 	 * @param expirationTime {@link Long length of time} for the {@link Expiration}.
 	 * @param timeUnit {@link TimeUnit} used to measure the {@link Long expiration time}; can be {@literal null}.
-	 * Defaulted to {@link TimeUnit#SECONDS}
+	 *          Defaulted to {@link TimeUnit#SECONDS}
 	 * @return a new {@link Expiration} configured with the given {@link Long length of time} in {@link TimeUnit}.
 	 */
 	public static Expiration from(long expirationTime, @Nullable TimeUnit timeUnit) {
 
-		if (TimeUnit.NANOSECONDS.equals(timeUnit)
-			|| TimeUnit.MICROSECONDS.equals(timeUnit)
-			|| TimeUnit.MILLISECONDS.equals(timeUnit)) {
+		if (TimeUnit.NANOSECONDS.equals(timeUnit) || TimeUnit.MICROSECONDS.equals(timeUnit)
+				|| TimeUnit.MILLISECONDS.equals(timeUnit)) {
 
 			return new Expiration(timeUnit.toMillis(expirationTime), TimeUnit.MILLISECONDS);
 		}
 
 		return timeUnit != null ? new Expiration(timeUnit.toSeconds(expirationTime), TimeUnit.SECONDS)
-			: new Expiration(expirationTime, TimeUnit.SECONDS);
+				: new Expiration(expirationTime, TimeUnit.SECONDS);
 	}
 
 	/**
 	 * Creates a new {@link Expiration} with the given, required {@link Duration}.
 	 * 

- * Durations with at least {@literal seconds} resolution uses {@link TimeUnit#SECONDS}. {@link Duration Durations} - * in {@literal milliseconds} use {@link TimeUnit#MILLISECONDS}. + * Durations with at least {@literal seconds} resolution uses {@link TimeUnit#SECONDS}. {@link Duration Durations} in + * {@literal milliseconds} use {@link TimeUnit#MILLISECONDS}. * * @param duration must not be {@literal null}. * @return a new {@link Expiration} from the given {@link Duration}. @@ -105,15 +104,15 @@ public static Expiration from(Duration duration) { Assert.notNull(duration, "Duration must not be null"); return duration.isZero() ? Expiration.persistent() - : TimeoutUtils.hasMillis(duration) ? new Expiration(duration.toMillis(), TimeUnit.MILLISECONDS) - : new Expiration(duration.getSeconds(), TimeUnit.SECONDS); + : TimeoutUtils.hasMillis(duration) ? new Expiration(duration.toMillis(), TimeUnit.MILLISECONDS) + : new Expiration(duration.getSeconds(), TimeUnit.SECONDS); } /** * Obtain an {@link Expiration} that indicates to keep the existing one, e.g. when sending a {@code SET} command. *

- * NOTE: Please follow the documentation for the individual commands to see - * if keeping the existing TTL is applicable. + * NOTE: Please follow the documentation for the individual commands to see if keeping the existing + * TTL is applicable. * * @return never {@literal null}. * @since 2.4 @@ -186,8 +185,8 @@ public TimeUnit getTimeUnit() { /** * Converts {@link #getExpirationTime() expiration time} into the given, desired {@link TimeUnit}. * - * @param targetTimeUnit {@link TimeUnit} used to convert the {@link #getExpirationTime()} expiration time}; - * must not be {@literal null}. + * @param targetTimeUnit {@link TimeUnit} used to convert the {@link #getExpirationTime()} expiration time}; must not + * be {@literal null}. * @return the {@link #getExpirationTime() expiration time} converted into the given, desired {@link TimeUnit}. * @throws IllegalArgumentException if the given {@link TimeUnit} is {@literal null}. */ diff --git a/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java b/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java index 77e5aa10ef..5bbb6a526d 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java @@ -32,15 +32,13 @@ */ public class BoundingBox implements Shape { - @Serial - private static final long serialVersionUID = 5215611530535947924L; + @Serial private static final long serialVersionUID = 5215611530535947924L; private final Distance width; private final Distance height; /** - * Creates a new {@link BoundingBox} from the given width and height. Both distances must use the same - * {@link Metric}. + * Creates a new {@link BoundingBox} from the given width and height. Both distances must use the same {@link Metric}. * * @param width must not be {@literal null}. * @param height must not be {@literal null}. diff --git a/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.java b/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.java index 7802726248..90b4a9ac28 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/BoxShape.java @@ -23,7 +23,6 @@ * * @author Mark Paluch * @since 2.6 - * */ public class BoxShape implements GeoShape { diff --git a/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.java b/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.java index e324ed41b7..3ae49f2eac 100644 --- a/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.java +++ b/src/main/java/org/springframework/data/redis/domain/geo/GeoShape.java @@ -18,7 +18,6 @@ import org.springframework.data.geo.Distance; import org.springframework.data.geo.Metric; import org.springframework.data.geo.Shape; -import org.springframework.data.redis.connection.RedisGeoCommands; import org.springframework.data.redis.connection.RedisGeoCommands.DistanceUnit; /** diff --git a/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java b/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java index 8788c41ba4..fcdc24404b 100644 --- a/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java @@ -65,6 +65,7 @@ * Flattening requires all property names to not interfere with JSON paths. Using dots or brackets in map keys or as * property names is not supported using flattening. The resulting hash cannot be mapped back into an Object. *

Example

+ * *
  * class Person {
  * 	String firstname;
@@ -146,8 +147,8 @@
  */
 public class Jackson2HashMapper implements HashMapper {
 
-	private static final boolean SOURCE_VERSION_PRESENT =
-			ClassUtils.isPresent("javax.lang.model.SourceVersion", Jackson2HashMapper.class.getClassLoader());
+	private static final boolean SOURCE_VERSION_PRESENT = ClassUtils.isPresent("javax.lang.model.SourceVersion",
+			Jackson2HashMapper.class.getClassLoader());
 
 	private final ObjectMapper typingMapper;
 	private final ObjectMapper untypedMapper;
@@ -156,9 +157,8 @@ public class Jackson2HashMapper implements HashMapper {
 	/**
 	 * Creates new {@link Jackson2HashMapper} with a default {@link ObjectMapper}.
 	 *
-	 * @param flatten boolean used to configure whether JSON de/serialized {@link Object} properties
-	 * will be un/flattened using {@literal dot notation}, or whether to retain the hierarchical node structure
-	 * created by Jackson.
+	 * @param flatten boolean used to configure whether JSON de/serialized {@link Object} properties will be un/flattened
+	 *          using {@literal dot notation}, or whether to retain the hierarchical node structure created by Jackson.
 	 */
 	public Jackson2HashMapper(boolean flatten) {
 
@@ -190,11 +190,11 @@ public boolean useForType(JavaType type) {
 			}
 		}.findAndRegisterModules(), flatten);
 
-		this.typingMapper.activateDefaultTyping(this.typingMapper.getPolymorphicTypeValidator(),
-				DefaultTyping.EVERYTHING, As.PROPERTY);
+		this.typingMapper.activateDefaultTyping(this.typingMapper.getPolymorphicTypeValidator(), DefaultTyping.EVERYTHING,
+				As.PROPERTY);
 		this.typingMapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
 
-		if(flatten) {
+		if (flatten) {
 			this.typingMapper.disable(MapperFeature.REQUIRE_TYPE_ID_FOR_SUBTYPES);
 		}
 
@@ -208,11 +208,10 @@ public boolean useForType(JavaType type) {
 	/**
 	 * Creates new {@link Jackson2HashMapper} initialized with a custom Jackson {@link ObjectMapper}.
 	 *
-	 * @param mapper Jackson {@link ObjectMapper} used to de/serialize hashed {@link Object objects};
-	 * must not be {@literal null}.
-	 * @param flatten boolean used to configure whether JSON de/serialized {@link Object} properties
-	 * will be un/flattened using {@literal dot notation}, or whether to retain the hierarchical node structure
-	 * created by Jackson.
+	 * @param mapper Jackson {@link ObjectMapper} used to de/serialize hashed {@link Object objects}; must not be
+	 *          {@literal null}.
+	 * @param flatten boolean used to configure whether JSON de/serialized {@link Object} properties will be un/flattened
+	 *          using {@literal dot notation}, or whether to retain the hierarchical node structure created by Jackson.
 	 */
 	public Jackson2HashMapper(ObjectMapper mapper, boolean flatten) {
 
@@ -244,8 +243,7 @@ public Object fromHash(Map hash) {
 
 				Map unflattenedHash = doUnflatten(hash);
 				byte[] unflattenedHashedBytes = this.untypedMapper.writeValueAsBytes(unflattenedHash);
-				Object hashedObject = this.typingMapper.reader().forType(Object.class)
-						.readValue(unflattenedHashedBytes);
+				Object hashedObject = this.typingMapper.reader().forType(Object.class).readValue(unflattenedHashedBytes);
 
 				return hashedObject;
 			}
@@ -279,8 +277,7 @@ private Map doUnflatten(Map source) {
 
 				if (result.containsKey(nonIndexedKeyName)) {
 					addValueToTypedListAtIndex((List) result.get(nonIndexedKeyName), index, entry.getValue());
-				}
-				else {
+				} else {
 					result.put(nonIndexedKeyName, createTypedListWithValue(index, entry.getValue()));
 				}
 			} else {
@@ -340,9 +337,7 @@ private int getIndex(@NonNull String indexedValue) {
 
 		int indexOfLeftBracket = indexedValue.indexOf("[");
 
-		return indexOfLeftBracket > -1
-			? indexedValue.substring(0, indexOfLeftBracket)
-			: indexedValue;
+		return indexOfLeftBracket > -1 ? indexedValue.substring(0, indexOfLeftBracket) : indexedValue;
 	}
 
 	private Map flattenMap(Iterator> source) {
@@ -409,8 +404,7 @@ private void flattenElement(String propertyPrefix, Object source, Map resultMap.put(propertyPrefix, new DirectFieldAccessFallbackBeanWrapper(element).getPropertyValue("_value"));
+				default ->
+					resultMap.put(propertyPrefix, new DirectFieldAccessFallbackBeanWrapper(element).getPropertyValue("_value"));
 			}
 		}
 	}
diff --git a/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java b/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java
index a563bdb1ed..e441e57edd 100644
--- a/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java
+++ b/src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java
@@ -771,7 +771,7 @@ else if (isListening()) {
 	}
 
 	private void remove(@Nullable MessageListener listener, Topic topic, ByteArrayWrapper holder,
-						Map> mapping, List topicToRemove) {
+			Map> mapping, List topicToRemove) {
 
 		Collection listeners = mapping.get(holder);
 		if (CollectionUtils.isEmpty(listeners)) {
diff --git a/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.java b/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.java
index 050e425f3d..15fe24f38d 100644
--- a/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.java
+++ b/src/main/java/org/springframework/data/redis/listener/SynchronizingMessageListener.java
@@ -132,16 +132,14 @@ public SubscriptionSynchronization(Collection remainingPatterns, Collect
 				this.remainingPatterns = Collections.emptySet();
 			} else {
 				this.remainingPatterns = ConcurrentHashMap.newKeySet(remainingPatterns.size());
-				this.remainingPatterns
-						.addAll(remainingPatterns.stream().map(ByteArrayWrapper::new).toList());
+				this.remainingPatterns.addAll(remainingPatterns.stream().map(ByteArrayWrapper::new).toList());
 			}
 
 			if (remainingChannels.isEmpty()) {
 				this.remainingChannels = Collections.emptySet();
 			} else {
 				this.remainingChannels = ConcurrentHashMap.newKeySet(remainingChannels.size());
-				this.remainingChannels
-						.addAll(remainingChannels.stream().map(ByteArrayWrapper::new).toList());
+				this.remainingChannels.addAll(remainingChannels.stream().map(ByteArrayWrapper::new).toList());
 			}
 
 			this.doneCallback = doneCallback;
diff --git a/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryExtension.java b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryExtension.java
index 69469551fc..2222185a18 100644
--- a/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryExtension.java
+++ b/src/main/java/org/springframework/data/redis/repository/cdi/RedisRepositoryExtension.java
@@ -43,9 +43,9 @@
 
 /**
  * CDI extension to export Redis repositories. This extension enables Redis
- * {@link org.springframework.data.repository.Repository} support. It requires either a {@link RedisKeyValueTemplate} or a
- * {@link RedisOperations} bean. If no {@link RedisKeyValueTemplate} or {@link RedisKeyValueAdapter} are provided by the
- * user, the extension creates own managed beans.
+ * {@link org.springframework.data.repository.Repository} support. It requires either a {@link RedisKeyValueTemplate} or
+ * a {@link RedisOperations} bean. If no {@link RedisKeyValueTemplate} or {@link RedisKeyValueAdapter} are provided by
+ * the user, the extension creates own managed beans.
  *
  * @author Mark Paluch
  */
@@ -101,8 +101,7 @@  void processBean(@Observes ProcessBean processBean) {
 			if (beanType instanceof Class && RedisOperations.class.isAssignableFrom((Class) beanType)) {
 				if (log.isDebugEnabled()) {
 					log.debug(
-							"Discovered %s with qualifiers %s.".formatted(RedisOperations.class.getName(),
-							bean.getQualifiers()));
+							"Discovered %s with qualifiers %s.".formatted(RedisOperations.class.getName(), bean.getQualifiers()));
 				}
 
 				// Store the RedisOperations bean using its qualifiers.
diff --git a/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.java b/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.java
index 1783584d4e..c717f52d36 100644
--- a/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.java
+++ b/src/main/java/org/springframework/data/redis/repository/configuration/EnableRedisRepositories.java
@@ -129,7 +129,9 @@
 
 	/**
 	 * Configure a specific {@link BeanNameGenerator} to be used when creating the repositoy beans.
-	 * @return the {@link BeanNameGenerator} to be used or the base {@link BeanNameGenerator} interface to indicate context default.
+	 *
+	 * @return the {@link BeanNameGenerator} to be used or the base {@link BeanNameGenerator} interface to indicate
+	 *         context default.
 	 * @since 3.4
 	 */
 	Class nameGenerator() default BeanNameGenerator.class;
diff --git a/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.java b/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.java
index e6985cd4db..e2ceb303b6 100644
--- a/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.java
+++ b/src/main/java/org/springframework/data/redis/repository/query/RedisOperationChain.java
@@ -127,8 +127,10 @@ public String toString() {
 		@Override
 		public boolean equals(@Nullable Object o) {
 
-			if (this == o) return true;
-			if (o == null || getClass() != o.getClass()) return false;
+			if (this == o)
+				return true;
+			if (o == null || getClass() != o.getClass())
+				return false;
 
 			PathAndValue that = (PathAndValue) o;
 
diff --git a/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.java b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.java
index b302ea64b9..90a21ed05d 100644
--- a/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.java
+++ b/src/main/java/org/springframework/data/redis/serializer/DefaultRedisSerializationContext.java
@@ -36,8 +36,7 @@ class DefaultRedisSerializationContext implements RedisSerializationContex
 	private final SerializationPair stringTuple;
 
 	private DefaultRedisSerializationContext(SerializationPair keyTuple, SerializationPair valueTuple,
-			SerializationPair hashKeyTuple, SerializationPair hashValueTuple,
-			SerializationPair stringTuple) {
+			SerializationPair hashKeyTuple, SerializationPair hashValueTuple, SerializationPair stringTuple) {
 
 		this.keyTuple = keyTuple;
 		this.valueTuple = valueTuple;
@@ -148,8 +147,8 @@ public RedisSerializationContext build() {
 			Assert.notNull(this.hashKeyTuple, "HashKey SerializationPair must not be null");
 			Assert.notNull(this.hashValueTuple, "HashValue SerializationPair must not be null");
 
-			return new DefaultRedisSerializationContext<>(this.keyTuple, this.valueTuple,
-					this.hashKeyTuple, this.hashValueTuple, this.stringTuple);
+			return new DefaultRedisSerializationContext<>(this.keyTuple, this.valueTuple, this.hashKeyTuple,
+					this.hashValueTuple, this.stringTuple);
 		}
 	}
 }
diff --git a/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java
index db67928a94..81ba607c7d 100644
--- a/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java
+++ b/src/main/java/org/springframework/data/redis/serializer/JdkSerializationRedisSerializer.java
@@ -26,11 +26,11 @@
 /**
  * Java Serialization {@link RedisSerializer}.
  * 

- * Delegates to the default (Java-based) {@link DefaultSerializer serializer} - * and {@link DefaultDeserializer deserializer}. + * Delegates to the default (Java-based) {@link DefaultSerializer serializer} and {@link DefaultDeserializer + * deserializer}. *

- * This {@link RedisSerializer serializer} can be constructed with either a custom {@link ClassLoader} - * or custom {@link Converter converters}. + * This {@link RedisSerializer serializer} can be constructed with either a custom {@link ClassLoader} or custom + * {@link Converter converters}. * * @author Mark Pollack * @author Costin Leau @@ -51,11 +51,11 @@ public JdkSerializationRedisSerializer() { } /** - * Creates a new {@link JdkSerializationRedisSerializer} with the given {@link ClassLoader} used to - * resolve {@link Class types} during deserialization. + * Creates a new {@link JdkSerializationRedisSerializer} with the given {@link ClassLoader} used to resolve + * {@link Class types} during deserialization. * - * @param classLoader {@link ClassLoader} used to resolve {@link Class types} for deserialization; - * can be {@literal null}. + * @param classLoader {@link ClassLoader} used to resolve {@link Class types} for deserialization; can be + * {@literal null}. * @since 1.7 */ public JdkSerializationRedisSerializer(@Nullable ClassLoader classLoader) { @@ -66,16 +66,15 @@ public JdkSerializationRedisSerializer(@Nullable ClassLoader classLoader) { * Creates a new {@link JdkSerializationRedisSerializer} using {@link Converter converters} to serialize and * deserialize {@link Object objects}. * - * @param serializer {@link Converter} used to serialize an {@link Object} to a byte array; - * must not be {@literal null}. - * @param deserializer {@link Converter} used to deserialize and convert a byte arra into an {@link Object}; - * must not be {@literal null} - * @throws IllegalArgumentException if either the given {@code serializer} or {@code deserializer} - * are {@literal null}. + * @param serializer {@link Converter} used to serialize an {@link Object} to a byte array; must not be + * {@literal null}. + * @param deserializer {@link Converter} used to deserialize and convert a byte arra into an {@link Object}; must not + * be {@literal null} + * @throws IllegalArgumentException if either the given {@code serializer} or {@code deserializer} are + * {@literal null}. * @since 1.7 */ - public JdkSerializationRedisSerializer(Converter serializer, - Converter deserializer) { + public JdkSerializationRedisSerializer(Converter serializer, Converter deserializer) { Assert.notNull(serializer, "Serializer must not be null"); Assert.notNull(deserializer, "Deserializer must not be null"); diff --git a/src/main/java/org/springframework/data/redis/serializer/RedisSerializationContext.java b/src/main/java/org/springframework/data/redis/serializer/RedisSerializationContext.java index 9136d05cdc..8378d73747 100644 --- a/src/main/java/org/springframework/data/redis/serializer/RedisSerializationContext.java +++ b/src/main/java/org/springframework/data/redis/serializer/RedisSerializationContext.java @@ -126,8 +126,8 @@ static RedisSerializationContext java() { * Creates a new {@link RedisSerializationContext} using a {@link JdkSerializationRedisSerializer} with given * {@link ClassLoader} to resolves {@link Class type} of the keys and values stored in Redis. * - * @param classLoader {@link ClassLoader} used to resolve {@link Class types} of keys and value stored in Redis - * during deserialization; can be {@literal null}. + * @param classLoader {@link ClassLoader} used to resolve {@link Class types} of keys and value stored in Redis during + * deserialization; can be {@literal null}. * @return a new {@link RedisSerializationContext} using JDK Serializaton. * @since 2.1 */ @@ -148,8 +148,8 @@ static RedisSerializationContext string() { * Creates a new {@link RedisSerializationContext} using the given {@link RedisSerializer}. * * @param {@link Class Type} of {@link Object} being de/serialized by the {@link RedisSerializer}. - * @param serializer {@link RedisSerializer} used to de/serialize keys and value stored in Redis; - * must not be {@literal null}. + * @param serializer {@link RedisSerializer} used to de/serialize keys and value stored in Redis; must not be + * {@literal null}. * @return a new {@link RedisSerializationContext} using the given {@link RedisSerializer}. */ static RedisSerializationContext fromSerializer(RedisSerializer serializer) { @@ -160,8 +160,8 @@ static RedisSerializationContext fromSerializer(RedisSerializer ser * Creates a new {@link RedisSerializationContext} using the given {@link SerializationPair}. * * @param {@link Class Type} of {@link Object} de/serialized by the {@link SerializationPair}. - * @param serializationPair {@link SerializationPair} used to de/serialize keys and values stored in Redis; - * must not be {@literal null}. + * @param serializationPair {@link SerializationPair} used to de/serialize keys and values stored in Redis; must not + * be {@literal null}. * @return a new {@link RedisSerializationContext} using the given {@link SerializationPair}. */ static RedisSerializationContext just(SerializationPair serializationPair) { @@ -386,8 +386,7 @@ default RedisSerializationContextBuilder value(RedisSerializer serializ * @param writer must not be {@literal null}. * @return {@literal this} builder. */ - default RedisSerializationContextBuilder hashKey(RedisElementReader reader, - RedisElementWriter writer) { + default RedisSerializationContextBuilder hashKey(RedisElementReader reader, RedisElementWriter writer) { hashKey(SerializationPair.just(reader, writer)); diff --git a/src/main/java/org/springframework/data/redis/serializer/RedisSerializerToSerializationPairAdapter.java b/src/main/java/org/springframework/data/redis/serializer/RedisSerializerToSerializationPairAdapter.java index f7f5b72fcc..758ec63970 100644 --- a/src/main/java/org/springframework/data/redis/serializer/RedisSerializerToSerializationPairAdapter.java +++ b/src/main/java/org/springframework/data/redis/serializer/RedisSerializerToSerializationPairAdapter.java @@ -31,11 +31,11 @@ */ class RedisSerializerToSerializationPairAdapter implements SerializationPair { - private static final RedisSerializerToSerializationPairAdapter BYTE_BUFFER = - new RedisSerializerToSerializationPairAdapter<>(null); + private static final RedisSerializerToSerializationPairAdapter BYTE_BUFFER = new RedisSerializerToSerializationPairAdapter<>( + null); - private static final RedisSerializerToSerializationPairAdapter BYTE_ARRAY = - new RedisSerializerToSerializationPairAdapter<>(RedisSerializer.byteArray()); + private static final RedisSerializerToSerializationPairAdapter BYTE_ARRAY = new RedisSerializerToSerializationPairAdapter<>( + RedisSerializer.byteArray()); private final DefaultSerializationPair pair; diff --git a/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.java b/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.java index 9d9349e18b..7d2a1a2a03 100644 --- a/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.java +++ b/src/main/java/org/springframework/data/redis/stream/DefaultStreamReceiver.java @@ -118,9 +118,8 @@ public Flux receive(StreamOffset streamOffset) { return Flux.defer(() -> { PollState pollState = PollState.standalone(streamOffset.getOffset()); - return Flux.create( - sink -> new StreamSubscription(sink, streamOffset.getKey(), pollState, readFunction, - receiverOptions.getResumeFunction()).arm()); + return Flux.create(sink -> new StreamSubscription(sink, streamOffset.getKey(), pollState, readFunction, + receiverOptions.getResumeFunction()).arm()); }); } @@ -134,13 +133,11 @@ public Flux receiveAutoAck(Consumer consumer, StreamOffset streamOffset) { Function> readFunction = getConsumeReadFunction(streamOffset.getKey(), consumer, this.readOptions.autoAcknowledge()); - return Flux.defer(() -> { PollState pollState = PollState.consumer(consumer, streamOffset.getOffset()); - return Flux.create( - sink -> new StreamSubscription(sink, streamOffset.getKey(), pollState, readFunction, - receiverOptions.getResumeFunction()).arm()); + return Flux.create(sink -> new StreamSubscription(sink, streamOffset.getKey(), pollState, readFunction, + receiverOptions.getResumeFunction()).arm()); }); } @@ -156,9 +153,8 @@ public Flux receive(Consumer consumer, StreamOffset streamOffset) { return Flux.defer(() -> { PollState pollState = PollState.consumer(consumer, streamOffset.getOffset()); - return Flux.create( - sink -> new StreamSubscription(sink, streamOffset.getKey(), pollState, readFunction, - receiverOptions.getResumeFunction()).arm()); + return Flux.create(sink -> new StreamSubscription(sink, streamOffset.getKey(), pollState, readFunction, + receiverOptions.getResumeFunction()).arm()); }); } diff --git a/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java b/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java index 916c276478..0f4bc81dc9 100644 --- a/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java +++ b/src/main/java/org/springframework/data/redis/stream/StreamPollTask.java @@ -36,7 +36,6 @@ import org.springframework.data.redis.stream.StreamMessageListenerContainer.StreamReadRequest; import org.springframework.util.ErrorHandler; - /** * {@link Task} that invokes a {@link BiFunction read function} to poll on a Redis Stream. * diff --git a/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java b/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java index 96f9591c8f..e5829abda1 100644 --- a/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java +++ b/src/main/java/org/springframework/data/redis/stream/StreamReceiver.java @@ -500,8 +500,7 @@ public StreamReceiverOptionsBuilder> objectMapper(Ha */ public StreamReceiverOptions build() { return new StreamReceiverOptions<>(pollTimeout, batchSize, resumeFunction, keySerializer, hashKeySerializer, - hashValueSerializer, - targetType, hashMapper); + hashValueSerializer, targetType, hashMapper); } } } diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java index a95f78b3e5..6778fb8332 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java @@ -47,8 +47,7 @@ */ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyOperations { - @Serial - private static final long serialVersionUID = 1L; + @Serial private static final long serialVersionUID = 1L; private volatile String key; diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java index a4f3e65dba..e5727e987a 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java @@ -48,8 +48,7 @@ */ public class RedisAtomicInteger extends Number implements Serializable, BoundKeyOperations { - @Serial - private static final long serialVersionUID = 1L; + @Serial private static final long serialVersionUID = 1L; private volatile String key; diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java index 2e488697ae..276e89d2f0 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java @@ -49,8 +49,7 @@ */ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOperations { - @Serial - private static final long serialVersionUID = 1L; + @Serial private static final long serialVersionUID = 1L; private volatile String key; diff --git a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisList.java b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisList.java index 3de2317313..b47c6239d0 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisList.java +++ b/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisList.java @@ -240,8 +240,7 @@ public boolean addAll(int index, Collection collection) { // insert collection in reverse if (index == 0) { - CollectionUtils.reverse(collection) - .forEach(this::addFirst); + CollectionUtils.reverse(collection).forEach(this::addFirst); return true; } @@ -632,8 +631,7 @@ public E next() { @SuppressWarnings("all") public void remove() { - Assert.state(this.lastReturnedElement != null, - "Next must be called before remove"); + Assert.state(this.lastReturnedElement != null, "Next must be called before remove"); if (!DefaultRedisList.this.remove(this.lastReturnedElement)) { throw new ConcurrentModificationException(); @@ -698,8 +696,7 @@ public E previous() { public void set(E element) { - Assert.state(this.lastReturnedElement != null, - "next() or previous() must be called before set(:E)"); + Assert.state(this.lastReturnedElement != null, "next() or previous() must be called before set(:E)"); try { DefaultRedisList.this.set(this.lastReturnedElementIndex, element); diff --git a/src/main/java/org/springframework/data/redis/support/collections/RedisList.java b/src/main/java/org/springframework/data/redis/support/collections/RedisList.java index 02fb6b55ab..2ffd2c66d4 100644 --- a/src/main/java/org/springframework/data/redis/support/collections/RedisList.java +++ b/src/main/java/org/springframework/data/redis/support/collections/RedisList.java @@ -307,11 +307,11 @@ default E removeLast() { /** * Returns a reverse-ordered view of this collection. *

- * The encounter order of elements returned by the view is the inverse of the encounter order of the elements - * stored in this collection. The reverse ordering affects all order-sensitive operations, including any operations - * on further views of the returned view. If the collection implementation permits modifications to this view, - * the modifications "write-through" to the underlying collection. Changes to the underlying collection might - * or might not be visible in this reversed view, depending upon the implementation. + * The encounter order of elements returned by the view is the inverse of the encounter order of the elements stored + * in this collection. The reverse ordering affects all order-sensitive operations, including any operations on + * further views of the returned view. If the collection implementation permits modifications to this view, the + * modifications "write-through" to the underlying collection. Changes to the underlying collection might or might not + * be visible in this reversed view, depending upon the implementation. *

* This method is forward-compatible with Java 21 {@literal SequencedCollections}. * diff --git a/src/main/java/org/springframework/data/redis/util/RedisAssertions.java b/src/main/java/org/springframework/data/redis/util/RedisAssertions.java index 22da3c395d..87df3d7cbf 100644 --- a/src/main/java/org/springframework/data/redis/util/RedisAssertions.java +++ b/src/main/java/org/springframework/data/redis/util/RedisAssertions.java @@ -60,13 +60,13 @@ public static T requireNonNull(@Nullable T target, Supplier message) } /** - * Asserts the given {@link Object} is not {@literal null} throwing the given {@link RuntimeException} - * if {@link Object} is {@literal null}. + * Asserts the given {@link Object} is not {@literal null} throwing the given {@link RuntimeException} if + * {@link Object} is {@literal null}. * * @param {@link Class type} of {@link Object} being asserted. * @param target {@link Object} to evaluate. - * @param cause {@link Supplier} of a {@link RuntimeException} to throw - * if the given {@link Object} is {@literal null}. + * @param cause {@link Supplier} of a {@link RuntimeException} to throw if the given {@link Object} is + * {@literal null}. * @return the given {@link Object}. */ public static T requireNonNull(@Nullable T target, RuntimeExceptionSupplier cause) { @@ -107,6 +107,6 @@ public static T requireState(@Nullable T target, Supplier message) { return target; } - public interface RuntimeExceptionSupplier extends Supplier { } + public interface RuntimeExceptionSupplier extends Supplier {} } diff --git a/src/test/java/org/springframework/data/redis/SettingsUtils.java b/src/test/java/org/springframework/data/redis/SettingsUtils.java index 19548d72a0..dd102de1b6 100644 --- a/src/test/java/org/springframework/data/redis/SettingsUtils.java +++ b/src/test/java/org/springframework/data/redis/SettingsUtils.java @@ -15,8 +15,6 @@ */ package org.springframework.data.redis; -import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Properties; @@ -92,7 +90,6 @@ public static int getClusterPort() { return Integer.parseInt(SETTINGS.getProperty("clusterPort")); } - /** * @return path to the unix domain socket. */ diff --git a/src/test/java/org/springframework/data/redis/cache/CacheTestParams.java b/src/test/java/org/springframework/data/redis/cache/CacheTestParams.java index b037099902..9aa3c753fe 100644 --- a/src/test/java/org/springframework/data/redis/cache/CacheTestParams.java +++ b/src/test/java/org/springframework/data/redis/cache/CacheTestParams.java @@ -68,14 +68,12 @@ private static Collection connectionFactories() { // Jedis Cluster JedisConnectionFactory jedisClusterConnectionFactory = JedisConnectionFactoryExtension .getConnectionFactory(RedisCluster.class); - factoryList - .add(jedisClusterConnectionFactory); + factoryList.add(jedisClusterConnectionFactory); // Lettuce Cluster LettuceConnectionFactory lettuceClusterConnectionFactory = LettuceConnectionFactoryExtension .getConnectionFactory(RedisCluster.class); - factoryList - .add(lettuceClusterConnectionFactory); + factoryList.add(lettuceClusterConnectionFactory); } return factoryList; diff --git a/src/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.java b/src/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.java index e4b0696a34..0e89ee752c 100644 --- a/src/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/DefaultRedisCachWriterUnitTests.java @@ -15,18 +15,9 @@ */ package org.springframework.data.redis.cache; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.time.Duration; @@ -35,6 +26,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; + import org.springframework.dao.PessimisticLockingFailureException; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -51,14 +43,11 @@ @ExtendWith(MockitoExtension.class) class DefaultRedisCacheWriterUnitTests { - @Mock - private CacheStatisticsCollector mockCacheStatisticsCollector = mock(CacheStatisticsCollector.class); + @Mock private CacheStatisticsCollector mockCacheStatisticsCollector = mock(CacheStatisticsCollector.class); - @Mock - private RedisConnection mockConnection; + @Mock private RedisConnection mockConnection; - @Mock(strictness = Mock.Strictness.LENIENT) - private RedisConnectionFactory mockConnectionFactory; + @Mock(strictness = Mock.Strictness.LENIENT) private RedisConnectionFactory mockConnectionFactory; @BeforeEach void setup() { @@ -126,8 +115,8 @@ void mustNotUnlockWhenLockingFails() { doReturn(mockStringCommands).when(this.mockConnection).stringCommands(); doReturn(mockKeyCommands).when(this.mockConnection).keyCommands(); - doThrow(new PessimisticLockingFailureException("you-shall-not-pass")).when(mockStringCommands).set(any(byte[].class), - any(byte[].class), any(), any()); + doThrow(new PessimisticLockingFailureException("you-shall-not-pass")).when(mockStringCommands) + .set(any(byte[].class), any(byte[].class), any(), any()); RedisCacheWriter cacheWriter = spy( new DefaultRedisCacheWriter(this.mockConnectionFactory, Duration.ofMillis(10), mock(BatchStrategy.class)) diff --git a/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.java b/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.java index d718055ffa..8a09f35a4e 100644 --- a/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.java +++ b/src/test/java/org/springframework/data/redis/cache/LegacyRedisCacheTests.java @@ -304,8 +304,7 @@ void cachePutWithNullShouldErrorAndLeaveExistingKeyUntouched() { try { cache.put(key, null); - } catch (IllegalArgumentException expected) { - } + } catch (IllegalArgumentException expected) {} assertThat(cache.get(key).get()).isEqualTo(value); } diff --git a/src/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.java index 94de42115d..e34abb4c14 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheConfigurationUnitTests.java @@ -15,14 +15,9 @@ */ package org.springframework.data.redis.cache; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.time.Duration; @@ -72,8 +67,7 @@ void getTtlReturnsFixedDuration() { Duration sixtySeconds = Duration.ofSeconds(60); - RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() - .entryTtl(sixtySeconds); + RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig().entryTtl(sixtySeconds); assertThat(cacheConfiguration).isNotNull(); assertThat(cacheConfiguration.getTtl()).isEqualByComparingTo(sixtySeconds); @@ -91,8 +85,7 @@ public void getTtlReturnsDynamicDuration() { doReturn(thirtyMinutes).doReturn(twoHours).when(mockTtlFunction).getTimeToLive(any(), any()); - RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() - .entryTtl(mockTtlFunction); + RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig().entryTtl(mockTtlFunction); assertThat(cacheConfiguration.getTtl()).isEqualTo(thirtyMinutes); assertThat(cacheConfiguration.getTtl()).isEqualTo(twoHours); diff --git a/src/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.java index e03714beb2..5e52ca2ee1 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheManagerUnitTests.java @@ -15,15 +15,8 @@ */ package org.springframework.data.redis.cache; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; import java.time.Duration; import java.util.Collections; @@ -98,8 +91,7 @@ void predefinedCacheShouldBeCreatedWithSpecificConfig() { @Test // DATAREDIS-481 void transactionAwareCacheManagerShouldDecoracteCache() { - Cache cache = RedisCacheManager.builder(cacheWriter).transactionAware().build() - .getCache("decoracted-cache"); + Cache cache = RedisCacheManager.builder(cacheWriter).transactionAware().build().getCache("decoracted-cache"); assertThat(cache).isInstanceOfAny(TransactionAwareCacheDecorator.class); assertThat(ReflectionTestUtils.getField(cache, "targetCache")).isInstanceOf(RedisCache.class); @@ -209,16 +201,14 @@ void customizeRedisCacheConfigurationBasedOnDefaultsIsImmutable() { RedisCacheManagerBuilder cacheManagerBuilder = RedisCacheManager.builder().cacheDefaults(defaultCacheConfiguration); RedisCacheConfiguration customCacheConfiguration = cacheManagerBuilder.cacheDefaults() - .entryTtl(Duration.ofSeconds(10)) - .disableKeyPrefix(); + .entryTtl(Duration.ofSeconds(10)).disableKeyPrefix(); assertThat(customCacheConfiguration).isNotSameAs(defaultCacheConfiguration); assertThat(cacheManagerBuilder.cacheDefaults(customCacheConfiguration)).isSameAs(cacheManagerBuilder); assertThat(cacheManagerBuilder.cacheDefaults().usePrefix()).isFalse(); assertThat(cacheManagerBuilder.cacheDefaults().getTtlFunction().getTimeToLive(null, null)) - .isEqualTo(Duration.ofSeconds(10)); + .isEqualTo(Duration.ofSeconds(10)); assertThat(defaultCacheConfiguration.usePrefix()).isTrue(); - assertThat(defaultCacheConfiguration.getTtlFunction().getTimeToLive(null, null)) - .isEqualTo(Duration.ofMinutes(30)); + assertThat(defaultCacheConfiguration.getTtlFunction().getTimeToLive(null, null)).isEqualTo(Duration.ofMinutes(30)); } } diff --git a/src/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.java b/src/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.java index ec8e69b52c..c146fbd2b1 100644 --- a/src/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/cache/RedisCacheWriterUnitTests.java @@ -15,17 +15,9 @@ */ package org.springframework.data.redis.cache; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.time.Duration; import java.util.concurrent.CompletableFuture; @@ -70,8 +62,7 @@ void defaultRetrieveWithNameAndKeyCallsRetrieveWithNameKeyAndTtl() throws Except doCallRealMethod().when(cacheWriter).retrieve(anyString(), any()); doReturn(CompletableFuture.completedFuture(value)).when(cacheWriter).retrieve(anyString(), any(), any()); - assertThat(cacheWriter.retrieve("TestCacheName", key).thenApply(String::new).get()) - .isEqualTo("TestValue"); + assertThat(cacheWriter.retrieve("TestCacheName", key).thenApply(String::new).get()).isEqualTo("TestValue"); verify(cacheWriter, times(1)).retrieve(eq("TestCacheName"), eq(key)); verify(cacheWriter, times(1)).retrieve(eq("TestCacheName"), eq(key), isNull()); diff --git a/src/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.java b/src/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.java index 4334ce1028..b02a7ebd75 100644 --- a/src/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/config/NamespaceIntegrationTests.java @@ -17,15 +17,10 @@ import static org.assertj.core.api.Assertions.*; -import jakarta.annotation.Resource; - import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.HashOperations; -import org.springframework.data.redis.core.StreamOperations; import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; diff --git a/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.java b/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.java index fa2b4706b5..e046d62598 100644 --- a/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.java +++ b/src/test/java/org/springframework/data/redis/connection/ClusterSlotHashUtilsTests.java @@ -15,7 +15,11 @@ */ package org.springframework.data.redis.connection; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; + +import redis.clients.jedis.ConnectionPool; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisCluster; import java.util.Random; @@ -26,10 +30,6 @@ import org.springframework.data.redis.test.extension.JedisExtension; import org.springframework.util.StringUtils; -import redis.clients.jedis.ConnectionPool; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisCluster; - /** * Unit tests for {@link ClusterSlotHashUtil}. * @@ -84,8 +84,8 @@ void localCalculationShoudMatchServersForPrefixedKeys() { int slot2 = ClusterSlotHashUtil.calculateSlot(key2); assertThat(slot2) - .describedAs("Expected slot for prefixed keys '%s' and '%s' to be %s but was %s.", key1, key2, slot1, slot2) - .isEqualTo(slot1); + .describedAs("Expected slot for prefixed keys '%s' and '%s' to be %s but was %s.", key1, key2, slot1, slot2) + .isEqualTo(slot1); Long serverSlot1 = jedis.clusterKeySlot(key1); Long serverSlot2 = jedis.clusterKeySlot(key2); diff --git a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.java b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.java index 40c28082e1..8c574b9db4 100644 --- a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.java +++ b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTests.java @@ -1742,7 +1742,7 @@ public void xRangeShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xRangeShouldDelegateAndConvertCorrectly(); } @@ -1751,7 +1751,7 @@ public void xReadShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xReadShouldDelegateAndConvertCorrectly(); } @@ -1760,7 +1760,7 @@ public void xReadGroupShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xReadGroupShouldDelegateAndConvertCorrectly(); } @@ -1769,7 +1769,7 @@ public void xRevRangeShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xRevRangeShouldDelegateAndConvertCorrectly(); } diff --git a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.java b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.java index e7a0e6c607..482aba4ff5 100644 --- a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.java +++ b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionPipelineTxTests.java @@ -60,29 +60,25 @@ public void testAppendBytes() { @Test public void testBlPopBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testBlPopBytes(); } @Test public void testBlPop() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testBlPop(); } @Test public void testBrPopBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testBrPopBytes(); } @Test public void testBrPop() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testBrPop(); } @@ -164,43 +160,37 @@ public void testEcho() { @Test public void testExistsBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testExistsBytes(); } @Test public void testExists() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testExists(); } @Test public void testExpireBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testExpireBytes(); } @Test public void testExpire() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testExpire(); } @Test public void testExpireAtBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testExpireAtBytes(); } @Test public void testExpireAt() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testExpireAt(); } @@ -220,15 +210,13 @@ public void testGet() { @Test public void testGetBitBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testGetBitBytes(); } @Test public void testGetBit() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testGetBit(); } @@ -238,15 +226,13 @@ public void testGetConfig() { Properties results = new Properties(); results.put("foo", "bar"); - doReturn(Collections.singletonList(Collections.singletonList(results))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(results))).when(nativeConnection).closePipeline(); super.testGetConfig(); } @Test public void testGetNativeConnection() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testGetNativeConnection(); } @@ -292,15 +278,13 @@ public void testHDel() { @Test public void testHExistsBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testHExistsBytes(); } @Test public void testHExists() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testHExists(); } @@ -320,15 +304,13 @@ public void testHGet() { @Test public void testHGetAllBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesMap))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesMap))).when(nativeConnection).closePipeline(); super.testHGetAllBytes(); } @Test public void testHGetAll() { - doReturn(Collections.singletonList(Collections.singletonList(bytesMap))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesMap))).when(nativeConnection).closePipeline(); super.testHGetAll(); } @@ -358,15 +340,13 @@ public void testHIncrByDouble() { @Test public void testHKeysBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testHKeysBytes(); } @Test public void testHKeys() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testHKeys(); } @@ -384,57 +364,49 @@ public void testHLen() { @Test public void testHMGetBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testHMGetBytes(); } @Test public void testHMGet() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testHMGet(); } @Test public void testHSetBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testHSetBytes(); } @Test public void testHSet() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testHSet(); } @Test public void testHSetNXBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testHSetNXBytes(); } @Test public void testHSetNX() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testHSetNX(); } @Test public void testHValsBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testHValsBytes(); } @Test public void testHVals() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testHVals(); } @@ -478,8 +450,7 @@ public void testIncrByDouble() { public void testInfo() { Properties props = new Properties(); props.put("foo", "bar"); - doReturn(Collections.singletonList(Collections.singletonList(props))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(props))).when(nativeConnection).closePipeline(); super.testInfo(); } @@ -487,22 +458,19 @@ public void testInfo() { public void testInfoBySection() { Properties props = new Properties(); props.put("foo", "bar"); - doReturn(Collections.singletonList(Collections.singletonList(props))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(props))).when(nativeConnection).closePipeline(); super.testInfoBySection(); } @Test public void testKeysBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testKeysBytes(); } @Test public void testKeys() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testKeys(); } @@ -602,15 +570,13 @@ public void testLPushX() { @Test public void testLRangeBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testLRangeBytes(); } @Test public void testLRange() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testLRange(); } @@ -628,64 +594,55 @@ public void testLRem() { @Test public void testMGetBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testMGetBytes(); } @Test public void testMGet() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testMGet(); } @Test public void testMSetNXBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testMSetNXBytes(); } @Test public void testMSetNXString() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testMSetNXString(); } @Test public void testPersistBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testPersistBytes(); } @Test public void testPersist() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testPersist(); } @Test public void testMoveBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testMoveBytes(); } @Test public void testMove() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testMove(); } @Test public void testPing() { - doReturn(Collections.singletonList(Collections.singletonList("pong"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("pong"))).when(nativeConnection).closePipeline(); super.testPing(); } @@ -710,15 +667,13 @@ public void testRandomKey() { @Test public void testRenameNXBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testRenameNXBytes(); } @Test public void testRenameNX() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testRenameNX(); } @@ -812,15 +767,13 @@ public void testSCard() { @Test public void testSDiffBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSDiffBytes(); } @Test public void testSDiff() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSDiff(); } @@ -838,29 +791,25 @@ public void testSDiffStore() { @Test public void testSetNXBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testSetNXBytes(); } @Test public void testSetNX() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testSetNX(); } @Test public void testSInterBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSInterBytes(); } @Test public void testSInter() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSInter(); } @@ -878,43 +827,37 @@ public void testSInterStore() { @Test public void testSIsMemberBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testSIsMemberBytes(); } @Test public void testSIsMember() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testSIsMember(); } @Test public void testSMembersBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSMembersBytes(); } @Test public void testSMembers() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSMembers(); } @Test public void testSMoveBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testSMoveBytes(); } @Test public void testSMove() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testSMove(); } @@ -932,15 +875,13 @@ public void testSortStore() { @Test public void testSortBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testSortBytes(); } @Test public void testSort() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testSort(); } @@ -974,15 +915,13 @@ public void testSRandMember() { @Test public void testSRandMemberCountBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testSRandMemberCountBytes(); } @Test public void testSRandMemberCount() { - doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesList))).when(nativeConnection).closePipeline(); super.testSRandMemberCount(); } @@ -1048,15 +987,13 @@ public void testBitOp() { @Test public void testSUnionBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSUnionBytes(); } @Test public void testSUnion() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testSUnion(); } @@ -1109,15 +1046,13 @@ public void testType() { @Test public void testZAddBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testZAddBytes(); } @Test public void testZAdd() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testZAdd(); } @@ -1195,141 +1130,121 @@ public void testZInterStore() { @Test public void testZRangeBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRangeBytes(); } @Test public void testZRange() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRange(); } @Test public void testZRangeByScoreOffsetCountBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRangeByScoreOffsetCountBytes(); } @Test public void testZRangeByScoreOffsetCount() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRangeByScoreOffsetCount(); } @Test public void testZRangeByScoreBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRangeByScoreBytes(); } @Test public void testZRangeByScore() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRangeByScore(); } @Test public void testZRangeByScoreWithScoresOffsetCountBytes() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRangeByScoreWithScoresOffsetCountBytes(); } @Test public void testZRangeByScoreWithScoresOffsetCount() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRangeByScoreWithScoresOffsetCount(); } @Test public void testZRangeByScoreWithScoresBytes() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRangeByScoreWithScoresBytes(); } @Test public void testZRangeByScoreWithScores() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRangeByScoreWithScores(); } @Test public void testZRangeWithScoresBytes() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRangeWithScoresBytes(); } @Test public void testZRangeWithScores() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRangeWithScores(); } @Test public void testZRevRangeByScoreOffsetCountBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScoreOffsetCountBytes(); } @Test public void testZRevRangeByScoreOffsetCount() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScoreOffsetCount(); } @Test public void testZRevRangeByScoreBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScoreBytes(); } @Test public void testZRevRangeByScore() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScore(); } @Test public void testZRevRangeByScoreWithScoresOffsetCountBytes() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScoreWithScoresOffsetCountBytes(); } @Test public void testZRevRangeByScoreWithScoresOffsetCount() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScoreWithScoresOffsetCount(); } @Test public void testZRevRangeByScoreWithScoresBytes() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScoreWithScoresBytes(); } @Test public void testZRevRangeByScoreWithScores() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRevRangeByScoreWithScores(); } @@ -1383,29 +1298,25 @@ public void testZRemRangeByScore() { @Test public void testZRevRangeBytes() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRevRangeBytes(); } @Test public void testZRevRange() { - doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(bytesSet))).when(nativeConnection).closePipeline(); super.testZRevRange(); } @Test public void testZRevRangeWithScoresBytes() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRevRangeWithScoresBytes(); } @Test public void testZRevRangeWithScores() { - doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(tupleSet))).when(nativeConnection).closePipeline(); super.testZRevRangeWithScores(); } @@ -1467,29 +1378,25 @@ public void testZUnionStore() { @Test public void testPExpireBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testPExpireBytes(); } @Test public void testPExpire() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testPExpire(); } @Test public void testPExpireAtBytes() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testPExpireAtBytes(); } @Test public void testPExpireAt() { - doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(true))).when(nativeConnection).closePipeline(); super.testPExpireAt(); } @@ -1514,72 +1421,62 @@ public void testDump() { @Test public void testScriptLoadBytes() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testScriptLoadBytes(); } @Test public void testScriptLoad() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testScriptLoad(); } @Test public void testScriptExists() { List results = Collections.singletonList(true); - doReturn(Collections.singletonList(Collections.singletonList(results))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList(results))).when(nativeConnection).closePipeline(); super.testScriptExists(); } @Test public void testEvalBytes() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testEvalBytes(); } @Test public void testEval() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testEval(); } @Test public void testEvalShaBytes() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testEvalShaBytes(); } @Test public void testEvalSha() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testEvalSha(); } @Test public void testExecute() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testExecute(); } @Test public void testExecuteByteArgs() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testExecuteByteArgs(); } @Test public void testExecuteStringArgs() { - doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Collections.singletonList("foo"))).when(nativeConnection).closePipeline(); super.testExecuteStringArgs(); } @@ -1588,8 +1485,7 @@ public void testTxResultsNotSameSizeAsResults() { // Only call one method, but return 2 results from nativeConnection.exec() // Emulates scenario where user has called some methods directly on the native connection // while tx is open - doReturn(Collections.singletonList(Arrays.asList(barBytes, 3L))).when(nativeConnection) - .closePipeline(); + doReturn(Collections.singletonList(Arrays.asList(barBytes, 3L))).when(nativeConnection).closePipeline(); doReturn(barBytes).when(nativeConnection).get(fooBytes); connection.get(foo); verifyResults(Arrays.asList(barBytes, 3L)); @@ -1597,16 +1493,14 @@ public void testTxResultsNotSameSizeAsResults() { @Test void testTwoTxs() { - doReturn(Arrays - .asList(Arrays.asList(new Object[] { barBytes }), Arrays.asList(new Object[] { fooBytes }))) - .when(nativeConnection).closePipeline(); + doReturn(Arrays.asList(Arrays.asList(new Object[] { barBytes }), Arrays.asList(new Object[] { fooBytes }))) + .when(nativeConnection).closePipeline(); connection.get(foo); connection.exec(); connection.get(bar); connection.exec(); List results = connection.closePipeline(); - assertThat(results).isEqualTo( - Arrays.asList(Collections.singletonList(bar), Collections.singletonList(foo))); + assertThat(results).isEqualTo(Arrays.asList(Collections.singletonList(bar), Collections.singletonList(foo))); } @Test // DATAREDIS-438 @@ -1669,8 +1563,7 @@ public void testGeoAddWithIterableOfGeoLocation() { public void testGeoDistBytes() { doReturn(Collections.singletonList(Collections.singletonList(new Distance(102121.12d, DistanceUnit.METERS)))) - .when(nativeConnection) - .closePipeline(); + .when(nativeConnection).closePipeline(); super.testGeoDistBytes(); } @@ -1678,8 +1571,7 @@ public void testGeoDistBytes() { public void testGeoDist() { doReturn(Collections.singletonList(Collections.singletonList(new Distance(102121.12d, DistanceUnit.METERS)))) - .when(nativeConnection) - .closePipeline(); + .when(nativeConnection).closePipeline(); super.testGeoDist(); } @@ -1852,7 +1744,7 @@ public void xRangeShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap))))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xRangeShouldDelegateAndConvertCorrectly(); } @@ -1861,7 +1753,7 @@ public void xReadShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap))))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xReadShouldDelegateAndConvertCorrectly(); } @@ -1870,7 +1762,7 @@ public void xReadGroupShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap))))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xReadGroupShouldDelegateAndConvertCorrectly(); } @@ -1879,7 +1771,7 @@ public void xRevRangeShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap))))) - .when(nativeConnection).closePipeline(); + .when(nativeConnection).closePipeline(); super.xRevRangeShouldDelegateAndConvertCorrectly(); } diff --git a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.java b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.java index 3441a8f581..9347edfec8 100644 --- a/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.java +++ b/src/test/java/org/springframework/data/redis/connection/DefaultStringRedisConnectionTxTests.java @@ -1732,7 +1732,7 @@ public void xRangeShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).exec(); + .when(nativeConnection).exec(); super.xRangeShouldDelegateAndConvertCorrectly(); } @@ -1741,7 +1741,7 @@ public void xReadShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).exec(); + .when(nativeConnection).exec(); super.xReadShouldDelegateAndConvertCorrectly(); } @@ -1750,7 +1750,7 @@ public void xReadGroupShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).exec(); + .when(nativeConnection).exec(); super.xReadGroupShouldDelegateAndConvertCorrectly(); } @@ -1759,7 +1759,7 @@ public void xRevRangeShouldDelegateAndConvertCorrectly() { doReturn(Collections.singletonList( Collections.singletonList(StreamRecords.newRecord().in(bar2Bytes).withId("stream-1").ofBytes(bytesMap)))) - .when(nativeConnection).exec(); + .when(nativeConnection).exec(); super.xRevRangeShouldDelegateAndConvertCorrectly(); } diff --git a/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.java index 034a06f38c..f668955a1a 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisClusterNodeSlotRangeUnitTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.connection; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.util.Arrays; import java.util.List; @@ -39,8 +39,7 @@ public void containsFromLowerToUpperBoundSlotsOnly() { RedisClusterNode.SlotRange slotRange = new RedisClusterNode.SlotRange(25, 75); - IntStream.range(0, 100).forEach(slot -> - assertThat(slotRange.contains(slot)).isEqualTo(slot >= 25 && slot <= 75)); + IntStream.range(0, 100).forEach(slot -> assertThat(slotRange.contains(slot)).isEqualTo(slot >= 25 && slot <= 75)); } @Test // GH-2525 @@ -50,8 +49,7 @@ public void containsSpecificSlots() { RedisClusterNode.SlotRange slotRange = new RedisClusterNode.SlotRange(slots); - IntStream.range(0, 100).forEach(slot -> - assertThat(slotRange.contains(slot)).isEqualTo(slots.contains(slot))); + IntStream.range(0, 100).forEach(slot -> assertThat(slotRange.contains(slot)).isEqualTo(slots.contains(slot))); } @Test // GH-2525 @@ -67,26 +65,23 @@ public void emptySlotRange() { @Test // GH-2525 public void slotRangeSlotsAreCorrect() { - assertThat(new RedisClusterNode.SlotRange(4, 6).getSlots()) - .containsExactlyInAnyOrder(4, 5, 6); + assertThat(new RedisClusterNode.SlotRange(4, 6).getSlots()).containsExactlyInAnyOrder(4, 5, 6); - assertThat(new RedisClusterNode.SlotRange(Arrays.asList(1, 2, 3, 5, 7)).getSlots()) - .containsExactlyInAnyOrder(1, 2, 3, 5, 7); + assertThat(new RedisClusterNode.SlotRange(Arrays.asList(1, 2, 3, 5, 7)).getSlots()).containsExactlyInAnyOrder(1, 2, + 3, 5, 7); } @Test // GH-2525 public void slotRangeSlotsArrayIsCorrectIsCorrect() { - assertThat(new RedisClusterNode.SlotRange(4, 6).getSlotsArray()) - .containsExactly(4, 5, 6); + assertThat(new RedisClusterNode.SlotRange(4, 6).getSlotsArray()).containsExactly(4, 5, 6); - assertThat(new RedisClusterNode.SlotRange(Arrays.asList(1, 2, 3, 5, 7)).getSlotsArray()) - .containsExactly(1, 2, 3, 5, 7); + assertThat(new RedisClusterNode.SlotRange(Arrays.asList(1, 2, 3, 5, 7)).getSlotsArray()).containsExactly(1, 2, 3, 5, + 7); } @Test // GH-2525 public void toStringListsSlots() { - assertThat(new RedisClusterNode.SlotRange(List.of(1, 2, 4, 8, 16, 32, 64))) - .hasToString("[1, 2, 4, 8, 16, 32, 64]"); + assertThat(new RedisClusterNode.SlotRange(List.of(1, 2, 4, 8, 16, 32, 64))).hasToString("[1, 2, 4, 8, 16, 32, 64]"); } } diff --git a/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.java index 8d64a7bbbf..97f0bb4433 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisElastiCacheConfigurationUnitTests.java @@ -61,7 +61,8 @@ void shouldCreateMultiHostConfiguration() { @Test // DATAREDIS-762 void shouldApplyPasswordToNodes() { - RedisStaticMasterReplicaConfiguration multiHost = new RedisStaticMasterReplicaConfiguration("localhost").node("other-host", 6479); + RedisStaticMasterReplicaConfiguration multiHost = new RedisStaticMasterReplicaConfiguration("localhost") + .node("other-host", 6479); multiHost.setPassword(RedisPassword.of("foobar")); multiHost.node("third", 1234); @@ -73,7 +74,8 @@ void shouldApplyPasswordToNodes() { @Test // DATAREDIS-762 void shouldApplyDatabaseToNodes() { - RedisStaticMasterReplicaConfiguration multiHost = new RedisStaticMasterReplicaConfiguration("localhost").node("other-host", 6479); + RedisStaticMasterReplicaConfiguration multiHost = new RedisStaticMasterReplicaConfiguration("localhost") + .node("other-host", 6479); multiHost.setDatabase(4); multiHost.node("third", 1234); diff --git a/src/test/java/org/springframework/data/redis/connection/RedisNodeUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisNodeUnitTests.java index 0cef0df5ed..e06d1d2351 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisNodeUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisNodeUnitTests.java @@ -89,8 +89,7 @@ void shouldParseBareHostnameWithoutPort(String source) { @Test // GH-2928 void shouldThrowExceptionForInvalidPort() { - assertThatIllegalArgumentException() - .isThrownBy(() -> RedisNode.fromString("127.0.0.1:invalidPort")); + assertThatIllegalArgumentException().isThrownBy(() -> RedisNode.fromString("127.0.0.1:invalidPort")); } @Test // GH-2928 @@ -103,4 +102,3 @@ void shouldParseBareIPv6WithoutPort() { } } - diff --git a/src/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.java b/src/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.java index 78f8c7df6b..5873bd856a 100644 --- a/src/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/RedisPasswordUnitTests.java @@ -15,10 +15,9 @@ */ package org.springframework.data.redis.connection; -import org.junit.jupiter.api.Test; - import static org.assertj.core.api.Assertions.*; +import org.junit.jupiter.api.Test; /** * Unit tests for {@link RedisPassword}. diff --git a/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java index c121250d03..843f5cf98d 100644 --- a/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/StreamRecordsUnitTests.java @@ -163,8 +163,7 @@ static HashMapper simpleString(String value) { @Test // GH-3204 void ofBytesWithNullStreamKey() { - ByteRecord record = StreamRecords.newRecord() - .withId(RECORD_ID) + ByteRecord record = StreamRecords.newRecord().withId(RECORD_ID) .ofBytes(Collections.singletonMap(SERIALIZED_STRING_MAP_KEY, SERIALIZED_STRING_VAL)); assertThat(record.getId()).isEqualTo(RECORD_ID); diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.java index b4229d9522..48cacabd29 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisClusterConnectionTests.java @@ -16,7 +16,6 @@ package org.springframework.data.redis.connection.jedis; import static org.assertj.core.api.Assertions.*; -import static org.assertj.core.data.Offset.*; import static org.assertj.core.data.Offset.offset; import static org.springframework.data.redis.connection.BitFieldSubCommands.*; import static org.springframework.data.redis.connection.BitFieldSubCommands.BitFieldIncrBy.Overflow.*; diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java index b4aae693c2..f2ed2c93af 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java @@ -75,8 +75,7 @@ public void tearDown() { try { connection.close(); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} connection = null; } @@ -338,8 +337,7 @@ void testPoolNPE() { try (RedisConnection conn = factory2.getConnection()) { conn.get(null); - } catch (Exception ignore) { - } finally { + } catch (Exception ignore) {} finally { // Make sure we don't end up with broken connection factory2.getConnection().dbSize(); factory2.destroy(); @@ -378,8 +376,8 @@ void testExecuteShouldConvertArrayReplyCorrectly() { assertThat( (Iterable) connection.execute("MGET", "spring".getBytes(), "data".getBytes(), "redis".getBytes())) - .isInstanceOf(List.class) - .contains("awesome".getBytes(), "cool".getBytes(), "supercalifragilisticexpialidocious".getBytes()); + .isInstanceOf(List.class) + .contains("awesome".getBytes(), "cool".getBytes(), "supercalifragilisticexpialidocious".getBytes()); } @Test // DATAREDIS-286, DATAREDIS-564 @@ -404,8 +402,8 @@ void pExpireShouldSupportExiprationForValuesLargerThanInteger() { long ttl = connection.pTtl("pexpireKey"); assertThat(millis - ttl < 20L) - .describedAs("difference between millis=%s and ttl=%s should not be greater than 20ms but is %s", - millis, ttl, millis - ttl) + .describedAs("difference between millis=%s and ttl=%s should not be greater than 20ms but is %s", millis, ttl, + millis - ttl) .isTrue(); } diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java index 7e08465475..81819966b1 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java @@ -59,41 +59,36 @@ public void testGetConfig() {} @Test public void testEvalShaNotFound() { - assertThatExceptionOfType(InvalidDataAccessApiUsageException.class) - .isThrownBy(() -> { - connection.evalSha("somefakesha", ReturnType.VALUE, 2, "key1", "key2"); - getResults(); - }); + assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> { + connection.evalSha("somefakesha", ReturnType.VALUE, 2, "key1", "key2"); + getResults(); + }); } @Test public void testEvalShaArrayError() { - assertThatExceptionOfType(InvalidDataAccessApiUsageException.class) - .isThrownBy(() -> { - connection.evalSha("notasha", ReturnType.MULTI, 1, "key1", "arg1"); - getResults(); - }); + assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> { + connection.evalSha("notasha", ReturnType.MULTI, 1, "key1", "arg1"); + getResults(); + }); } @Test public void testEvalArrayScriptError() { - assertThatExceptionOfType(InvalidDataAccessApiUsageException.class) - .isThrownBy(() -> { - connection.eval("return {1,2", ReturnType.MULTI, 1, "foo", "bar"); - getResults(); - }); + assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> { + connection.eval("return {1,2", ReturnType.MULTI, 1, "foo", "bar"); + getResults(); + }); } @Test public void testEvalReturnSingleError() { - assertThatExceptionOfType(InvalidDataAccessApiUsageException.class) - .isThrownBy(()-> { - connection.eval("return redis.call('expire','foo')", ReturnType.BOOLEAN, 0); - getResults(); - }); + assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> { + connection.eval("return redis.call('expire','foo')", ReturnType.BOOLEAN, 0); + getResults(); + }); } - // Unsupported Ops @Test @Disabled diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java index 348576b710..240725da2d 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionUnitTests.java @@ -68,8 +68,7 @@ void shutdownWithNullShouldDelegateCommandCorrectly() { try { connection.shutdown(null); - } catch (InvalidDataAccessApiUsageException ignore) { - } + } catch (InvalidDataAccessApiUsageException ignore) {} verify(jedisSpy).shutdown(); } @@ -267,8 +266,8 @@ void zScanShouldOperateUponUnsigned64BitCursorId() { String cursorId = "9286422431637962824"; ArgumentCaptor captor = ArgumentCaptor.forClass(byte[].class); - doReturn(new ScanResult<>(cursorId, List.of(new redis.clients.jedis.resps.Tuple("spring", 1D)))).when(jedisSpy).zscan(any(byte[].class), - any(byte[].class), any(ScanParams.class)); + doReturn(new ScanResult<>(cursorId, List.of(new redis.clients.jedis.resps.Tuple("spring", 1D)))).when(jedisSpy) + .zscan(any(byte[].class), any(byte[].class), any(ScanParams.class)); Cursor cursor = connection.zSetCommands().zScan("spring".getBytes(), ScanOptions.NONE); cursor.next(); // initial value @@ -307,8 +306,8 @@ void hScanShouldOperateUponUnsigned64BitCursorId() { String cursorId = "9286422431637962824"; ArgumentCaptor captor = ArgumentCaptor.forClass(byte[].class); - doReturn(new ScanResult<>(cursorId, List.of(Map.entry("spring".getBytes(), "data".getBytes())))).when(jedisSpy).hscan(any(byte[].class), - any(byte[].class), any(ScanParams.class)); + doReturn(new ScanResult<>(cursorId, List.of(Map.entry("spring".getBytes(), "data".getBytes())))).when(jedisSpy) + .hscan(any(byte[].class), any(byte[].class), any(ScanParams.class)); Cursor> cursor = connection.hashCommands().hScan("spring".getBytes(), ScanOptions.NONE); cursor.next(); // initial value diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java index 5a869da105..52f213b510 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConvertersUnitTests.java @@ -16,13 +16,8 @@ package org.springframework.data.redis.connection.jedis; import static org.assertj.core.api.Assertions.*; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import redis.clients.jedis.Protocol; import redis.clients.jedis.params.GetExParams; @@ -201,7 +196,7 @@ void boundaryToBytesForZRangeByShouldReturnValueCorrectlyWhenBoundaryIsANumber() assertThat( JedisConverters.boundaryToBytesForZRange(org.springframework.data.domain.Range.Bound.exclusive(1L), null)) - .isEqualTo(JedisConverters.toBytes("(1")); + .isEqualTo(JedisConverters.toBytes("(1")); } @Test // DATAREDIS-352 diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java index 5590b18275..00120ac606 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnectionTests.java @@ -16,7 +16,6 @@ package org.springframework.data.redis.connection.lettuce; import static org.assertj.core.api.Assertions.*; -import static org.assertj.core.data.Offset.*; import static org.assertj.core.data.Offset.offset; import static org.springframework.data.redis.connection.BitFieldSubCommands.*; import static org.springframework.data.redis.connection.BitFieldSubCommands.BitFieldIncrBy.Overflow.*; diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.java index 0c2d1d65e2..ab51eaba9a 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactoryTests.java @@ -274,8 +274,7 @@ void testGetConnectionException() { try { factory.getConnection(); fail("Expected connection failure exception"); - } catch (RedisConnectionFailureException expected) { - } + } catch (RedisConnectionFailureException expected) {} } @Test diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java index afe2108296..1bb675b9e9 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java @@ -115,8 +115,7 @@ void testCloseBlockingOps() { // can't do blocking ops after closing connection.bLPop(1, "what".getBytes()); fail("Expected exception using a closed conn for dedicated ops"); - } catch (RedisSystemException expected) { - } + } catch (RedisSystemException expected) {} } @Test @@ -135,10 +134,9 @@ void testCloseNonPooledConnectionNotShared() { try { connection.set("foo".getBytes(), "bar".getBytes()); fail("Exception should be thrown trying to use a closed connection"); - } catch (RedisSystemException expected) { - } finally { + } catch (RedisSystemException expected) {} finally { - factory2.destroy(); + factory2.destroy(); } } @@ -181,8 +179,8 @@ void testExecuteShouldConvertArrayReplyCorrectly() { assertThat( (Iterable) connection.execute("MGET", "spring".getBytes(), "data".getBytes(), "redis".getBytes())) - .isInstanceOf(List.class) - .contains("awesome".getBytes(), "cool".getBytes(), "supercalifragilisticexpialidocious".getBytes()); + .isInstanceOf(List.class) + .contains("awesome".getBytes(), "cool".getBytes(), "supercalifragilisticexpialidocious".getBytes()); } @Test // GH-2473 diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.java index 2d965cbfdf..63afb6791c 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineTxIntegrationTests.java @@ -32,33 +32,27 @@ class LettuceConnectionPipelineTxIntegrationTests extends LettuceConnectionTrans @Test @Disabled("Different exception") - public void testEvalShaNotFound() { - } + public void testEvalShaNotFound() {} @Test @Disabled("Different exception") - public void testEvalReturnSingleError() { - } + public void testEvalReturnSingleError() {} @Test @Disabled("Different exception") - public void testRestoreBadData() { - } + public void testRestoreBadData() {} @Test @Disabled("Different exception") - public void testRestoreExistingKey() { - } + public void testRestoreExistingKey() {} @Test @Disabled("Different exception") - public void testEvalArrayScriptError() { - } + public void testEvalArrayScriptError() {} @Test @Disabled("Different exception") - public void testEvalShaArrayError() { - } + public void testEvalShaArrayError() {} protected void initConnection() { connection.openPipeline(); diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java index 0ba0123eac..2ed70d0bae 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionUnitTests.java @@ -15,30 +15,10 @@ */ package org.springframework.data.redis.connection.lettuce; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyMap; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; - -import io.lettuce.core.KeyScanCursor; -import io.lettuce.core.MapScanCursor; -import io.lettuce.core.RedisClient; -import io.lettuce.core.RedisFuture; -import io.lettuce.core.ScanArgs; -import io.lettuce.core.ScanCursor; -import io.lettuce.core.ScoredValue; -import io.lettuce.core.ScoredValueScanCursor; -import io.lettuce.core.ValueScanCursor; -import io.lettuce.core.XAddArgs; -import io.lettuce.core.XClaimArgs; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; + +import io.lettuce.core.*; import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.async.RedisAsyncCommands; import io.lettuce.core.api.sync.RedisCommands; @@ -66,6 +46,7 @@ import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; + import org.springframework.dao.InvalidDataAccessResourceUsageException; import org.springframework.data.redis.connection.AbstractConnectionUnitTestBase; import org.springframework.data.redis.connection.RedisServerCommands.ShutdownOption; diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java index 74cb969dc6..164c269e25 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConvertersUnitTests.java @@ -263,10 +263,8 @@ void sentinelConfigurationWithAuth() { RedisPassword dataPassword = RedisPassword.of("data-secret"); RedisPassword sentinelPassword = RedisPassword.of("sentinel-secret"); - RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration() - .master(MASTER_NAME) - .sentinel("127.0.0.1", 26379) - .sentinel("127.0.0.1", 26380); + RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration().master(MASTER_NAME) + .sentinel("127.0.0.1", 26379).sentinel("127.0.0.1", 26380); sentinelConfiguration.setUsername("app"); sentinelConfiguration.setPassword(dataPassword); @@ -289,10 +287,8 @@ void sentinelConfigurationSetSentinelPasswordIfUsernameNotPresent() { RedisPassword password = RedisPassword.of("88888888-8x8-getting-creative-now"); - RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration() - .master(MASTER_NAME) - .sentinel("127.0.0.1", 26379) - .sentinel("127.0.0.1", 26380); + RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration().master(MASTER_NAME) + .sentinel("127.0.0.1", 26379).sentinel("127.0.0.1", 26380); sentinelConfiguration.setUsername("app"); sentinelConfiguration.setPassword(password); sentinelConfiguration.setSentinelPassword(password); @@ -302,7 +298,7 @@ void sentinelConfigurationSetSentinelPasswordIfUsernameNotPresent() { assertThat(redisURI.getUsername()).isEqualTo("app"); redisURI.getSentinels().forEach(sentinel -> { - assertThat(sentinel.getUsername()).isNull(); + assertThat(sentinel.getUsername()).isNull(); assertThat(sentinel.getPassword()).isNotNull(); }); } @@ -312,10 +308,8 @@ void sentinelConfigurationShouldNotSetSentinelAuthIfUsernameIsPresentWithNoPassw RedisPassword password = RedisPassword.of("88888888-8x8-getting-creative-now"); - RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration() - .master(MASTER_NAME) - .sentinel("127.0.0.1", 26379) - .sentinel("127.0.0.1", 26380); + RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration().master(MASTER_NAME) + .sentinel("127.0.0.1", 26379).sentinel("127.0.0.1", 26380); sentinelConfiguration.setUsername("app"); sentinelConfiguration.setPassword(password); sentinelConfiguration.setSentinelUsername("admin"); diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java index 70c1932b3e..c1fefefd4d 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommandsIntegrationTests.java @@ -45,7 +45,7 @@ void pfMergeShouldWorkCorrectlyWhenKeysMapToSameSlot() { assertThat(connection.hyperLogLogCommands() .pfMerge(SAME_SLOT_KEY_3_BBUFFER, Arrays.asList(SAME_SLOT_KEY_1_BBUFFER, SAME_SLOT_KEY_2_BBUFFER)).block()) - .isTrue(); + .isTrue(); assertThat(nativeCommands.pfcount(new String[] { SAME_SLOT_KEY_3 })).isEqualTo(3L); } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.java index 3407fea953..8c5f99be72 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveCommandsTestSupport.java @@ -211,8 +211,7 @@ public void tearDown() { } if (nativeBinaryCommands instanceof RedisAdvancedClusterCommands redisAdvancedClusterCommands) { - nativeBinaryConnectionProvider - .release((redisAdvancedClusterCommands).getStatefulConnection()); + nativeBinaryConnectionProvider.release((redisAdvancedClusterCommands).getStatefulConnection()); } } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java index 5f3d43e2b8..8b3c63d83f 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommandsIntegrationTests.java @@ -100,7 +100,7 @@ void geoHash() { assertThat( connection.geoCommands().geoHash(KEY_1_BBUFFER, Arrays.asList(PALERMO.getName(), CATANIA.getName())).block()) - .containsExactly("sqc8b49rny0", "sqdtr74hyu0"); + .containsExactly("sqc8b49rny0", "sqdtr74hyu0"); } @ParameterizedRedisTest // DATAREDIS-525 @@ -111,7 +111,7 @@ void geoHashNotExisting() { assertThat(connection.geoCommands() .geoHash(KEY_1_BBUFFER, Arrays.asList(PALERMO.getName(), ARIGENTO.getName(), CATANIA.getName())).block()) - .containsExactly("sqc8b49rny0", null, "sqdtr74hyu0"); + .containsExactly("sqc8b49rny0", null, "sqdtr74hyu0"); } @ParameterizedRedisTest // DATAREDIS-525 diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java index bc1f8cc204..191899268e 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommandsIntegrationTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.connection.lettuce; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import reactor.test.StepVerifier; diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java index 2b33e87a38..916def2e98 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommandsTests.java @@ -81,7 +81,7 @@ void pfMergeShouldWorkCorrectly() { assertThat( connection.hyperLogLogCommands().pfMerge(KEY_3_BBUFFER, Arrays.asList(KEY_1_BBUFFER, KEY_2_BBUFFER)).block()) - .isTrue(); + .isTrue(); assertThat(nativeCommands.pfcount(KEY_3)).isEqualTo(3L); } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java index b09aa7fe5c..a136501fcc 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandIntegrationTests.java @@ -187,7 +187,7 @@ void lInsertShouldAddValueCorrectlyBeforeExisting() { assertThat( connection.listCommands().lInsert(KEY_1_BBUFFER, Position.BEFORE, VALUE_2_BBUFFER, VALUE_3_BBUFFER).block()) - .isEqualTo(3L); + .isEqualTo(3L); assertThat(nativeCommands.lrange(KEY_1, 0, -1)).containsExactly(VALUE_1, VALUE_3, VALUE_2); } @@ -198,7 +198,7 @@ void lInsertShouldAddValueCorrectlyAfterExisting() { assertThat( connection.listCommands().lInsert(KEY_1_BBUFFER, Position.AFTER, VALUE_2_BBUFFER, VALUE_3_BBUFFER).block()) - .isEqualTo(3L); + .isEqualTo(3L); assertThat(nativeCommands.lrange(KEY_1, 0, -1)).containsExactly(VALUE_1, VALUE_2, VALUE_3); } @@ -280,7 +280,8 @@ void lPopSouldRemoveFirstValueCorrectly() { assertThat(connection.listCommands().lPop(KEY_1_BBUFFER).block()).isEqualTo(VALUE_1_BBUFFER); assertThat(nativeCommands.lrange(KEY_1, 0, -1)).containsExactly(VALUE_2, VALUE_3); - assertThat(connection.listCommands().lPop(KEY_1_BBUFFER, 2).collectList().block()).isEqualTo(Arrays.asList(VALUE_2_BBUFFER, VALUE_3_BBUFFER)); + assertThat(connection.listCommands().lPop(KEY_1_BBUFFER, 2).collectList().block()) + .isEqualTo(Arrays.asList(VALUE_2_BBUFFER, VALUE_3_BBUFFER)); assertThat(nativeCommands.lrange(KEY_1, 0, -1)).isEmpty(); } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.java index af050574b9..73e9216142 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnectionUnitTests.java @@ -66,7 +66,8 @@ public class LettuceReactiveRedisClusterConnectionUnitTests { public void before() { when(connectionProvider.getConnectionAsync(any())).thenReturn(CompletableFuture.completedFuture(sharedConnection)); - when(sharedConnection.getConnectionAsync(anyString(), anyInt())).thenReturn(CompletableFuture.completedFuture(nodeConnection)); + when(sharedConnection.getConnectionAsync(anyString(), anyInt())) + .thenReturn(CompletableFuture.completedFuture(nodeConnection)); when(nodeConnection.reactive()).thenReturn(reactiveNodeCommands); } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java index ce6a8ebefe..44fa8b424d 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java @@ -221,13 +221,11 @@ void setConfigShouldRespondCorrectly() { connection.serverCommands().setConfig("notify-keyspace-events", "") // .as(StepVerifier::create) // - .expectNext("OK") - .verifyComplete(); + .expectNext("OK").verifyComplete(); connection.serverCommands().setConfig("notify-keyspace-events", "KEA") // .as(StepVerifier::create) // - .expectNext("OK") - .verifyComplete(); + .expectNext("OK").verifyComplete(); } } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.java index b181ef6a60..e7ed4e680d 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommandsIntegrationTests.java @@ -500,8 +500,8 @@ void xClaimJustId() { StreamOffset.create(KEY_1_BBUFFER, ReadOffset.lastConsumed())) // .delayElements(Duration.ofMillis(5)).next() // .flatMapMany(record -> connection.streamCommands().xClaimJustId(KEY_1_BBUFFER, "my-group", "my-consumer", - XClaimOptions.minIdle(Duration.ofMillis(1)).ids(record.getId())) - ).as(StepVerifier::create) // + XClaimOptions.minIdle(Duration.ofMillis(1)).ids(record.getId()))) + .as(StepVerifier::create) // .assertNext(it -> assertThat(it.getValue()).isEqualTo(expected)) // .verifyComplete(); } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java index 530ec229b9..dedb1fa33b 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsIntegrationTests.java @@ -417,28 +417,24 @@ void bitCountShouldCountInRangeCorrectly() { void bitFieldSetShouldWorkCorrectly() { connection.stringCommands().bitField(KEY_1_BBUFFER, create().set(INT_8).valueAt(offset(0L)).to(10L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(0L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(0L)).verifyComplete(); connection.stringCommands().bitField(KEY_1_BBUFFER, create().set(INT_8).valueAt(offset(0L)).to(20L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(10L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(10L)).verifyComplete(); } @ParameterizedRedisTest // DATAREDIS-562 void bitFieldGetShouldWorkCorrectly() { connection.stringCommands().bitField(KEY_1_BBUFFER, create().get(INT_8).valueAt(offset(0L))) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(0L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(0L)).verifyComplete(); } @ParameterizedRedisTest // DATAREDIS-562 void bitFieldIncrByShouldWorkCorrectly() { connection.stringCommands().bitField(KEY_1_BBUFFER, create().incr(INT_8).valueAt(offset(100L)).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(1L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(1L)).verifyComplete(); } @ParameterizedRedisTest // DATAREDIS-562 @@ -446,20 +442,16 @@ void bitFieldIncrByWithOverflowShouldWorkCorrectly() { connection.stringCommands() .bitField(KEY_1_BBUFFER, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(1L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(1L)).verifyComplete(); connection.stringCommands() .bitField(KEY_1_BBUFFER, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(2L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(2L)).verifyComplete(); connection.stringCommands() .bitField(KEY_1_BBUFFER, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(3L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(3L)).verifyComplete(); connection.stringCommands() .bitField(KEY_1_BBUFFER, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(null)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(null)).verifyComplete(); } @ParameterizedRedisTest // DATAREDIS-562 @@ -467,8 +459,7 @@ void bitfieldShouldAllowMultipleSubcommands() { connection.stringCommands() .bitField(KEY_1_BBUFFER, create().incr(signed(5)).valueAt(offset(100L)).by(1L).get(unsigned(4)).valueAt(0L)) - .as(StepVerifier::create) - .expectNext(Arrays.asList(1L, 0L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Arrays.asList(1L, 0L)).verifyComplete(); } @ParameterizedRedisTest // DATAREDIS-525 @@ -538,8 +529,7 @@ void bitPosShouldReturnPositionInRangeCorrectly() { nativeBinaryCommands.set(KEY_1_BBUFFER, ByteBuffer.wrap(HexStringUtils.hexToBytes("fff0f0"))); connection.stringCommands().bitPos(KEY_1_BBUFFER, true, Range.of(Bound.inclusive(2L), Bound.unbounded())) - .as(StepVerifier::create) - .expectNext(16L).verifyComplete(); + .as(StepVerifier::create).expectNext(16L).verifyComplete(); } @ParameterizedRedisTest // DATAREDIS-1103 @@ -575,9 +565,10 @@ void setGetFlux() { nativeCommands.set(KEY_1, VALUE_1); - connection.stringCommands().setGet(Mono.just(SetCommand.set(KEY_1_BBUFFER).value(VALUE_2_BBUFFER).expiring(Expiration.keepTtl()).withSetOption( SetOption.upsert()))) - .map(CommandResponse::getOutput) - .as(StepVerifier::create) // + connection.stringCommands() + .setGet(Mono.just(SetCommand.set(KEY_1_BBUFFER).value(VALUE_2_BBUFFER).expiring(Expiration.keepTtl()) + .withSetOption(SetOption.upsert()))) + .map(CommandResponse::getOutput).as(StepVerifier::create) // .expectNext(VALUE_1_BBUFFER) // .verifyComplete(); diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java index 1dac69219b..ec7af2b089 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommandsIntegrationTests.java @@ -785,7 +785,7 @@ void zInterStoreShouldWorkCorrectly() { assertThat(connection.zSetCommands() .zInterStore(KEY_3_BBUFFER, Arrays.asList(KEY_1_BBUFFER, KEY_2_BBUFFER), Arrays.asList(2D, 3D)).block()) - .isEqualTo(2L); + .isEqualTo(2L); } @ParameterizedRedisTest // GH-2042 @@ -828,7 +828,7 @@ void zUnionStoreShouldWorkCorrectly() { assertThat(connection.zSetCommands() .zUnionStore(KEY_3_BBUFFER, Arrays.asList(KEY_1_BBUFFER, KEY_2_BBUFFER), Arrays.asList(2D, 3D)).block()) - .isEqualTo(3L); + .isEqualTo(3L); } @ParameterizedRedisTest // DATAREDIS-525 @@ -875,8 +875,8 @@ void zRevRangeByLex() { assertThat( connection.zSetCommands().zRevRangeByLex(KEY_1_BBUFFER, Range.rightOpen("aaa", "g")).collectList().block()) - .containsExactly(ByteBuffer.wrap("f".getBytes()), ByteBuffer.wrap("e".getBytes()), - ByteBuffer.wrap("d".getBytes()), ByteBuffer.wrap("c".getBytes()), ByteBuffer.wrap("b".getBytes())); + .containsExactly(ByteBuffer.wrap("f".getBytes()), ByteBuffer.wrap("e".getBytes()), + ByteBuffer.wrap("d".getBytes()), ByteBuffer.wrap("c".getBytes()), ByteBuffer.wrap("b".getBytes())); } } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java index cb57462908..f65240af43 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelIntegrationTests.java @@ -121,7 +121,7 @@ void shouldUseSpecifiedDatabase() { connectionFactory.afterPropertiesSet(); connectionFactory.start(); - try(RedisConnection directConnection = connectionFactory.getConnection()) { + try (RedisConnection directConnection = connectionFactory.getConnection()) { assertThat(directConnection.exists("foo".getBytes())).isFalse(); directConnection.select(0); @@ -131,7 +131,6 @@ void shouldUseSpecifiedDatabase() { connectionFactory.destroy(); } - } @Test // DATAREDIS-973 @@ -150,7 +149,7 @@ void reactiveShouldUseSpecifiedDatabase() { connectionFactory.afterPropertiesSet(); connectionFactory.start(); - try(LettuceReactiveRedisConnection reactiveConnection = connectionFactory.getReactiveConnection()) { + try (LettuceReactiveRedisConnection reactiveConnection = connectionFactory.getReactiveConnection()) { reactiveConnection.keyCommands().exists(ByteBuffer.wrap("foo".getBytes())) // .as(StepVerifier::create) // @@ -262,7 +261,7 @@ void factoryUsesMasterReplicaConnections() { factory.afterPropertiesSet(); factory.start(); - try(RedisConnection connection = factory.getConnection()) { + try (RedisConnection connection = factory.getConnection()) { assertThat(connection.ping()).isEqualTo("PONG"); assertThat(connection.info().getProperty("role")).isEqualTo("slave"); diff --git a/src/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.java b/src/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.java index 485b6b1414..0dcc46a386 100644 --- a/src/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.java +++ b/src/test/java/org/springframework/data/redis/core/AbstractOperationsTestParams.java @@ -29,7 +29,6 @@ import org.springframework.data.redis.StringObjectFactory; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.jedis.extension.JedisConnectionFactoryExtension; -import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.lettuce.extension.LettuceConnectionFactoryExtension; import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.GenericToStringSerializer; diff --git a/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java b/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java index c0796cd83b..224e677bbf 100644 --- a/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/ConnectionSplittingInterceptorUnitTests.java @@ -86,11 +86,10 @@ void interceptorShouldUseBoundConnectionForWriteOperations() throws Throwable { @Test // DATAREDIS-73 void interceptorShouldNotWrapException() { - when(freshConnectionMock.keys(any(byte[].class))).thenThrow( - InvalidDataAccessApiUsageException.class); + when(freshConnectionMock.keys(any(byte[].class))).thenThrow(InvalidDataAccessApiUsageException.class); - Assertions.assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy( - () -> interceptor.intercept(boundConnectionMock, READONLY_METHOD, new Object[] { new byte[] {} })); + Assertions.assertThatExceptionOfType(InvalidDataAccessApiUsageException.class) + .isThrownBy(() -> interceptor.intercept(boundConnectionMock, READONLY_METHOD, new Object[] { new byte[] {} })); } } diff --git a/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.java b/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.java index fb0e9a5515..47f424e64f 100644 --- a/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/ConvertingCursorUnitTests.java @@ -15,17 +15,9 @@ */ package org.springframework.data.redis.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; @@ -56,10 +48,8 @@ void constructConvertingCursorWithNullConverter() { Cursor mockCursor = mock(Cursor.class); - assertThatIllegalArgumentException() - .isThrownBy(() -> new ConvertingCursor<>(mockCursor, null)) - .withMessage("Converter must not be null") - .withNoCause(); + assertThatIllegalArgumentException().isThrownBy(() -> new ConvertingCursor<>(mockCursor, null)) + .withMessage("Converter must not be null").withNoCause(); verifyNoInteractions(mockCursor); } @@ -70,10 +60,8 @@ void constructConvertingCursorWithNullCursor() { Converter mockConverter = mock(Converter.class); - assertThatIllegalArgumentException() - .isThrownBy(() -> new ConvertingCursor<>(null, mockConverter)) - .withMessage("Cursor must not be null") - .withNoCause(); + assertThatIllegalArgumentException().isThrownBy(() -> new ConvertingCursor<>(null, mockConverter)) + .withMessage("Cursor must not be null").withNoCause(); verifyNoInteractions(mockConverter); } diff --git a/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java index 0000db4885..1dc5bc3ba8 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsIntegrationTests.java @@ -475,9 +475,8 @@ void geoSearchWithinShouldReturnMembers() { geoOperations.add(key, POINT_CATANIA, member2); geoOperations.add(key, POINT_ARIGENTO, member3); - GeoResults> result = geoOperations.search(key, - GeoReference.fromCoordinate(POINT_PALERMO), new Distance(150, KILOMETERS), - newGeoSearchArgs().includeCoordinates().sortAscending()); + GeoResults> result = geoOperations.search(key, GeoReference.fromCoordinate(POINT_PALERMO), + new Distance(150, KILOMETERS), newGeoSearchArgs().includeCoordinates().sortAscending()); assertThat(result.getContent()).hasSize(2); assertThat(result.getContent().get(0).getContent().getPoint().getX()).isCloseTo(POINT_PALERMO.getX(), offset(0.05)); @@ -507,8 +506,7 @@ void geoSearchByMemberShouldReturnResults() { geoOperations.add(key, POINT_ARIGENTO, member3); GeoResults> result = geoOperations.search(key, GeoReference.fromMember(member1), - new Distance(150, KILOMETERS), - newGeoSearchArgs().includeCoordinates().sortAscending()); + new Distance(150, KILOMETERS), newGeoSearchArgs().includeCoordinates().sortAscending()); assertThat(result.getContent()).hasSize(2); assertThat(result.getContent().get(0).getContent().getPoint().getX()).isCloseTo(POINT_PALERMO.getX(), offset(0.05)); @@ -537,10 +535,8 @@ void geoSearchByPointWithinBoundingBoxShouldReturnMembers() { geoOperations.add(key, POINT_CATANIA, member2); geoOperations.add(key, POINT_ARIGENTO, member3); - GeoResults> result = geoOperations.search(key, - GeoReference.fromCoordinate(POINT_PALERMO), - new BoundingBox(180, 180, KILOMETERS), - newGeoSearchArgs().includeCoordinates().sortAscending()); + GeoResults> result = geoOperations.search(key, GeoReference.fromCoordinate(POINT_PALERMO), + new BoundingBox(180, 180, KILOMETERS), newGeoSearchArgs().includeCoordinates().sortAscending()); assertThat(result.getContent()).hasSize(2); assertThat(result.getContent().get(0).getContent().getPoint().getX()).isCloseTo(POINT_PALERMO.getX(), offset(0.05)); @@ -570,8 +566,7 @@ void geoSearchByMemberWithinBoundingBoxShouldReturnMembers() { geoOperations.add(key, POINT_ARIGENTO, member3); GeoResults> result = geoOperations.search(key, GeoReference.fromMember(member1), - new BoundingBox(180, 180, KILOMETERS), - newGeoSearchArgs().includeCoordinates().sortAscending()); + new BoundingBox(180, 180, KILOMETERS), newGeoSearchArgs().includeCoordinates().sortAscending()); assertThat(result.getContent()).hasSize(2); assertThat(result.getContent().get(0).getContent().getPoint().getX()).isCloseTo(POINT_PALERMO.getX(), offset(0.05)); @@ -601,8 +596,8 @@ void geoSearchAndStoreWithinShouldReturnMembers() { geoOperations.add(key, POINT_CATANIA, member2); geoOperations.add(key, POINT_ARIGENTO, member3); - Long result = geoOperations.searchAndStore(key, destKey, - GeoReference.fromCoordinate(POINT_PALERMO), new Distance(150, KILOMETERS), + Long result = geoOperations.searchAndStore(key, destKey, GeoReference.fromCoordinate(POINT_PALERMO), + new Distance(150, KILOMETERS), RedisGeoCommands.GeoSearchStoreCommandArgs.newGeoSearchStoreArgs().sortAscending()); assertThat(result).isEqualTo(2); diff --git a/src/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.java index 795e1a16af..bb942c8710 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveGeoOperationsIntegrationTests.java @@ -20,7 +20,6 @@ import static org.springframework.data.redis.connection.RedisGeoCommands.DistanceUnit.*; import static org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusCommandArgs.*; -import org.springframework.data.redis.domain.geo.GeoReference; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; @@ -31,6 +30,7 @@ import java.util.Map; import org.junit.jupiter.api.BeforeEach; + import org.springframework.data.geo.Circle; import org.springframework.data.geo.Distance; import org.springframework.data.geo.Metrics; @@ -39,6 +39,7 @@ import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.ReactiveOperationsTestParams.Fixture; +import org.springframework.data.redis.domain.geo.GeoReference; import org.springframework.data.redis.domain.geo.GeoShape; import org.springframework.data.redis.test.condition.EnabledOnCommand; import org.springframework.data.redis.test.extension.parametrized.MethodSource; diff --git a/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.java index 7dfeb0266d..70a04366e6 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveValueOperationsIntegrationTests.java @@ -23,10 +23,8 @@ import static org.springframework.data.redis.connection.BitFieldSubCommands.BitFieldType.*; import static org.springframework.data.redis.connection.BitFieldSubCommands.Offset.offset; -import org.junit.jupiter.api.condition.DisabledOnOs; import reactor.test.StepVerifier; -import java.nio.ByteBuffer; import java.time.Duration; import java.util.Arrays; import java.util.Collection; @@ -35,6 +33,7 @@ import java.util.Map; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.condition.DisabledOnOs; import org.springframework.data.redis.ObjectFactory; import org.springframework.data.redis.connection.RedisConnection; @@ -406,17 +405,13 @@ void bitField() { K key = keyFactory.instance(); valueOperations.bitField(key, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(1L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(1L)).verifyComplete(); valueOperations.bitField(key, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(2L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(2L)).verifyComplete(); valueOperations.bitField(key, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(3L)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(3L)).verifyComplete(); valueOperations.bitField(key, create().incr(unsigned(2)).valueAt(offset(102L)).overflow(FAIL).by(1L)) - .as(StepVerifier::create) - .expectNext(Collections.singletonList(null)).verifyComplete(); + .as(StepVerifier::create).expectNext(Collections.singletonList(null)).verifyComplete(); } @ParameterizedRedisTest // DATAREDIS-602 diff --git a/src/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.java index d0e1afa11a..d4014a9675 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveZSetOperationsIntegrationTests.java @@ -18,6 +18,8 @@ import static org.assertj.core.api.Assertions.*; import static org.assertj.core.api.Assumptions.*; +import reactor.test.StepVerifier; + import java.time.Duration; import java.util.Arrays; import java.util.Collection; @@ -26,6 +28,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; + import org.springframework.data.domain.Range; import org.springframework.data.redis.ByteBufferObjectFactory; import org.springframework.data.redis.ObjectFactory; @@ -41,8 +44,6 @@ import org.springframework.data.redis.test.extension.parametrized.MethodSource; import org.springframework.data.redis.test.extension.parametrized.ParameterizedRedisTest; -import reactor.test.StepVerifier; - /** * Integration tests for {@link DefaultReactiveZSetOperations}. * diff --git a/src/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.java index 67e31a2163..140b8996b6 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultSetOperationsIntegrationTests.java @@ -103,8 +103,7 @@ void testRandomMembersNegative() { try { setOps.randomMembers(keyFactory.instance(), -1); fail("IllegalArgumentException should be thrown"); - } catch (IllegalArgumentException expected) { - } + } catch (IllegalArgumentException expected) {} } @ParameterizedRedisTest @@ -113,8 +112,7 @@ void testDistinctRandomMembersNegative() { try { setOps.distinctRandomMembers(keyFactory.instance(), -2); fail("IllegalArgumentException should be thrown"); - } catch (IllegalArgumentException expected) { - } + } catch (IllegalArgumentException expected) {} } @SuppressWarnings("unchecked") diff --git a/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java b/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java index f0ae042f65..276007a814 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultTypedTupleUnitTests.java @@ -15,10 +15,9 @@ */ package org.springframework.data.redis.core; -import org.junit.jupiter.api.Test; - import static org.assertj.core.api.Assertions.*; +import org.junit.jupiter.api.Test; import org.springframework.data.redis.core.ZSetOperations.TypedTuple; diff --git a/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.java index dcfd41feb4..1d3b773b64 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultZSetOperationsIntegrationTests.java @@ -600,8 +600,7 @@ void testZsetIntersectWithAggregateWeights() { zSetOps.add(key1, value1, 4.0); zSetOps.add(key2, value1, 3.0); - zSetOps.intersectAndStore(key1, Collections.singletonList(key2), key1, Aggregate.MAX, - Weights.of(1, 2)); + zSetOps.intersectAndStore(key1, Collections.singletonList(key2), key1, Aggregate.MAX, Weights.of(1, 2)); assertThat(zSetOps.score(key1, value1)).isCloseTo(6.0, offset(0.1)); } @@ -655,8 +654,7 @@ void testZsetUnionWithAggregateWeights() { zSetOps.add(key1, value1, 4.0); zSetOps.add(key2, value1, 3.0); - zSetOps.unionAndStore(key1, Collections.singletonList(key2), key1, Aggregate.MAX, - Weights.of(1, 2)); + zSetOps.unionAndStore(key1, Collections.singletonList(key2), key1, Aggregate.MAX, Weights.of(1, 2)); assertThat(zSetOps.score(key1, value1)).isCloseTo(6.0, offset(0.1)); } diff --git a/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java b/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java index bf7a398c1e..854f251f73 100644 --- a/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/IndexWriterUnitTests.java @@ -101,8 +101,7 @@ void removeKeyFromExistingIndexesShouldRemoveKeyFromAllExistingIndexesForPath() byte[] indexKey1 = "persons:firstname:rand".getBytes(CHARSET); byte[] indexKey2 = "persons:firstname:mat".getBytes(CHARSET); - when(connectionMock.keys(any(byte[].class))) - .thenReturn(new LinkedHashSet<>(Arrays.asList(indexKey1, indexKey2))); + when(connectionMock.keys(any(byte[].class))).thenReturn(new LinkedHashSet<>(Arrays.asList(indexKey1, indexKey2))); writer.removeKeyFromExistingIndexes(KEY_BIN, new StubIndxedData()); @@ -121,8 +120,7 @@ void removeAllIndexesShouldDeleteAllIndexKeys() { byte[] indexKey1 = "persons:firstname:rand".getBytes(CHARSET); byte[] indexKey2 = "persons:firstname:mat".getBytes(CHARSET); - when(connectionMock.keys(any(byte[].class))) - .thenReturn(new LinkedHashSet<>(Arrays.asList(indexKey1, indexKey2))); + when(connectionMock.keys(any(byte[].class))).thenReturn(new LinkedHashSet<>(Arrays.asList(indexKey1, indexKey2))); writer.removeAllIndexes(KEYSPACE); @@ -146,11 +144,11 @@ void addToIndexShouldUseRegisteredConverterWhenAddingData() { ((GenericConversionService) converter.getConversionService()).addConverter(new Converter() { - @Override - public byte[] convert(DummyObject source) { - return identityHexString.getBytes(CHARSET); - } - }); + @Override + public byte[] convert(DummyObject source) { + return identityHexString.getBytes(CHARSET); + } + }); writer.addKeyToIndex(KEY_BIN, new SimpleIndexedPropertyValue(KEYSPACE, "firstname", value)); diff --git a/src/test/java/org/springframework/data/redis/core/MappingExpirationListenerTest.java b/src/test/java/org/springframework/data/redis/core/MappingExpirationListenerTest.java index c3df6384aa..42e354302a 100644 --- a/src/test/java/org/springframework/data/redis/core/MappingExpirationListenerTest.java +++ b/src/test/java/org/springframework/data/redis/core/MappingExpirationListenerTest.java @@ -15,12 +15,9 @@ */ package org.springframework.data.redis.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; import java.util.ArrayList; import java.util.List; @@ -32,6 +29,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.junit.jupiter.MockitoSettings; import org.mockito.quality.Strictness; + import org.springframework.core.convert.ConversionService; import org.springframework.data.redis.connection.Message; import org.springframework.data.redis.core.convert.RedisConverter; diff --git a/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.java index f887c1ba22..17c613eab4 100644 --- a/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/ReactiveRedisTemplateIntegrationTests.java @@ -102,10 +102,9 @@ void before() { void copy() { try (ReactiveRedisClusterConnection connection = redisTemplate.getConnectionFactory() - .getReactiveClusterConnection()){ + .getReactiveClusterConnection()) { assumeThat(connection).isNull(); - } catch (InvalidDataAccessApiUsageException ignore) { - } + } catch (InvalidDataAccessApiUsageException ignore) {} K key = keyFactory.instance(); K targetKey = keyFactory.instance(); @@ -329,8 +328,7 @@ void executeScriptWithElementReaderAndWriter() { redisTemplate .execute(new DefaultRedisScript<>("return redis.call('set', KEYS[1], ARGV[1])", String.class), Collections.singletonList(key), Collections.singletonList(person), json.getWriter(), resultReader) - .as(StepVerifier::create) - .expectNext("OK").verifyComplete(); + .as(StepVerifier::create).expectNext("OK").verifyComplete(); Flux execute = redisTemplate.execute( new DefaultRedisScript<>("return redis.call('get', KEYS[1])", Person.class), Collections.singletonList(key), @@ -462,8 +460,7 @@ void move() { try (ReactiveRedisClusterConnection connection = redisTemplate.getConnectionFactory() .getReactiveClusterConnection()) { assumeThat(connection).isNull(); - } catch (InvalidDataAccessApiUsageException ignore) { - } + } catch (InvalidDataAccessApiUsageException ignore) {} K key = keyFactory.instance(); V value = valueFactory.instance(); @@ -549,7 +546,7 @@ void listenToLaterChannelShouldReceiveChannelMessagesCorrectly() { redisTemplate.listenToChannelLater(channel) // .doOnNext(it -> redisTemplate.convertAndSend(channel, message).subscribe()).flatMapMany(Function.identity()) // - .cast(Message.class) // why? java16 why? + .cast(Message.class) // why? java16 why? .as(StepVerifier::create) // .assertNext(received -> { diff --git a/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.java index ea3ec41dd8..02e3ce5983 100644 --- a/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/ReactiveStringRedisTemplateIntegrationTests.java @@ -70,7 +70,7 @@ void keysFailsOnNullElements() { RedisElementWriter writer = RedisElementWriter.from(StringRedisSerializer.UTF_8); RedisSerializationContext nullReadingContext = RedisSerializationContext - .newSerializationContext(StringRedisSerializer.UTF_8).key(buffer -> { + . newSerializationContext(StringRedisSerializer.UTF_8).key(buffer -> { String read = reader.read(buffer); diff --git a/src/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.java index 63f7616908..13bc84128f 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisAccessorUnitTests.java @@ -15,15 +15,8 @@ */ package org.springframework.data.redis.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.Mockito.*; import org.junit.jupiter.api.Test; @@ -60,10 +53,8 @@ void setAndGetConnectionFactory() { @Test void getRequiredConnectionFactoryWhenNull() { - assertThatIllegalStateException() - .isThrownBy(() -> new TestRedisAccessor().getRequiredConnectionFactory()) - .withMessage("RedisConnectionFactory is required") - .withNoCause(); + assertThatIllegalStateException().isThrownBy(() -> new TestRedisAccessor().getRequiredConnectionFactory()) + .withMessage("RedisConnectionFactory is required").withNoCause(); } @Test @@ -82,6 +73,6 @@ void afterPropertiesSetCallsGetRequiredConnectionFactory() { verifyNoMoreInteractions(redisAccessor); } - static class TestRedisAccessor extends RedisAccessor { } + static class TestRedisAccessor extends RedisAccessor {} } diff --git a/src/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java index c2b5f55b01..0c80f3b957 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisClusterTemplateIntegrationTests.java @@ -158,7 +158,6 @@ public static Collection testParams() { ObjectFactory rawFactory = new RawObjectFactory(); ObjectFactory personFactory = new PersonObjectFactory(); - OxmSerializer serializer = XstreamOxmSerializerSingleton.getInstance(); Jackson2JsonRedisSerializer jackson2JsonSerializer = new Jackson2JsonRedisSerializer<>(Person.class); diff --git a/src/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.java index 4d28d2632b..d4b425bc2e 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyExpiredEventUnitTests.java @@ -15,10 +15,9 @@ */ package org.springframework.data.redis.core; -import org.junit.jupiter.api.Test; - import static org.assertj.core.api.Assertions.*; +import org.junit.jupiter.api.Test; /** * Unit tests for {@link RedisKeyExpiredEvent}. diff --git a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java index a445a6bb17..f1b0b83d6f 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java @@ -89,8 +89,7 @@ void setUp() { return null; }); - try (RedisConnection connection = template.getConnectionFactory() - .getConnection()) { + try (RedisConnection connection = template.getConnectionFactory().getConnection()) { connection.setConfig("notify-keyspace-events", ""); connection.setConfig("notify-keyspace-events", "KEA"); } @@ -101,8 +100,7 @@ void tearDown() { try { adapter.destroy(); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} } @Test // DATAREDIS-425 diff --git a/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java index fb464d61a3..a768264f54 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyValueTemplateTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.core; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.util.ArrayList; import java.util.Arrays; @@ -290,7 +290,7 @@ void partialUpdateComplexType() { assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "complexValue.name".getBytes())) - .isEqualTo("Portal Stone".getBytes()); + .isEqualTo("Portal Stone".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "complexValue.dimension.height".getBytes())).isEqualTo("350".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), @@ -330,7 +330,7 @@ void partialUpdateObjectType() { assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "objectValue._class".getBytes())) - .isEqualTo(Item.class.getName().getBytes()); + .isEqualTo(Item.class.getName().getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "objectValue.name".getBytes())) .isEqualTo("Portal Stone".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), @@ -364,7 +364,7 @@ void partialUpdateSimpleTypedMap() { assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "simpleTypedMap.[spring]".getBytes())) - .isEqualTo("data".getBytes()); + .isEqualTo("data".getBytes()); assertThat(connection.hExists(("template-test-type-mapping:" + source.id).getBytes(), "simpleTypedMap.[key-1]".getBytes())).isFalse(); assertThat(connection.hExists(("template-test-type-mapping:" + source.id).getBytes(), @@ -486,7 +486,7 @@ void partialUpdateObjectTypedMap() { "untypedMap.[spring]._class".getBytes())).isEqualTo("java.lang.String".getBytes()); assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedMap.[spring]".getBytes())) - .isEqualTo("data".getBytes()); + .isEqualTo("data".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedMap.[some-number]._class".getBytes())).isEqualTo("java.lang.Long".getBytes()); @@ -530,16 +530,16 @@ void partialUpdateSimpleTypedList() { assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "simpleTypedList.[0]".getBytes())) - .isEqualTo("spring".getBytes()); + .isEqualTo("spring".getBytes()); assertThat( connection.hExists(("template-test-type-mapping:" + source.id).getBytes(), "simpleTypedList.[1]".getBytes())) - .isFalse(); + .isFalse(); assertThat( connection.hExists(("template-test-type-mapping:" + source.id).getBytes(), "simpleTypedList.[2]".getBytes())) - .isFalse(); + .isFalse(); assertThat( connection.hExists(("template-test-type-mapping:" + source.id).getBytes(), "simpleTypedList.[3]".getBytes())) - .isFalse(); + .isFalse(); return null; }); } @@ -639,13 +639,13 @@ void partialUpdateObjectTypedList() { assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedList.[0]._class".getBytes())) - .isEqualTo("java.lang.String".getBytes()); + .isEqualTo("java.lang.String".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedList.[0]".getBytes())) .isEqualTo("spring".getBytes()); assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedList.[1].name".getBytes())) - .isEqualTo("Horn of Valere".getBytes()); + .isEqualTo("Horn of Valere".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedList.[1].dimension.height".getBytes())).isEqualTo("70".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), @@ -653,7 +653,7 @@ void partialUpdateObjectTypedList() { assertThat( connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedList.[2]._class".getBytes())) - .isEqualTo("java.lang.Long".getBytes()); + .isEqualTo("java.lang.Long".getBytes()); assertThat(connection.hGet(("template-test-type-mapping:" + source.id).getBytes(), "untypedList.[2]".getBytes())) .isEqualTo("100".getBytes()); @@ -835,25 +835,23 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.id, that.id) - && Objects.equals(this.stringValue, that.stringValue) - && Objects.equals(this.integerValue, that.integerValue) - && Objects.equals(this.complexValue, that.complexValue) - && Objects.equals(this.objectValue, that.objectValue) - && Objects.equals(this.simpleTypedList, that.simpleTypedList) - && Objects.equals(this.complexTypedList, that.complexTypedList) - && Objects.equals(this.untypedList, that.untypedList) - && Objects.equals(this.simpleTypedMap, that.simpleTypedMap) - && Objects.equals(this.complexTypedMap, that.complexTypedMap) - && Objects.equals(this.untypedMap, that.untypedMap); + return Objects.equals(this.id, that.id) && Objects.equals(this.stringValue, that.stringValue) + && Objects.equals(this.integerValue, that.integerValue) + && Objects.equals(this.complexValue, that.complexValue) && Objects.equals(this.objectValue, that.objectValue) + && Objects.equals(this.simpleTypedList, that.simpleTypedList) + && Objects.equals(this.complexTypedList, that.complexTypedList) + && Objects.equals(this.untypedList, that.untypedList) + && Objects.equals(this.simpleTypedMap, that.simpleTypedMap) + && Objects.equals(this.complexTypedMap, that.complexTypedMap) + && Objects.equals(this.untypedMap, that.untypedMap); } @Override public int hashCode() { return Objects.hash(this.id, this.stringValue, this.integerValue, this.complexValue, this.objectValue, - this.simpleTypedList, this.complexTypedList, this.untypedList, this.simpleTypedMap, - this.complexTypedMap, this.untypedMap); + this.simpleTypedList, this.complexTypedList, this.untypedList, this.simpleTypedMap, this.complexTypedMap, + this.untypedMap); } } @@ -908,11 +906,9 @@ public boolean equals(@Nullable Object obj) { return false; } - return Objects.equals(this.id, that.id) - && Objects.equals(this.firstname, that.firstname) - && Objects.equals(this.lastname, that.lastname) - && Objects.equals(this.age, that.age) - && Objects.equals(this.nicknames, that.nicknames); + return Objects.equals(this.id, that.id) && Objects.equals(this.firstname, that.firstname) + && Objects.equals(this.lastname, that.lastname) && Objects.equals(this.age, that.age) + && Objects.equals(this.nicknames, that.nicknames); } @Override @@ -969,9 +965,8 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getTtl(), that.getTtl()) - && Objects.equals(this.getValue(), that.getValue()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getTtl(), that.getTtl()) + && Objects.equals(this.getValue(), that.getValue()); } @Override @@ -1021,9 +1016,8 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getTtl(), that.getTtl()) - && Objects.equals(this.getValue(), that.getValue()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getTtl(), that.getTtl()) + && Objects.equals(this.getValue(), that.getValue()); } @Override @@ -1073,9 +1067,8 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getTtl(), that.getTtl()) - && Objects.equals(this.getValue(), that.getValue()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getTtl(), that.getTtl()) + && Objects.equals(this.getValue(), that.getValue()); } @Override @@ -1086,9 +1079,8 @@ public int hashCode() { @Override public String toString() { - return "RedisKeyValueTemplateTests.ImmutableObject(id=" + this.getId() - + ", value=" + this.getValue() - + ", ttl=" + this.getTtl() + ")"; + return "RedisKeyValueTemplateTests.ImmutableObject(id=" + this.getId() + ", value=" + this.getValue() + ", ttl=" + + this.getTtl() + ")"; } public ImmutableObject withId(String id) { diff --git a/src/test/java/org/springframework/data/redis/core/SessionUnitTests.java b/src/test/java/org/springframework/data/redis/core/SessionUnitTests.java index 20ebdd5890..ad4ba4884b 100644 --- a/src/test/java/org/springframework/data/redis/core/SessionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/SessionUnitTests.java @@ -15,11 +15,10 @@ */ package org.springframework.data.redis.core; -import org.junit.jupiter.api.Test; - import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; +import org.junit.jupiter.api.Test; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; diff --git a/src/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java index 58063cb23d..2c595f8edb 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/CompositeIndexResolverUnitTests.java @@ -52,10 +52,10 @@ void shouldRejectCollectionWithNullValues() { @Test // DATAREDIS-425 void shouldCollectionIndexesFromResolvers() { - when(resolver1.resolveIndexesFor(any(TypeInformation.class), any())).thenReturn( - Collections. singleton(new SimpleIndexedPropertyValue("spring", "data", "redis"))); - when(resolver2.resolveIndexesFor(any(TypeInformation.class), any())).thenReturn( - Collections. singleton(new SimpleIndexedPropertyValue("redis", "data", "spring"))); + when(resolver1.resolveIndexesFor(any(TypeInformation.class), any())) + .thenReturn(Collections. singleton(new SimpleIndexedPropertyValue("spring", "data", "redis"))); + when(resolver2.resolveIndexesFor(any(TypeInformation.class), any())) + .thenReturn(Collections. singleton(new SimpleIndexedPropertyValue("redis", "data", "spring"))); CompositeIndexResolver resolver = new CompositeIndexResolver(Arrays.asList(resolver1, resolver2)); diff --git a/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java b/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java index c9b5d00c66..67685d756e 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java +++ b/src/test/java/org/springframework/data/redis/core/convert/ConversionTestEntities.java @@ -136,10 +136,9 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getFirstname(), that.getFirstname()) - && Objects.equals(this.getLastname(), that.getLastname()) - && Objects.equals(this.getFather(), that.getFather()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getFirstname(), that.getFirstname()) + && Objects.equals(this.getLastname(), that.getLastname()) + && Objects.equals(this.getFather(), that.getFather()); } @Override @@ -150,10 +149,8 @@ public int hashCode() { @Override public String toString() { - return "ConversionTestEntities.RecursiveConstructorPerson(id=" + this.getId() - + ", firstname=" + this.getFirstname() - + ", father=" + this.getFather() - + ", lastname=" + this.getLastname() + ")"; + return "ConversionTestEntities.RecursiveConstructorPerson(id=" + this.getId() + ", firstname=" + + this.getFirstname() + ", father=" + this.getFather() + ", lastname=" + this.getLastname() + ")"; } } @@ -187,8 +184,7 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getAddress(), that.getAddress()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getAddress(), that.getAddress()); } @Override @@ -198,8 +194,8 @@ public int hashCode() { @Override public String toString() { - return "ConversionTestEntities.PersonWithConstructorAndAddress(id=" + this.getId() - + ", address=" + this.getAddress() + ")"; + return "ConversionTestEntities.PersonWithConstructorAndAddress(id=" + this.getId() + ", address=" + + this.getAddress() + ")"; } } @@ -258,9 +254,8 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.id, that.id) - && Objects.equals(this.name, that.name) - && Objects.equals(this.address, that.address); + return Objects.equals(this.id, that.id) && Objects.equals(this.name, that.name) + && Objects.equals(this.address, that.address); } @Override @@ -423,9 +418,8 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getAccount(), that.getAccount()) - && Objects.equals(this.getAccountName(), that.getAccountName()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getAccount(), that.getAccount()) + && Objects.equals(this.getAccountName(), that.getAccountName()); } @Override @@ -435,9 +429,8 @@ public int hashCode() { @Override public String toString() { - return "ConversionTestEntities.AccountInfo(id=" + this.getId() - + ", account=" + this.getAccount() - + ", accountName=" + this.getAccountName() + ")"; + return "ConversionTestEntities.AccountInfo(id=" + this.getId() + ", account=" + this.getAccount() + + ", accountName=" + this.getAccountName() + ")"; } } } diff --git a/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java b/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java index bad40ef82b..6d66dd01e1 100644 --- a/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/convert/MappingRedisConverterUnitTests.java @@ -156,8 +156,7 @@ void writeAppendsListOfSimplePropertiesCorrectly() { RedisTestData target = write(rand); - assertThat(target).containsEntry("nicknames.[0]", "dragon reborn") - .containsEntry("nicknames.[1]", "lews therin"); + assertThat(target).containsEntry("nicknames.[0]", "dragon reborn").containsEntry("nicknames.[1]", "lews therin"); } @Test // DATAREDIS-425 @@ -192,9 +191,9 @@ void writeAppendsListOfComplexObjectsCorrectly() { RedisTestData target = write(rand); assertThat(target).containsEntry("coworkers.[0].firstname", "mat") // - .containsEntry("coworkers.[0].nicknames.[0]", "prince of the ravens") // - .containsEntry("coworkers.[1].firstname", "perrin") // - .containsEntry("coworkers.[1].address.city", "two rivers"); + .containsEntry("coworkers.[0].nicknames.[0]", "prince of the ravens") // + .containsEntry("coworkers.[1].firstname", "perrin") // + .containsEntry("coworkers.[1].address.city", "two rivers"); } @Test // DATAREDIS-425 @@ -249,7 +248,7 @@ void readEntityViaConstructor() { map.put("father.lastname", "Simpson"); RecursiveConstructorPerson target = converter.read(RecursiveConstructorPerson.class, - new RedisData(Bucket.newBucketFromStringMap(map))); + new RedisData(Bucket.newBucketFromStringMap(map))); assertThat(target.id).isEqualTo("bart"); assertThat(target.firstname).isEqualTo("Bart"); @@ -303,7 +302,7 @@ void readConvertsUnorderedListOfSimplePropertiesCorrectly() { RedisData rdo = new RedisData(Bucket.newBucketFromStringMap(map)); assertThat(converter.read(Person.class, rdo).nicknames).containsExactly("dragon reborn", "car'a'carn", - "lews therin"); + "lews therin"); } @Test // DATAREDIS-768 @@ -408,7 +407,7 @@ void writeAppendsMapWithSimpleKeyCorrectly() { RedisTestData target = write(rand); assertThat(target).containsEntry("physicalAttributes.[hair-color]", "red") // - .containsEntry("physicalAttributes.[eye-color]", "grey"); + .containsEntry("physicalAttributes.[eye-color]", "grey"); } @Test // DATAREDIS-425 @@ -425,7 +424,7 @@ void writeAppendsMapWithSimpleKeyOnNestedObjectCorrectly() { RedisTestData target = write(rand); assertThat(target).containsEntry("coworkers.[0].physicalAttributes.[hair-color]", "red") // - .containsEntry("coworkers.[0].physicalAttributes.[eye-color]", "grey"); + .containsEntry("coworkers.[0].physicalAttributes.[eye-color]", "grey"); } @Test // DATAREDIS-425 @@ -487,7 +486,7 @@ void writeMapWithDecimalMapKeyCorrectly() { RedisTestData target = write(source); assertThat(target).containsEntry("decimalMapKeyMapping.[1.7]", "2") // - .containsEntry("decimalMapKeyMapping.[3.1]", "4"); + .containsEntry("decimalMapKeyMapping.[3.1]", "4"); } @Test // DATAREDIS-768 @@ -533,7 +532,7 @@ void writeAppendsMapWithComplexObjectsCorrectly() { RedisTestData target = write(rand); assertThat(target).containsEntry("relatives.[father].firstname", "janduin") // - .containsEntry("relatives.[step-father].firstname", "tam"); + .containsEntry("relatives.[step-father].firstname", "tam"); } @Test // DATAREDIS-425 @@ -617,8 +616,7 @@ void writesLocalDateTimeValuesCorrectly() { void readsLocalDateTimeValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData( - Bucket.newBucketFromStringMap(Collections.singletonMap("localDateTime", "2016-02-19T10:18:01")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("localDateTime", "2016-02-19T10:18:01")))); assertThat(target.localDateTime).isEqualTo(LocalDateTime.parse("2016-02-19T10:18:01")); } @@ -635,7 +633,7 @@ void writesLocalDateValuesCorrectly() { void readsLocalDateValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("localDate", "2016-02-19")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("localDate", "2016-02-19")))); assertThat(target.localDate).isEqualTo(LocalDate.parse("2016-02-19")); } @@ -652,7 +650,7 @@ void writesLocalTimeValuesCorrectly() { void readsLocalTimeValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("localTime", "11:12")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("localTime", "11:12")))); assertThat(target.localTime).isEqualTo(LocalTime.parse("11:12:00")); } @@ -669,8 +667,7 @@ void writesZonedDateTimeValuesCorrectly() { void readsZonedDateTimeValuesCorrectly() { Person target = converter.read(Person.class, new RedisData(Bucket - .newBucketFromStringMap( - Collections.singletonMap("zonedDateTime", "2007-12-03T10:15:30+01:00[Europe/Paris]")))); + .newBucketFromStringMap(Collections.singletonMap("zonedDateTime", "2007-12-03T10:15:30+01:00[Europe/Paris]")))); assertThat(target.zonedDateTime).isEqualTo(ZonedDateTime.parse("2007-12-03T10:15:30+01:00[Europe/Paris]")); } @@ -687,8 +684,7 @@ void writesInstantValuesCorrectly() { void readsInstantValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData( - Bucket.newBucketFromStringMap(Collections.singletonMap("instant", "2007-12-03T10:15:30.01Z")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("instant", "2007-12-03T10:15:30.01Z")))); assertThat(target.instant).isEqualTo(Instant.parse("2007-12-03T10:15:30.01Z")); } @@ -725,7 +721,7 @@ void writesDurationValuesCorrectly() { void readsDurationValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("duration", "PT51H4M")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("duration", "PT51H4M")))); assertThat(target.duration).isEqualTo(Duration.parse("P2DT3H4M")); } @@ -742,7 +738,7 @@ void writesPeriodValuesCorrectly() { void readsPeriodValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("period", "P1Y2M25D")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("period", "P1Y2M25D")))); assertThat(target.period).isEqualTo(Period.parse("P1Y2M25D")); } @@ -759,7 +755,7 @@ void writesEnumValuesCorrectly() { void readsEnumValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("gender", "FEMALE")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("gender", "FEMALE")))); assertThat(target.gender).isEqualTo(Gender.FEMALE); } @@ -776,7 +772,7 @@ void writesBooleanValuesCorrectly() { void readsBooleanValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("alive", "1")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("alive", "1")))); assertThat(target.alive).isEqualTo(Boolean.TRUE); } @@ -785,7 +781,7 @@ void readsBooleanValuesCorrectly() { void readsStringBooleanValuesCorrectly() { Person target = converter.read(Person.class, - new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("alive", "true")))); + new RedisData(Bucket.newBucketFromStringMap(Collections.singletonMap("alive", "true")))); assertThat(target.alive).isEqualTo(Boolean.TRUE); } @@ -810,8 +806,7 @@ void readsDateValuesCorrectly() { Date date = cal.getTime(); Person target = converter.read(Person.class, new RedisData( - Bucket.newBucketFromStringMap( - Collections.singletonMap("birthdate", Long.valueOf(date.getTime()).toString())))); + Bucket.newBucketFromStringMap(Collections.singletonMap("birthdate", Long.valueOf(date.getTime()).toString())))); assertThat(target.birthdate).isEqualTo(date); } @@ -828,8 +823,8 @@ void writeSingleReferenceOnRootCorrectly() { RedisTestData target = write(rand); assertThat(target).containsEntry("location", "locations:1") // - .without("location.id") // - .without("location.name"); + .without("location.id") // + .without("location.name"); } @Test // DATAREDIS-425 @@ -844,7 +839,7 @@ void readLoadsReferenceDataOnRootCorrectly() { locationMap.put("name", location.name); when(resolverMock.resolveReference(eq("1"), eq("locations"))) - .thenReturn(Bucket.newBucketFromStringMap(locationMap).rawMap()); + .thenReturn(Bucket.newBucketFromStringMap(locationMap).rawMap()); Map map = new LinkedHashMap<>(); map.put("location", "locations:1"); @@ -867,8 +862,8 @@ void writeSingleReferenceOnNestedElementCorrectly() { rand.coworkers = Collections.singletonList(egwene); assertThat(write(rand)).containsEntry("coworkers.[0].location", "locations:1") // - .without("coworkers.[0].location.id") // - .without("coworkers.[0].location.name"); + .without("coworkers.[0].location.id") // + .without("coworkers.[0].location.name"); } @Test // DATAREDIS-425 @@ -883,7 +878,7 @@ void readLoadsReferenceDataOnNestedElementCorrectly() { locationMap.put("name", location.name); when(resolverMock.resolveReference(eq("1"), eq("locations"))) - .thenReturn(Bucket.newBucketFromStringMap(locationMap).rawMap()); + .thenReturn(Bucket.newBucketFromStringMap(locationMap).rawMap()); Map map = new LinkedHashMap<>(); map.put("coworkers.[0].location", "locations:1"); @@ -913,8 +908,8 @@ void writeListOfReferencesOnRootCorrectly() { RedisTestData target = write(rand); assertThat(target).containsEntry("visited.[0]", "locations:1") // - .containsEntry("visited.[1]", "locations:2") // - .containsEntry("visited.[2]", "locations:3"); + .containsEntry("visited.[1]", "locations:2") // + .containsEntry("visited.[2]", "locations:3"); } @Test // DATAREDIS-425 @@ -947,11 +942,11 @@ void readLoadsListOfReferencesOnRootCorrectly() { Bucket.newBucketFromStringMap(tearMap).rawMap(); when(resolverMock.resolveReference(eq("1"), eq("locations"))) - .thenReturn(Bucket.newBucketFromStringMap(tarValonMap).rawMap()); + .thenReturn(Bucket.newBucketFromStringMap(tarValonMap).rawMap()); when(resolverMock.resolveReference(eq("2"), eq("locations"))) - .thenReturn(Bucket.newBucketFromStringMap(falmeMap).rawMap()); + .thenReturn(Bucket.newBucketFromStringMap(falmeMap).rawMap()); when(resolverMock.resolveReference(eq("3"), eq("locations"))) - .thenReturn(Bucket.newBucketFromStringMap(tearMap).rawMap()); + .thenReturn(Bucket.newBucketFromStringMap(tearMap).rawMap()); Map map = new LinkedHashMap<>(); map.put("visited.[0]", "locations:1"); @@ -989,7 +984,7 @@ void writeDoesNotTTLWhenNotPresent() { void writeShouldConsiderKeyspaceConfiguration() { this.converter.getMappingContext().getMappingConfiguration().getKeyspaceConfiguration() - .addKeyspaceSettings(new KeyspaceSettings(Address.class, "o_O")); + .addKeyspaceSettings(new KeyspaceSettings(Address.class, "o_O")); Address address = new Address(); address.city = "Tear"; @@ -1004,7 +999,7 @@ void writeShouldConsiderTimeToLiveConfiguration() { assignment.setTimeToLive(5L); this.converter.getMappingContext().getMappingConfiguration().getKeyspaceConfiguration() - .addKeyspaceSettings(assignment); + .addKeyspaceSettings(assignment); Address address = new Address(); address.city = "Tear"; @@ -1016,7 +1011,7 @@ void writeShouldConsiderTimeToLiveConfiguration() { void writeShouldHonorCustomConversionOnRootType() { RedisCustomConversions customConversions = new RedisCustomConversions( - Collections.singletonList(new AddressToBytesConverter())); + Collections.singletonList(new AddressToBytesConverter())); RedisMappingContext mappingContext = new RedisMappingContext(); mappingContext.setSimpleTypeHolder(customConversions.getSimpleTypeHolder()); @@ -1036,7 +1031,7 @@ void writeShouldHonorCustomConversionOnRootType() { void writeShouldHonorCustomConversionOnNestedType() { RedisCustomConversions customConversions = new RedisCustomConversions( - Collections.singletonList(new AddressToBytesConverter())); + Collections.singletonList(new AddressToBytesConverter())); RedisMappingContext mappingContext = new RedisMappingContext(); mappingContext.setSimpleTypeHolder(customConversions.getSimpleTypeHolder()); @@ -1058,7 +1053,7 @@ void writeShouldHonorIndexOnCustomConversionForNestedType() { this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new AddressToBytesConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new AddressToBytesConverter()))); this.converter.afterPropertiesSet(); Address address = new Address(); @@ -1066,7 +1061,7 @@ void writeShouldHonorIndexOnCustomConversionForNestedType() { rand.address = address; assertThat(write(rand).getRedisData().getIndexedData()) - .contains(new SimpleIndexedPropertyValue(KEYSPACE_PERSON, "address.country", "andor")); + .contains(new SimpleIndexedPropertyValue(KEYSPACE_PERSON, "address.country", "andor")); } @Test // DATAREDIS-425 @@ -1074,7 +1069,7 @@ void writeShouldHonorIndexAnnotationsOnWhenCustomConversionOnNestedype() { this.converter = new MappingRedisConverter(new RedisMappingContext(), null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new AddressToBytesConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new AddressToBytesConverter()))); this.converter.afterPropertiesSet(); Address address = new Address(); @@ -1090,7 +1085,7 @@ void readShouldHonorCustomConversionOnRootType() { this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new BytesToAddressConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new BytesToAddressConverter()))); this.converter.afterPropertiesSet(); Map map = new LinkedHashMap<>(); @@ -1107,7 +1102,7 @@ void readShouldHonorCustomConversionOnNestedType() { this.converter = new MappingRedisConverter(new RedisMappingContext(), null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new BytesToAddressConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new BytesToAddressConverter()))); this.converter.afterPropertiesSet(); Map map = new LinkedHashMap<>(); @@ -1125,14 +1120,14 @@ void readShouldHonorCustomConversionOnNestedTypeViaConstructorCreation() { this.converter = new MappingRedisConverter(new RedisMappingContext(), null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new BytesToAddressConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new BytesToAddressConverter()))); this.converter.afterPropertiesSet(); Map map = new LinkedHashMap<>(); map.put("address", "{\"city\":\"unknown\",\"country\":\"Tel'aran'rhiod\"}"); PersonWithConstructorAndAddress target = converter.read(PersonWithConstructorAndAddress.class, - new RedisData(Bucket.newBucketFromStringMap(map))); + new RedisData(Bucket.newBucketFromStringMap(map))); assertThat(target.address).isNotNull(); assertThat(target.address.city).isEqualTo("unknown"); @@ -1163,7 +1158,7 @@ void writeShouldConsiderMapConvertersForRootType() { this.converter = new MappingRedisConverter(new RedisMappingContext(), null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new SpeciesToMapConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new SpeciesToMapConverter()))); this.converter.afterPropertiesSet(); Species myrddraal = new Species(); @@ -1171,7 +1166,7 @@ void writeShouldConsiderMapConvertersForRootType() { myrddraal.alsoKnownAs = Arrays.asList("halfmen", "fades", "neverborn"); assertThat(write(myrddraal)).containsEntry("species-name", "myrddraal").containsEntry("species-nicknames", - "halfmen,fades,neverborn"); + "halfmen,fades,neverborn"); } @Test // DATAREDIS-425 @@ -1179,7 +1174,7 @@ void writeShouldConsiderMapConvertersForNestedType() { this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new SpeciesToMapConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new SpeciesToMapConverter()))); this.converter.afterPropertiesSet(); rand.species = new Species(); @@ -1193,7 +1188,7 @@ void readShouldConsiderMapConvertersForRootType() { this.converter = new MappingRedisConverter(new RedisMappingContext(), null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new MapToSpeciesConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new MapToSpeciesConverter()))); this.converter.afterPropertiesSet(); Map map = new LinkedHashMap<>(); map.put("species-name", "trolloc"); @@ -1209,7 +1204,7 @@ void readShouldConsiderMapConvertersForNestedType() { this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new MapToSpeciesConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new MapToSpeciesConverter()))); this.converter.afterPropertiesSet(); Map map = new LinkedHashMap<>(); @@ -1226,7 +1221,7 @@ void writeShouldConsiderMapConvertersInsideLists() { this.converter = new MappingRedisConverter(new RedisMappingContext(), null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new SpeciesToMapConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new SpeciesToMapConverter()))); this.converter.afterPropertiesSet(); TheWheelOfTime twot = new TheWheelOfTime(); @@ -1238,7 +1233,7 @@ void writeShouldConsiderMapConvertersInsideLists() { twot.species.add(myrddraal); assertThat(write(twot)).containsEntry("species.[0].species-name", "myrddraal") - .containsEntry("species.[0].species-nicknames", "halfmen,fades,neverborn"); + .containsEntry("species.[0].species-nicknames", "halfmen,fades,neverborn"); } @Test // DATAREDIS-425 @@ -1246,7 +1241,7 @@ void readShouldConsiderMapConvertersForValuesInList() { this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new MapToSpeciesConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new MapToSpeciesConverter()))); this.converter.afterPropertiesSet(); Map map = new LinkedHashMap<>(); @@ -1267,7 +1262,7 @@ void writeHandlesArraysOfSimpleTypeProperly() { source.arrayOfSimpleTypes = new String[] { "rand", "mat", "perrin" }; assertThat(write(source)).containsEntry("arrayOfSimpleTypes.[0]", "rand") - .containsEntry("arrayOfSimpleTypes.[1]", "mat").containsEntry("arrayOfSimpleTypes.[2]", "perrin"); + .containsEntry("arrayOfSimpleTypes.[1]", "mat").containsEntry("arrayOfSimpleTypes.[2]", "perrin"); } @Test // DATAREDIS-492 @@ -1332,10 +1327,10 @@ void writeHandlesArraysOfComplexTypeProperly() { source.arrayOfCompexTypes = new Species[] { trolloc, myrddraal }; assertThat(write(source)).containsEntry("arrayOfCompexTypes.[0].name", "trolloc") // - .containsEntry("arrayOfCompexTypes.[1].name", "myrddraal") // - .containsEntry("arrayOfCompexTypes.[1].alsoKnownAs.[0]", "halfmen") // - .containsEntry("arrayOfCompexTypes.[1].alsoKnownAs.[1]", "fades") // - .containsEntry("arrayOfCompexTypes.[1].alsoKnownAs.[2]", "neverborn"); + .containsEntry("arrayOfCompexTypes.[1].name", "myrddraal") // + .containsEntry("arrayOfCompexTypes.[1].alsoKnownAs.[0]", "halfmen") // + .containsEntry("arrayOfCompexTypes.[1].alsoKnownAs.[1]", "fades") // + .containsEntry("arrayOfCompexTypes.[1].alsoKnownAs.[2]", "neverborn"); } @Test // DATAREDIS-492 @@ -1367,11 +1362,11 @@ void writeHandlesArraysOfObjectTypeProperly() { source.arrayOfObject = new Object[] { "rand", trolloc, 100L }; assertThat(write(source)).containsEntry("arrayOfObject.[0]", "rand") // - .containsEntry("arrayOfObject.[0]._class", "java.lang.String") - .containsEntry("arrayOfObject.[1]._class", Species.class.getName()) // - .containsEntry("arrayOfObject.[1].name", "trolloc") // - .containsEntry("arrayOfObject.[2]._class", "java.lang.Long") // - .containsEntry("arrayOfObject.[2]", "100"); + .containsEntry("arrayOfObject.[0]._class", "java.lang.String") + .containsEntry("arrayOfObject.[1]._class", Species.class.getName()) // + .containsEntry("arrayOfObject.[1].name", "trolloc") // + .containsEntry("arrayOfObject.[2]._class", "java.lang.Long") // + .containsEntry("arrayOfObject.[2]", "100"); } @Test // DATAREDIS-489 @@ -1428,8 +1423,7 @@ void writeShouldAppendTyeHintToObjectMapValueTypesCorrectly() { RedisTestData bucket = write(sample); - assertThat(bucket).containsEntry("map.[string]", "bar") - .containsEntry("map.[string]._class", "java.lang.String"); + assertThat(bucket).containsEntry("map.[string]", "bar").containsEntry("map.[string]._class", "java.lang.String"); assertThat(bucket).containsEntry("map.[long]", "1").containsEntry("map.[long]._class", "java.lang.Long"); assertThat(bucket).containsEntry("map.[date]._class", "java.util.Date"); } @@ -1513,9 +1507,8 @@ void readHandlesArraysOfPrimitivesProperly() { WithArrays source = new WithArrays(); source.arrayOfPrimitives = new int[] { 1, 2, 3 }; - assertThat(write(source)).containsEntry("arrayOfPrimitives.[0]", "1") - .containsEntry("arrayOfPrimitives.[1]", "2") - .containsEntry("arrayOfPrimitives.[2]", "3"); + assertThat(write(source)).containsEntry("arrayOfPrimitives.[0]", "1").containsEntry("arrayOfPrimitives.[1]", "2") + .containsEntry("arrayOfPrimitives.[2]", "3"); } @Test // DATAREDIS-471 @@ -1557,7 +1550,7 @@ void writeShouldWritePartialUpdateFromEntityByteArrayValueCorrectly() { void writeShouldWritePartialUpdateFromSetByteArrayValueCorrectly() { PartialUpdate update = PartialUpdate.newPartialUpdate(42, WithArrays.class).set("avatar", - "foo-bar-baz".getBytes()); + "foo-bar-baz".getBytes()); assertThat(write(update)).containsEntry("avatar", "foo-bar-baz"); } @@ -1594,7 +1587,7 @@ void writeShouldWritePartialUpdatePathWithComplexValueCorrectly() { void writeShouldWritePartialUpdatePathWithSimpleListValueCorrectly() { PartialUpdate update = new PartialUpdate<>("123", Person.class).set("nicknames", - Arrays.asList("dragon", "lews")); + Arrays.asList("dragon", "lews")); assertThat(write(update)).containsEntry("nicknames.[0]", "dragon").containsEntry("nicknames.[1]", "lews"); } @@ -1610,11 +1603,10 @@ void writeShouldWritePartialUpdatePathWithComplexListValueCorrectly() { perrin.firstname = "perrin"; PartialUpdate update = new PartialUpdate<>("123", Person.class).set("coworkers", - Arrays.asList(mat, perrin)); + Arrays.asList(mat, perrin)); - assertThat(write(update)).containsEntry("coworkers.[0].firstname", "mat") - .containsEntry("coworkers.[0].age", "24") - .containsEntry("coworkers.[1].firstname", "perrin"); + assertThat(write(update)).containsEntry("coworkers.[0].firstname", "mat").containsEntry("coworkers.[0].age", "24") + .containsEntry("coworkers.[1].firstname", "perrin"); } @Test // DATAREDIS-471 @@ -1634,8 +1626,7 @@ void writeShouldWritePartialUpdatePathWithComplexListValueWhenNotPassedInAsColle PartialUpdate update = new PartialUpdate<>("123", Person.class).set("coworkers", mat); - assertThat(write(update)).containsEntry("coworkers.[0].firstname", "mat") - .containsEntry("coworkers.[0].age", "24"); + assertThat(write(update)).containsEntry("coworkers.[0].firstname", "mat").containsEntry("coworkers.[0].age", "24"); } @Test // DATAREDIS-471 @@ -1655,15 +1646,14 @@ void writeShouldWritePartialUpdatePathWithComplexListValueWhenNotPassedInAsColle PartialUpdate update = new PartialUpdate<>("123", Person.class).set("coworkers.[5]", mat); - assertThat(write(update)).containsEntry("coworkers.[5].firstname", "mat") - .containsEntry("coworkers.[5].age", "24"); + assertThat(write(update)).containsEntry("coworkers.[5].firstname", "mat").containsEntry("coworkers.[5].age", "24"); } @Test // DATAREDIS-471 void writeShouldWritePartialUpdatePathWithSimpleMapValueCorrectly() { PartialUpdate update = new PartialUpdate<>("123", Person.class).set("physicalAttributes", - Collections.singletonMap("eye-color", "grey")); + Collections.singletonMap("eye-color", "grey")); assertThat(write(update)).containsEntry("physicalAttributes.[eye-color]", "grey"); } @@ -1676,17 +1666,17 @@ void writeShouldWritePartialUpdatePathWithComplexMapValueCorrectly() { tam.alive = false; PartialUpdate update = new PartialUpdate<>("123", Person.class).set("relatives", - Collections.singletonMap("father", tam)); + Collections.singletonMap("father", tam)); assertThat(write(update)).containsEntry("relatives.[father].firstname", "tam") - .containsEntry("relatives.[father].alive", "0"); + .containsEntry("relatives.[father].alive", "0"); } @Test // DATAREDIS-471 void writeShouldWritePartialUpdatePathWithSimpleMapValueWhenNotPassedInAsCollectionCorrectly() { PartialUpdate update = new PartialUpdate<>("123", Person.class).set("physicalAttributes", - Collections.singletonMap("eye-color", "grey").entrySet().iterator().next()); + Collections.singletonMap("eye-color", "grey").entrySet().iterator().next()); assertThat(write(update)).containsEntry("physicalAttributes.[eye-color]", "grey"); } @@ -1699,17 +1689,17 @@ void writeShouldWritePartialUpdatePathWithComplexMapValueWhenNotPassedInAsCollec tam.alive = false; PartialUpdate update = new PartialUpdate<>("123", Person.class).set("relatives", - Collections.singletonMap("father", tam).entrySet().iterator().next()); + Collections.singletonMap("father", tam).entrySet().iterator().next()); assertThat(write(update)).containsEntry("relatives.[father].firstname", "tam") - .containsEntry("relatives.[father].alive", "0"); + .containsEntry("relatives.[father].alive", "0"); } @Test // DATAREDIS-471 void writeShouldWritePartialUpdatePathWithSimpleMapValueWhenNotPassedInAsCollectionWithPositionalParameterCorrectly() { PartialUpdate update = new PartialUpdate<>("123", Person.class).set("physicalAttributes.[eye-color]", - "grey"); + "grey"); assertThat(write(update)).containsEntry("physicalAttributes.[eye-color]", "grey"); } @@ -1717,8 +1707,7 @@ void writeShouldWritePartialUpdatePathWithSimpleMapValueWhenNotPassedInAsCollect @Test // DATAREDIS-471 void writeShouldWritePartialUpdatePathWithSimpleMapValueOnNestedElementCorrectly() { - PartialUpdate update = new PartialUpdate<>("123", Person.class).set("relatives.[father].firstname", - "tam"); + PartialUpdate update = new PartialUpdate<>("123", Person.class).set("relatives.[father].firstname", "tam"); assertThat(write(update)).containsEntry("relatives.[father].firstname", "tam"); } @@ -1736,7 +1725,7 @@ void writeShouldWritePartialUpdatePathWithRegisteredCustomConversionCorrectly() this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new AddressToBytesConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new AddressToBytesConverter()))); this.converter.afterPropertiesSet(); Address address = new Address(); @@ -1760,13 +1749,11 @@ void writeShouldWritePartialUpdatePathWithReferenceCorrectly() { tear.id = "2"; tear.name = "city of tear"; - PartialUpdate update = new PartialUpdate<>("123", Person.class).set("visited", - Arrays.asList(tar, tear)); + PartialUpdate update = new PartialUpdate<>("123", Person.class).set("visited", Arrays.asList(tar, tear)); - assertThat(write(update)).containsEntry("visited.[0]", "locations:1") - .containsEntry("visited.[1]", "locations:2") // - .without("visited.id") // - .without("visited.name"); + assertThat(write(update)).containsEntry("visited.[0]", "locations:1").containsEntry("visited.[1]", "locations:2") // + .without("visited.id") // + .without("visited.name"); } @Test // DATAREDIS-471 @@ -1777,65 +1764,65 @@ void writeShouldWritePartialUpdatePathWithListOfReferencesCorrectly() { location.name = "tar valon"; PartialUpdate update = new PartialUpdate<>("123", Person.class) // - .set("location", location); + .set("location", location); assertThat(write(update)).containsEntry("location", "locations:1") // - .without("location.id") // - .without("location.name"); + .without("location.id") // + .without("location.name"); } @Test // DATAREDIS-471 void writeShouldThrowExceptionForUpdateValueNotAssignableToDomainTypeProperty() { PartialUpdate update = new PartialUpdate<>("123", Person.class) // - .set("age", "twenty-four"); + .set("age", "twenty-four"); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> write(update)) - .withMessageContaining("java.lang.String cannot be assigned"); + .withMessageContaining("java.lang.String cannot be assigned"); } @Test // DATAREDIS-471 void writeShouldThrowExceptionForUpdateCollectionValueNotAssignableToDomainTypeProperty() { PartialUpdate update = new PartialUpdate<>("123", Person.class) // - .set("coworkers.[0]", "buh buh the bear"); + .set("coworkers.[0]", "buh buh the bear"); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> write(update)) - .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) - .withMessageContaining("coworkers.[0]"); + .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) + .withMessageContaining("coworkers.[0]"); } @Test // DATAREDIS-471 void writeShouldThrowExceptionForUpdateValueInCollectionNotAssignableToDomainTypeProperty() { PartialUpdate update = new PartialUpdate<>("123", Person.class) // - .set("coworkers", Collections.singletonList("foo")); + .set("coworkers", Collections.singletonList("foo")); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> write(update)) - .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) - .withMessageContaining("coworkers"); + .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) + .withMessageContaining("coworkers"); } @Test // DATAREDIS-471 void writeShouldThrowExceptionForUpdateMapValueNotAssignableToDomainTypeProperty() { PartialUpdate update = new PartialUpdate<>("123", Person.class) // - .set("relatives.[father]", "buh buh the bear"); + .set("relatives.[father]", "buh buh the bear"); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> write(update)) - .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) - .withMessageContaining("relatives.[father]"); + .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) + .withMessageContaining("relatives.[father]"); } @Test // DATAREDIS-471 void writeShouldThrowExceptionForUpdateValueInMapNotAssignableToDomainTypeProperty() { PartialUpdate update = new PartialUpdate<>("123", Person.class) // - .set("relatives", Collections.singletonMap("father", "buh buh the bear")); + .set("relatives", Collections.singletonMap("father", "buh buh the bear")); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> write(update)) - .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) - .withMessageContaining("relatives.[father]"); + .withMessageContaining("java.lang.String cannot be assigned").withMessageContaining(Person.class.getName()) + .withMessageContaining("relatives.[father]"); } @Test // DATAREDIS-875 @@ -1908,8 +1895,7 @@ void writeEntityWithCustomConverter() { this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions( - new RedisCustomConversions(Collections.singletonList(new AccountInfoToBytesConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new AccountInfoToBytesConverter()))); this.converter.afterPropertiesSet(); AccountInfo accountInfo = new AccountInfo(); @@ -1925,8 +1911,7 @@ void readEntityWithCustomConverter() { this.converter = new MappingRedisConverter(null, null, resolverMock); this.converter - .setCustomConversions( - new RedisCustomConversions(Collections.singletonList(new BytesToAccountInfoConverter()))); + .setCustomConversions(new RedisCustomConversions(Collections.singletonList(new BytesToAccountInfoConverter()))); this.converter.afterPropertiesSet(); Bucket bucket = new Bucket(); @@ -1949,11 +1934,11 @@ void writeGenericEntity() { generic.entity = new User("hello"); assertThat(write(generic)).hasSize(3) // - .containsEntry("_class", - "org.springframework.data.redis.core.convert.MappingRedisConverterUnitTests$WithGenericEntity") - .containsEntry("entity.name", "hello") // - .containsEntry("entity._class", - "org.springframework.data.redis.core.convert.MappingRedisConverterUnitTests$User"); + .containsEntry("_class", + "org.springframework.data.redis.core.convert.MappingRedisConverterUnitTests$WithGenericEntity") + .containsEntry("entity.name", "hello") // + .containsEntry("entity._class", + "org.springframework.data.redis.core.convert.MappingRedisConverterUnitTests$User"); } @Test // GH-2349 @@ -1962,7 +1947,7 @@ void readGenericEntity() { Bucket bucket = new Bucket(); bucket.put("entity.name", "hello".getBytes()); bucket.put("entity._class", - "org.springframework.data.redis.core.convert.MappingRedisConverterUnitTests$User".getBytes()); + "org.springframework.data.redis.core.convert.MappingRedisConverterUnitTests$User".getBytes()); RedisData redisData = new RedisData(bucket); redisData.setKeyspace(KEYSPACE_ACCOUNT); @@ -1976,16 +1961,16 @@ void readGenericEntity() { @Test // DATAREDIS-1175 @EnabledOnJre(JRE.JAVA_8) - // FIXME: https://github.com/spring-projects/spring-data-redis/issues/2168 + // FIXME: https://github.com/spring-projects/spring-data-redis/issues/2168 void writePlainList() { List source = Arrays.asList("Hello", "stream", "message", 100L); RedisTestData target = write(source); assertThat(target).containsEntry("[0]", "Hello") // - .containsEntry("[1]", "stream") // - .containsEntry("[2]", "message") // - .containsEntry("[3]", "100"); + .containsEntry("[1]", "stream") // + .containsEntry("[2]", "message") // + .containsEntry("[3]", "100"); } @Test // DATAREDIS-1175 @@ -2027,8 +2012,8 @@ static class AddressToBytesConverter implements Converter { mapper = new ObjectMapper(); mapper.setVisibility(mapper.getSerializationConfig().getDefaultVisibilityChecker() - .withFieldVisibility(Visibility.ANY).withGetterVisibility(Visibility.NONE) - .withSetterVisibility(Visibility.NONE).withCreatorVisibility(Visibility.NONE)); + .withFieldVisibility(Visibility.ANY).withGetterVisibility(Visibility.NONE) + .withSetterVisibility(Visibility.NONE).withCreatorVisibility(Visibility.NONE)); serializer = new Jackson2JsonRedisSerializer<>(Address.class); serializer.setObjectMapper(mapper); @@ -2055,7 +2040,7 @@ public Map convert(Species source) { map.put("species-name", source.name.getBytes(Charset.forName("UTF-8"))); } map.put("species-nicknames", - StringUtils.collectionToCommaDelimitedString(source.alsoKnownAs).getBytes(Charset.forName("UTF-8"))); + StringUtils.collectionToCommaDelimitedString(source.alsoKnownAs).getBytes(Charset.forName("UTF-8"))); return map; } } @@ -2077,8 +2062,7 @@ public Species convert(Map source) { } if (source.containsKey("species-nicknames")) { species.alsoKnownAs = Arrays.asList(StringUtils - .commaDelimitedListToStringArray( - new String(source.get("species-nicknames"), Charset.forName("UTF-8")))); + .commaDelimitedListToStringArray(new String(source.get("species-nicknames"), Charset.forName("UTF-8")))); } return species; } @@ -2094,8 +2078,8 @@ static class BytesToAddressConverter implements Converter { mapper = new ObjectMapper(); mapper.setVisibility(mapper.getSerializationConfig().getDefaultVisibilityChecker() - .withFieldVisibility(Visibility.ANY).withGetterVisibility(Visibility.NONE) - .withSetterVisibility(Visibility.NONE).withCreatorVisibility(Visibility.NONE)); + .withFieldVisibility(Visibility.ANY).withGetterVisibility(Visibility.NONE) + .withSetterVisibility(Visibility.NONE).withCreatorVisibility(Visibility.NONE)); serializer = new Jackson2JsonRedisSerializer<>(Address.class); serializer.setObjectMapper(mapper); @@ -2114,7 +2098,7 @@ static class AccountInfoToBytesConverter implements Converter indexes = indexResolver - .resolveIndexesFor(TypeInformation.of(PersonWithAddressReference.class), rand); + Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(PersonWithAddressReference.class), + rand); assertThat(indexes).isEmpty(); } @@ -381,8 +381,7 @@ void resolveIndexOnMapField() { source.values.put("jon", "snow"); source.values.put("arya", "stark"); - Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(IndexedOnMapField.class), - source); + Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(IndexedOnMapField.class), source); assertThat(indexes).hasSize(2); assertThat(indexes).contains( @@ -399,8 +398,7 @@ void resolveIndexOnListField() { source.values.add("jon"); source.values.add("arya"); - Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(IndexedOnListField.class), - source); + Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(IndexedOnListField.class), source); assertThat(indexes).hasSize(2); assertThat(indexes).contains(new SimpleIndexedPropertyValue(IndexedOnListField.class.getName(), "values", "jon"), @@ -413,8 +411,8 @@ void resolveIndexOnPrimitiveArrayField() { IndexedOnPrimitiveArrayField source = new IndexedOnPrimitiveArrayField(); source.values = new int[] { 1, 2, 3 }; - Set indexes = indexResolver - .resolveIndexesFor(TypeInformation.of(IndexedOnPrimitiveArrayField.class), source); + Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(IndexedOnPrimitiveArrayField.class), + source); assertThat(indexes).hasSize(3); assertThat(indexes).contains( @@ -453,8 +451,7 @@ void resolveGeoIndexOnPointField() { GeoIndexedOnPoint source = new GeoIndexedOnPoint(); source.location = new Point(1D, 2D); - Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(GeoIndexedOnPoint.class), - source); + Set indexes = indexResolver.resolveIndexesFor(TypeInformation.of(GeoIndexedOnPoint.class), source); assertThat(indexes).hasSize(1); assertThat(indexes) diff --git a/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java b/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java index 75c5d8a85e..e5ea988555 100644 --- a/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/index/IndexConfigurationUnitTests.java @@ -45,8 +45,8 @@ void redisIndexSettingIndexNameExplicit() { void redisIndexSettingIndexNameUsedInEquals() { SimpleIndexDefinition setting1 = new SimpleIndexDefinition("keyspace", "path", "indexName1"); - SimpleIndexDefinition setting2 = new SimpleIndexDefinition(setting1.getKeyspace(), "path", setting1.getIndexName() - + "other"); + SimpleIndexDefinition setting2 = new SimpleIndexDefinition(setting1.getKeyspace(), "path", + setting1.getIndexName() + "other"); assertThat(setting1).isNotEqualTo(setting2); } @@ -55,8 +55,8 @@ void redisIndexSettingIndexNameUsedInEquals() { void redisIndexSettingIndexNameUsedInHashCode() { SimpleIndexDefinition setting1 = new SimpleIndexDefinition("keyspace", "path", "indexName1"); - SimpleIndexDefinition setting2 = new SimpleIndexDefinition(setting1.getKeyspace(), "path", setting1.getIndexName() - + "other"); + SimpleIndexDefinition setting2 = new SimpleIndexDefinition(setting1.getKeyspace(), "path", + setting1.getIndexName() + "other"); assertThat(setting1.hashCode()).isNotEqualTo(setting2.hashCode()); } diff --git a/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.java b/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.java index a353d50573..6be3b6fdab 100644 --- a/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/mapping/BasicRedisPersistentEntityUnitTests.java @@ -55,7 +55,6 @@ void setUp() { @Test // DATAREDIS-425 void addingMultipleIdPropertiesWithoutAnExplicitOneThrowsException() { - RedisPersistentProperty property1 = mock(RedisPersistentProperty.class); when(property1.isIdProperty()).thenReturn(true); @@ -65,8 +64,7 @@ void addingMultipleIdPropertiesWithoutAnExplicitOneThrowsException() { entity.addPersistentProperty(property1); assertThatExceptionOfType(MappingException.class).isThrownBy(() -> entity.addPersistentProperty(property2)) - .withMessageContaining("Attempt to add id property") - .withMessageContaining("but already have a property"); + .withMessageContaining("Attempt to add id property").withMessageContaining("but already have a property"); } @Test // DATAREDIS-425 diff --git a/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java b/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java index 29f8804012..64809d2621 100644 --- a/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/mapping/ConfigAwareTimeToLiveAccessorUnitTests.java @@ -148,8 +148,7 @@ void getTimeToLiveShouldReturnMethodLevelTimeToLiveOfNonPublicTypeIfPresent() { @Test // DATAREDIS-471 void getTimeToLiveShouldReturnDefaultValue() { - Long ttl = accessor - .getTimeToLive(new PartialUpdate<>("123", new TypeWithRedisHashAnnotation())); + Long ttl = accessor.getTimeToLive(new PartialUpdate<>("123", new TypeWithRedisHashAnnotation())); assertThat(ttl).isEqualTo(5L); } @@ -158,8 +157,7 @@ void getTimeToLiveShouldReturnDefaultValue() { void getTimeToLiveShouldReturnValueWhenUpdateModifiesTtlProperty() { Long ttl = accessor - .getTimeToLive(new PartialUpdate<>("123", new SimpleTypeWithTTLProperty()) - .set("ttl", 100).refreshTtl(true)); + .getTimeToLive(new PartialUpdate<>("123", new SimpleTypeWithTTLProperty()).set("ttl", 100).refreshTtl(true)); assertThat(ttl).isEqualTo(100L); } @@ -168,8 +166,7 @@ void getTimeToLiveShouldReturnValueWhenUpdateModifiesTtlProperty() { void getTimeToLiveShouldReturnPropertyValueWhenUpdateModifiesTtlProperty() { Long ttl = accessor.getTimeToLive( - new PartialUpdate<>("123", - new TypeWithRedisHashAnnotationAndTTLProperty()).set("ttl", 100).refreshTtl(true)); + new PartialUpdate<>("123", new TypeWithRedisHashAnnotationAndTTLProperty()).set("ttl", 100).refreshTtl(true)); assertThat(ttl).isEqualTo(100L); } @@ -178,8 +175,7 @@ void getTimeToLiveShouldReturnPropertyValueWhenUpdateModifiesTtlProperty() { void getTimeToLiveShouldReturnDefaultValueWhenUpdateDoesNotModifyTtlProperty() { Long ttl = accessor - .getTimeToLive(new PartialUpdate<>("123", - new TypeWithRedisHashAnnotationAndTTLProperty()).refreshTtl(true)); + .getTimeToLive(new PartialUpdate<>("123", new TypeWithRedisHashAnnotationAndTTLProperty()).refreshTtl(true)); assertThat(ttl).isEqualTo(10L); } diff --git a/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.java b/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.java index 3676c27c24..0bea7eb9e7 100644 --- a/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/DefaultReactiveScriptExecutorTests.java @@ -223,14 +223,14 @@ void executeAddsScriptToScriptCache() { assertThat(stringTemplate.execute( (RedisCallback>) connection -> connection.scriptingCommands().scriptExists(script.getSha1()))) - .containsExactly(false); + .containsExactly(false); stringScriptExecutor.execute(script, Collections.emptyList()).as(StepVerifier::create).expectNext("HELLO") .verifyComplete(); assertThat(stringTemplate.execute( (RedisCallback>) connection -> connection.scriptingCommands().scriptExists(script.getSha1()))) - .containsExactly(true); + .containsExactly(true); stringScriptExecutor.execute(script, Collections.emptyList()).as(StepVerifier::create).expectNext("HELLO") .verifyComplete(); diff --git a/src/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java b/src/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java index 82a288fd8d..f06b5f9161 100644 --- a/src/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/script/DefaultScriptExecutorUnitTests.java @@ -77,8 +77,8 @@ void excuteShouldNotCallEvalWhenSha1Exists() { @Test // DATAREDIS-347 void excuteShouldUseEvalInCaseNoSha1PresentForGivenScript() { - when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())).thenThrow( - new RedisSystemException("NOSCRIPT No matching script; Please use EVAL.", new Exception())); + when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())) + .thenThrow(new RedisSystemException("NOSCRIPT No matching script; Please use EVAL.", new Exception())); executor.execute(SCRIPT, null); @@ -88,8 +88,8 @@ void excuteShouldUseEvalInCaseNoSha1PresentForGivenScript() { @Test // DATAREDIS-347 void excuteShouldThrowExceptionInCaseEvalShaFailsWithOtherThanRedisSystemException() { - when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())).thenThrow( - new UnsupportedOperationException("NOSCRIPT No matching script; Please use EVAL.", new Exception())); + when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())) + .thenThrow(new UnsupportedOperationException("NOSCRIPT No matching script; Please use EVAL.", new Exception())); assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> executor.execute(SCRIPT, null)); } @@ -97,8 +97,8 @@ void excuteShouldThrowExceptionInCaseEvalShaFailsWithOtherThanRedisSystemExcepti @Test // DATAREDIS-347 void excuteShouldThrowExceptionInCaseEvalShaFailsWithAlthoughTheScriptExists() { - when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())).thenThrow( - new RedisSystemException("Found Script but could not execute it.", new Exception())); + when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())) + .thenThrow(new RedisSystemException("Found Script but could not execute it.", new Exception())); assertThatExceptionOfType(RedisSystemException.class).isThrownBy(() -> executor.execute(SCRIPT, null)); } diff --git a/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java b/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java index d9657bf247..ed57509c3f 100644 --- a/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java +++ b/src/test/java/org/springframework/data/redis/core/types/ExpirationUnitTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.core.types; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.time.Duration; import java.util.concurrent.TimeUnit; diff --git a/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java b/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java index ddf8fdd66b..54853b42b0 100644 --- a/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/listener/KeyExpirationEventMessageListenerIntegrationTests.java @@ -27,12 +27,10 @@ import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.springframework.beans.factory.DisposableBean; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEventPublisher; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jedis.extension.JedisConnectionFactoryExtension; import org.springframework.data.redis.test.extension.RedisStanalone; diff --git a/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.java b/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.java index f22ff8e560..15ccb4dba0 100644 --- a/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/listener/ReactiveRedisMessageListenerContainerUnitTests.java @@ -90,8 +90,8 @@ void shouldSubscribeToMultiplePatterns() { when(subscriptionMock.receive()).thenReturn(Flux.never()); container = createContainer(); - container.receive(Topic.pattern("foo*"), Topic.pattern("bar*")).as(StepVerifier::create).thenRequest(1) - .thenAwait().thenCancel().verify(); + container.receive(Topic.pattern("foo*"), Topic.pattern("bar*")).as(StepVerifier::create).thenRequest(1).thenAwait() + .thenCancel().verify(); verify(subscriptionMock).pSubscribe(getByteBuffer("foo*"), getByteBuffer("bar*")); } diff --git a/src/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.java b/src/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.java index 876118bd60..4d4170273b 100644 --- a/src/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/listener/adapter/MessageListenerUnitTests.java @@ -66,8 +66,7 @@ void setUp() { } @Test - void testThatWhenNoDelegateIsSuppliedTheDelegateIsAssumedToBeTheMessageListenerAdapterItself() - throws Exception { + void testThatWhenNoDelegateIsSuppliedTheDelegateIsAssumedToBeTheMessageListenerAdapterItself() throws Exception { assertThat(adapter.getDelegate()).isSameAs(adapter); } diff --git a/src/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.java b/src/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.java index 63788ffa7a..2906a3f51a 100644 --- a/src/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.java +++ b/src/test/java/org/springframework/data/redis/listener/adapter/RedisMDP.java @@ -20,9 +20,7 @@ */ public class RedisMDP { - public void handleMessage(String message) { - } + public void handleMessage(String message) {} - public void anotherHandle(String message) { - } + public void anotherHandle(String message) {} } diff --git a/src/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.java b/src/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.java index 301056e3ea..59e8832f66 100644 --- a/src/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/BeanUtilsHashMapperTests.java @@ -15,10 +15,9 @@ */ package org.springframework.data.redis.mapping; -import org.junit.jupiter.api.Test; - import static org.assertj.core.api.Assertions.*; +import org.junit.jupiter.api.Test; import org.springframework.data.redis.hash.BeanUtilsHashMapper; diff --git a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.java index 5e5e2c95cf..4b1b0fd124 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperFlatteningUnitTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.mapping; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.time.LocalDateTime; import java.time.Month; @@ -39,16 +39,14 @@ public class Jackson2HashMapperFlatteningUnitTests extends Jackson2HashMapperUni @Test // GH-2593 void timestampHandledCorrectly() { - Map hash = - Map.of("@class", Session.class.getName(), "lastAccessed", "2023-06-05T18:36:30"); + Map hash = Map.of("@class", Session.class.getName(), "lastAccessed", "2023-06-05T18:36:30"); - //Map hash = Map.of("lastAccessed", "2023-06-05T18:36:30"); + // Map hash = Map.of("lastAccessed", "2023-06-05T18:36:30"); Session session = (Session) getMapper().fromHash(hash); assertThat(session).isNotNull(); - assertThat(session.lastAccessed).isEqualTo(LocalDateTime.of(2023, Month.JUNE, 5, - 18, 36, 30)); + assertThat(session.lastAccessed).isEqualTo(LocalDateTime.of(2023, Month.JUNE, 5, 18, 36, 30)); } private static class Session { diff --git a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.java index 8b96474031..4db9d45f98 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperIntegrationTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.mapping; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.util.ArrayList; import java.util.Arrays; @@ -93,13 +93,11 @@ public void shouldWriteReadHashCorrectly() { @ParameterizedRedisTest // GH-2565 public void shouldPreserveListPropertyOrderOnHashedSource() { - User jonDoe = User.as("Jon Doe") - .withPhoneNumber(9, 7, 1, 5, 5, 5, 4, 1, 8, 2); + User jonDoe = User.as("Jon Doe").withPhoneNumber(9, 7, 1, 5, 5, 5, 4, 1, 8, 2); template.opsForHash().putAll("JON-DOE", mapper.toHash(jonDoe)); - User deserializedJonDoe = - (User) mapper.fromHash(template.opsForHash().entries("JON-DOE")); + User deserializedJonDoe = (User) mapper.fromHash(template. opsForHash().entries("JON-DOE")); assertThat(deserializedJonDoe).isNotNull(); assertThat(deserializedJonDoe).isNotSameAs(jonDoe); @@ -116,7 +114,7 @@ static User as(String name) { private String name; private List phoneNumber; - User() { } + User() {} User(String name) { this.name = name; @@ -155,7 +153,7 @@ public boolean equals(Object obj) { } return Objects.equals(this.getName(), that.getName()) - && Objects.equals(this.getPhoneNumber(), that.getPhoneNumber()); + && Objects.equals(this.getPhoneNumber(), that.getPhoneNumber()); } @Override diff --git a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.java index 688058c0ce..2655475793 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperNonFlatteningUnitTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.mapping; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.time.LocalDateTime; import java.time.Month; @@ -40,16 +40,13 @@ public class Jackson2HashMapperNonFlatteningUnitTests extends Jackson2HashMapper @Test // GH-2593 void timestampHandledCorrectly() { - Map hash = Map.of( - "@class", Session.class.getName(), - "lastAccessed", Arrays.asList(LocalDateTime.class.getName(), "2023-06-05T18:36:30") - ); + Map hash = Map.of("@class", Session.class.getName(), "lastAccessed", + Arrays.asList(LocalDateTime.class.getName(), "2023-06-05T18:36:30")); Session session = (Session) getMapper().fromHash(hash); assertThat(session).isNotNull(); - assertThat(session.lastAccessed).isEqualTo(LocalDateTime.of(2023, Month.JUNE, 5, - 18, 36, 30)); + assertThat(session.lastAccessed).isEqualTo(LocalDateTime.of(2023, Month.JUNE, 5, 18, 36, 30)); } private static class Session { diff --git a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.java b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.java index 5b8f392619..ee09d91ae1 100644 --- a/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/Jackson2HashMapperUnitTests.java @@ -254,8 +254,8 @@ public boolean equals(Object obj) { } return Objects.equals(this.getObjects(), that.getObjects()) - && Objects.equals(this.getPersons(), that.getPersons()) - && Objects.equals(this.getStrings(), that.getStrings()); + && Objects.equals(this.getPersons(), that.getPersons()) + && Objects.equals(this.getStrings(), that.getStrings()); } @Override @@ -306,8 +306,8 @@ public boolean equals(Object obj) { } return Objects.equals(this.getObjects(), that.getObjects()) - && Objects.equals(this.getPersons(), that.getPersons()) - && Objects.equals(this.getStrings(), that.getStrings()); + && Objects.equals(this.getPersons(), that.getPersons()) + && Objects.equals(this.getStrings(), that.getStrings()); } @Override @@ -376,10 +376,9 @@ public boolean equals(Object obj) { } return Objects.equals(this.getString(), that.getString()) - && Objects.equals(this.getCalendar(), that.getCalendar()) - && Objects.equals(this.getDate(), that.getDate()) - && Objects.equals(this.getLocalDate(), that.getLocalDate()) - && Objects.equals(this.getLocalDateTime(), that.getLocalDateTime()); + && Objects.equals(this.getCalendar(), that.getCalendar()) && Objects.equals(this.getDate(), that.getDate()) + && Objects.equals(this.getLocalDate(), that.getLocalDate()) + && Objects.equals(this.getLocalDateTime(), that.getLocalDateTime()); } @Override @@ -420,8 +419,7 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getBigD(), that.getBigD()) - && Objects.equals(this.getBigI(), that.getBigI()); + return Objects.equals(this.getBigD(), that.getBigD()) && Objects.equals(this.getBigI(), that.getBigI()); } @Override diff --git a/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java b/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java index 823338e187..31a83249ad 100644 --- a/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java +++ b/src/test/java/org/springframework/data/redis/mapping/ObjectHashMapperTests.java @@ -15,8 +15,7 @@ */ package org.springframework.data.redis.mapping; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.*; import java.util.Collections; import java.util.Map; diff --git a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java index b8623bb2e9..6f9755c591 100644 --- a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryClusterIntegrationTests.java @@ -50,8 +50,8 @@ class RedisRepositoryClusterIntegrationTests extends RedisRepositoryIntegrationT @Configuration @EnableRedisRepositories(considerNestedRepositories = true, indexConfiguration = MyIndexConfiguration.class, keyspaceConfiguration = MyKeyspaceConfiguration.class, - includeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, - classes = { PersonRepository.class, CityRepository.class, ImmutableObjectRepository.class, UserRepository.class }) }) + includeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { PersonRepository.class, + CityRepository.class, ImmutableObjectRepository.class, UserRepository.class }) }) static class Config { @Bean diff --git a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java index 8437f2ef73..6a6af9eaa2 100644 --- a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java @@ -56,8 +56,8 @@ public class RedisRepositoryIntegrationTests extends RedisRepositoryIntegrationT @Configuration @EnableRedisRepositories(considerNestedRepositories = true, indexConfiguration = MyIndexConfiguration.class, keyspaceConfiguration = MyKeyspaceConfiguration.class, - includeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, - classes = { PersonRepository.class, CityRepository.class, ImmutableObjectRepository.class, UserRepository.class }) }) + includeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { PersonRepository.class, + CityRepository.class, ImmutableObjectRepository.class, UserRepository.class }) }) static class Config { @Bean diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java b/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java index 38cc84d46b..f4d1efbdf5 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/PersonDB.java @@ -22,7 +22,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - /** * @author Mark Paluch */ diff --git a/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java b/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java index 0f9701bc94..a467abaa8d 100644 --- a/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java +++ b/src/test/java/org/springframework/data/redis/repository/cdi/RepositoryConsumer.java @@ -23,7 +23,8 @@ class RepositoryConsumer { @Inject PersonRepository unqualifiedRepo; - @Inject @PersonDB PersonRepository qualifiedRepo; + @Inject + @PersonDB PersonRepository qualifiedRepo; public PersonRepository getUnqualifiedRepo() { return unqualifiedRepo; diff --git a/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoriesRegistrarUnitTests.java b/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoriesRegistrarUnitTests.java index be2356227a..bd675c063a 100644 --- a/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoriesRegistrarUnitTests.java +++ b/src/test/java/org/springframework/data/redis/repository/configuration/RedisRepositoriesRegistrarUnitTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.repository.configuration; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.util.Arrays; import java.util.stream.Stream; @@ -24,6 +24,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; + import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.DefaultListableBeanFactory; diff --git a/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.java b/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.java index 9a99d12538..f658cb57de 100644 --- a/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.java +++ b/src/test/java/org/springframework/data/redis/repository/query/ExampleQueryMapperUnitTests.java @@ -15,8 +15,7 @@ */ package org.springframework.data.redis.repository.query; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.*; import java.util.Arrays; import java.util.Collections; @@ -288,12 +287,9 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getFirstname(), that.getFirstname()) - && Objects.equals(this.getLastname(), that.getLastname()) - && Objects.equals(this.getAge(), that.getAge()) - && Objects.equals(this.getGender(), that.getGender()) - && Objects.equals(this.getSpecies(), that.getSpecies()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getFirstname(), that.getFirstname()) + && Objects.equals(this.getLastname(), that.getLastname()) && Objects.equals(this.getAge(), that.getAge()) + && Objects.equals(this.getGender(), that.getGender()) && Objects.equals(this.getSpecies(), that.getSpecies()); } @Override diff --git a/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.java b/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.java index 0c29bc6e6a..accbbf953d 100644 --- a/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/repository/support/QueryByExampleRedisExecutorIntegrationTests.java @@ -318,7 +318,7 @@ static class Person { private String lastname; private City hometown; - Person() { } + Person() {} Person(String firstname, String lastname) { this.firstname = firstname; @@ -368,10 +368,9 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.getId(), that.getId()) - && Objects.equals(this.getFirstname(), that.getFirstname()) - && Objects.equals(this.getLastname(), that.getLastname()) - && Objects.equals(this.getHometown(), that.getHometown()); + return Objects.equals(this.getId(), that.getId()) && Objects.equals(this.getFirstname(), that.getFirstname()) + && Objects.equals(this.getLastname(), that.getLastname()) + && Objects.equals(this.getHometown(), that.getHometown()); } @Override @@ -384,7 +383,7 @@ static class City { private @Indexed String name; - public City() { } + public City() {} public City(String name) { this.name = name; diff --git a/src/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.java b/src/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.java index 70f7d46615..a7dbf26ae8 100644 --- a/src/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/GenericJackson2JsonRedisSerializerUnitTests.java @@ -189,7 +189,8 @@ void deserializeShouldBeAbleToRestoreFinalObjectAfterSerialization() { assertThat(serializer.deserialize( ("{\"@class\":\"org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializerUnitTests$FinalObject\",\"longValue\":1,\"myArray\":[1,2,3],\n" + "\"simpleObject\":{\"@class\":\"org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializerUnitTests$SimpleObject\",\"longValue\":2}}") - .getBytes())).isEqualTo(source); + .getBytes())) + .isEqualTo(source); } @Test // GH-2361 @@ -231,7 +232,7 @@ void shouldConsiderWriter() { GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() .writer((mapper, source) -> { return mapper.writerWithView(Views.Basic.class).writeValueAsBytes(source); - }).build(); + }).build(); byte[] result = serializer.serialize(user); @@ -265,8 +266,7 @@ void shouldConsiderReader() { user.name = "Walter White"; GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() - .reader( - (mapper, source, type) -> { + .reader((mapper, source, type) -> { if (type.getRawClass() == User.class) { return mapper.readerWithView(Views.Basic.class).forType(type).readValue(source); } @@ -398,7 +398,8 @@ void deserializesEnumFromBytes() { GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer(); - assertThat(serializer.deserialize("\"TWO\"".getBytes(StandardCharsets.UTF_8), EnumType.class)).isEqualTo(EnumType.TWO); + assertThat(serializer.deserialize("\"TWO\"".getBytes(StandardCharsets.UTF_8), EnumType.class)) + .isEqualTo(EnumType.TWO); } @Test // GH-2396 @@ -407,9 +408,11 @@ void serializesJavaTimeIntoBytes() { GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer(); WithJsr310 source = new WithJsr310(); - source.myDate = java.time.LocalDate.of(2022,9,2); + source.myDate = java.time.LocalDate.of(2022, 9, 2); - assertThat(serializer.serialize(source)).isEqualTo(("{\"@class\":\"org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializerUnitTests$WithJsr310\",\"myDate\":[2022,9,2]}").getBytes(StandardCharsets.UTF_8)); + assertThat(serializer.serialize(source)).isEqualTo( + ("{\"@class\":\"org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializerUnitTests$WithJsr310\",\"myDate\":[2022,9,2]}") + .getBytes(StandardCharsets.UTF_8)); } @Test // GH-2396 @@ -417,8 +420,9 @@ void deserializesJavaTimeFrimBytes() { GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer(); - byte[] source = "{\"@class\":\"org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializerUnitTests$WithJsr310\",\"myDate\":[2022,9,2]}".getBytes(StandardCharsets.UTF_8); - assertThat(serializer.deserialize(source, WithJsr310.class).myDate).isEqualTo(java.time.LocalDate.of(2022,9,2)); + byte[] source = "{\"@class\":\"org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializerUnitTests$WithJsr310\",\"myDate\":[2022,9,2]}" + .getBytes(StandardCharsets.UTF_8); + assertThat(serializer.deserialize(source, WithJsr310.class).myDate).isEqualTo(java.time.LocalDate.of(2022, 9, 2)); } @Test // GH-2601 @@ -442,18 +446,15 @@ void internalObjectMapperCustomization() { @Test // GH-2601 void configureWithNullConsumerThrowsIllegalArgumentException() { - assertThatIllegalArgumentException() - .isThrownBy(() -> new GenericJackson2JsonRedisSerializer().configure(null)) - .withMessage("Consumer used to configure and customize ObjectMapper must not be null") - .withNoCause(); + assertThatIllegalArgumentException().isThrownBy(() -> new GenericJackson2JsonRedisSerializer().configure(null)) + .withMessage("Consumer used to configure and customize ObjectMapper must not be null").withNoCause(); } @Test void defaultSerializeAndDeserializeNullValueWithBuilderClass() { GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() - .objectMapper(new ObjectMapper().enableDefaultTyping(DefaultTyping.EVERYTHING, As.PROPERTY)) - .build(); + .objectMapper(new ObjectMapper().enableDefaultTyping(DefaultTyping.EVERYTHING, As.PROPERTY)).build(); serializeAndDeserializeNullValue(serializer); } @@ -477,8 +478,7 @@ public void serializeWithType(NullValue value, JsonGenerator jsonGenerator, Seri }; GenericJackson2JsonRedisSerializer serializer = GenericJackson2JsonRedisSerializer.builder() - .nullValueSerializer(nullValueSerializer) - .build(); + .nullValueSerializer(nullValueSerializer).build(); NullValue nv = BeanUtils.instantiateClass(NullValue.class); @@ -555,8 +555,7 @@ public boolean equals(@Nullable Object obj) { return false; } - return Objects.equals(this.simpleObject, that.simpleObject) - && Objects.equals(this.stringValue, that.stringValue); + return Objects.equals(this.simpleObject, that.simpleObject) && Objects.equals(this.stringValue, that.stringValue); } @Override @@ -607,8 +606,8 @@ public boolean equals(Object obj) { } return Objects.equals(this.getLongValue(), that.getLongValue()) - && Arrays.equals(this.getMyArray(), that.getMyArray()) - && Objects.equals(this.getSimpleObject(), that.getSimpleObject()); + && Arrays.equals(this.getMyArray(), that.getMyArray()) + && Objects.equals(this.getSimpleObject(), that.getSimpleObject()); } @Override @@ -658,12 +657,8 @@ static class User { @Override public String toString() { - return "User{" + - "id=" + id + - ", name='" + name + '\'' + - ", email='" + email + '\'' + - ", mobile='" + mobile + '\'' + - '}'; + return "User{" + "id=" + id + ", name='" + name + '\'' + ", email='" + email + '\'' + ", mobile='" + mobile + '\'' + + '}'; } } @@ -716,8 +711,8 @@ public boolean equals(Object obj) { } return Objects.equals(this.getCount(), that.getCount()) - && Objects.equals(this.getAvailable(), that.getAvailable()) - && Objects.equals(this.getArrayOfPrimitiveWrapper(), that.getArrayOfPrimitiveWrapper()); + && Objects.equals(this.getAvailable(), that.getAvailable()) + && Objects.equals(this.getArrayOfPrimitiveWrapper(), that.getArrayOfPrimitiveWrapper()); } @Override @@ -768,8 +763,8 @@ public boolean equals(Object obj) { } return Objects.equals(this.getPrimitiveWrapper(), that.getPrimitiveWrapper()) - && Objects.equals(this.getPrimitiveArrayWrapper(), that.getPrimitiveArrayWrapper()) - && Objects.equals(this.getSimpleObjectWrapper(), that.getSimpleObjectWrapper()); + && Objects.equals(this.getPrimitiveArrayWrapper(), that.getPrimitiveArrayWrapper()) + && Objects.equals(this.getSimpleObjectWrapper(), that.getSimpleObjectWrapper()); } @Override @@ -785,7 +780,6 @@ enum EnumType { static class WithJsr310 { @JsonSerialize(using = LocalDateSerializer.class) - @JsonDeserialize(using = LocalDateDeserializer.class) - private LocalDate myDate; + @JsonDeserialize(using = LocalDateDeserializer.class) private LocalDate myDate; } } diff --git a/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.java b/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.java index 0d15d0b23b..4e7f6cd0e8 100644 --- a/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/RedisSerializationContextUnitTests.java @@ -15,8 +15,7 @@ */ package org.springframework.data.redis.serializer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.assertj.core.api.Assertions.*; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @@ -37,9 +36,9 @@ void shouldRejectBuildIfKeySerializerIsNotSet() { assertThatIllegalArgumentException() .isThrownBy(() -> RedisSerializationContext. newSerializationContext() // - .value(StringRedisSerializer.UTF_8) // - .hashKey(StringRedisSerializer.UTF_8) // - .hashValue(StringRedisSerializer.UTF_8) // + .value(StringRedisSerializer.UTF_8) // + .hashKey(StringRedisSerializer.UTF_8) // + .hashValue(StringRedisSerializer.UTF_8) // .build()); } @@ -48,9 +47,9 @@ void shouldRejectBuildIfValueSerializerIsNotSet() { assertThatIllegalArgumentException() .isThrownBy(() -> RedisSerializationContext. newSerializationContext() // - .key(StringRedisSerializer.UTF_8) // - .hashKey(StringRedisSerializer.UTF_8) // - .hashValue(StringRedisSerializer.UTF_8) // + .key(StringRedisSerializer.UTF_8) // + .hashKey(StringRedisSerializer.UTF_8) // + .hashValue(StringRedisSerializer.UTF_8) // .build()); } @@ -59,9 +58,9 @@ void shouldRejectBuildIfHashKeySerializerIsNotSet() { assertThatIllegalArgumentException() .isThrownBy(() -> RedisSerializationContext. newSerializationContext() // - .key(StringRedisSerializer.UTF_8) // - .value(StringRedisSerializer.UTF_8) // - .hashValue(StringRedisSerializer.UTF_8) // + .key(StringRedisSerializer.UTF_8) // + .value(StringRedisSerializer.UTF_8) // + .hashValue(StringRedisSerializer.UTF_8) // .build()); } @@ -70,9 +69,9 @@ void shouldRejectBuildIfHashValueSerializerIsNotSet() { assertThatIllegalArgumentException() .isThrownBy(() -> RedisSerializationContext. newSerializationContext() // - .key(StringRedisSerializer.UTF_8) // - .value(StringRedisSerializer.UTF_8) // - .hashKey(StringRedisSerializer.UTF_8) // + .key(StringRedisSerializer.UTF_8) // + .value(StringRedisSerializer.UTF_8) // + .hashKey(StringRedisSerializer.UTF_8) // .build()); } @@ -80,7 +79,7 @@ void shouldRejectBuildIfHashValueSerializerIsNotSet() { @SuppressWarnings({ "rawtypes", "unchecked" }) void shouldUseDefaultIfSet() { - RedisSerializationContext.newSerializationContext(StringRedisSerializer.UTF_8) + RedisSerializationContext. newSerializationContext(StringRedisSerializer.UTF_8) .key(new GenericToStringSerializer(Long.class)) // .build(); } @@ -125,8 +124,7 @@ void shouldEncodeAndDecodeRawByteBufferValue() { RedisSerializationContext serializationContext = RedisSerializationContext.byteBuffer(); ByteBuffer deserialized = serializationContext.getValueSerializationPair() - .read(serializationContext.getValueSerializationPair() - .write(ByteBuffer.wrap("hello".getBytes()))); + .read(serializationContext.getValueSerializationPair().write(ByteBuffer.wrap("hello".getBytes()))); assertThat(deserialized).isEqualTo(ByteBuffer.wrap("hello".getBytes())); } @@ -137,8 +135,7 @@ void shouldEncodeAndDecodeByteArrayValue() { RedisSerializationContext serializationContext = RedisSerializationContext.byteArray(); byte[] deserialized = serializationContext.getValueSerializationPair() - .read(serializationContext.getValueSerializationPair() - .write("hello".getBytes())); + .read(serializationContext.getValueSerializationPair().write("hello".getBytes())); assertThat(deserialized).isEqualTo("hello".getBytes()); } @@ -146,8 +143,8 @@ void shouldEncodeAndDecodeByteArrayValue() { @Test // GH-2651 void shouldEncodeAndDecodeUtf8StringValue() { - RedisSerializationContext.SerializationPair serializationPair = - buildStringSerializationContext(StringRedisSerializer.UTF_8).getStringSerializationPair(); + RedisSerializationContext.SerializationPair serializationPair = buildStringSerializationContext( + StringRedisSerializer.UTF_8).getStringSerializationPair(); assertThat(serializationPair.write("üߨ")).isEqualTo(StandardCharsets.UTF_8.encode("üߨ")); assertThat(serializationPair.read(StandardCharsets.UTF_8.encode("üߨ"))).isEqualTo("üߨ"); @@ -156,18 +153,18 @@ void shouldEncodeAndDecodeUtf8StringValue() { @Test // GH-2651 void shouldEncodeAndDecodeAsciiStringValue() { - RedisSerializationContext.SerializationPair serializationPair = - buildStringSerializationContext(StringRedisSerializer.US_ASCII).getStringSerializationPair(); + RedisSerializationContext.SerializationPair serializationPair = buildStringSerializationContext( + StringRedisSerializer.US_ASCII).getStringSerializationPair(); assertThat(serializationPair.write("üߨ")).isEqualTo(StandardCharsets.US_ASCII.encode("???")); assertThat(serializationPair.read(StandardCharsets.US_ASCII.encode("üߨ"))).isEqualTo("???"); } - @Test // GH-2651 + @Test // GH-2651 void shouldEncodeAndDecodeIso88591StringValue() { - RedisSerializationContext.SerializationPair serializationPair = - buildStringSerializationContext(StringRedisSerializer.ISO_8859_1).getStringSerializationPair(); + RedisSerializationContext.SerializationPair serializationPair = buildStringSerializationContext( + StringRedisSerializer.ISO_8859_1).getStringSerializationPair(); assertThat(serializationPair.write("üߨ")).isEqualTo(StandardCharsets.ISO_8859_1.encode("üߨ")); assertThat(serializationPair.read(StandardCharsets.ISO_8859_1.encode("üߨ"))).isEqualTo("üߨ"); @@ -186,8 +183,7 @@ private RedisSerializationContext createSerializationContext() { private RedisSerializationContext buildStringSerializationContext( RedisSerializer stringSerializer) { - return RedisSerializationContext.newSerializationContext(stringSerializer) - .string(stringSerializer) + return RedisSerializationContext. newSerializationContext(stringSerializer).string(stringSerializer) .build(); } } diff --git a/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.java b/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.java index f76a4fa5d6..34fc71fac4 100644 --- a/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.java +++ b/src/test/java/org/springframework/data/redis/serializer/SimpleRedisSerializerTests.java @@ -15,7 +15,7 @@ */ package org.springframework.data.redis.serializer; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.*; import java.io.Serializable; import java.util.Objects; @@ -76,8 +76,7 @@ public boolean equals(Object obj) { return false; } - return Objects.equals(this.a, that.a) - && Objects.equals(this.name, that.name); + return Objects.equals(this.a, that.a) && Objects.equals(this.name, that.name); } @Override diff --git a/src/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.java b/src/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.java index 26318b1448..094f0d18b6 100644 --- a/src/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/stream/AbstractStreamMessageListenerContainerIntegrationTests.java @@ -397,9 +397,8 @@ private int getNumberOfPending(String stream, String group) { if (connection instanceof LettuceConnection lettuce) { - String value = ((List) lettuce.execute("XPENDING", - new NestedMultiOutput<>(StringCodec.UTF8), new byte[][] { stream.getBytes(), group.getBytes() })).get(0) - .toString(); + String value = ((List) lettuce.execute("XPENDING", new NestedMultiOutput<>(StringCodec.UTF8), + new byte[][] { stream.getBytes(), group.getBytes() })).get(0).toString(); return NumberUtils.parseNumber(value, Integer.class); } @@ -445,7 +444,7 @@ public boolean equals(Object obj) { } return Objects.equals(this.getFirstName(), that.getFirstName()) - && Objects.equals(this.getLastName(), that.getLastName()); + && Objects.equals(this.getLastName(), that.getLastName()); } @Override @@ -456,10 +455,7 @@ public int hashCode() { @Override public String toString() { - return "LoginEvent{" + - "firstname='" + firstName + '\'' + - ", lastname='" + lastName + '\'' + - '}'; + return "LoginEvent{" + "firstname='" + firstName + '\'' + ", lastname='" + lastName + '\'' + '}'; } } } diff --git a/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java b/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java index 48cc363879..5c89ced28c 100644 --- a/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/stream/StreamReceiverIntegrationTests.java @@ -327,7 +327,7 @@ public boolean equals(Object obj) { } return Objects.equals(this.getFirstName(), that.getFirstName()) - && Objects.equals(this.getLastName(), that.getLastName()); + && Objects.equals(this.getLastName(), that.getLastName()); } @Override @@ -338,10 +338,7 @@ public int hashCode() { @Override public String toString() { - return "LoginEvent{" + - "firstname='" + firstName + '\'' + - ", lastname='" + lastName + '\'' + - '}'; + return "LoginEvent{" + "firstname='" + firstName + '\'' + ", lastname='" + lastName + '\'' + '}'; } } } diff --git a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java index 15393f3cc6..53d975f616 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java @@ -18,13 +18,10 @@ import java.util.Arrays; import java.util.Collection; -import org.springframework.data.redis.connection.RedisStandaloneConfiguration; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jedis.extension.JedisConnectionFactoryExtension; -import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.lettuce.extension.LettuceConnectionFactoryExtension; -import org.springframework.data.redis.test.extension.LettuceTestClientResources; import org.springframework.data.redis.test.extension.RedisStanalone; /** diff --git a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.java index f8941ffe8a..3a95b5f209 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleIntegrationTests.java @@ -176,7 +176,6 @@ void testShouldThrowExceptionIfRedisAtomicDoubleIsUsedWithRedisTemplateAndNoKeyS @ParameterizedRedisTest // DATAREDIS-317 void testShouldThrowExceptionIfRedisAtomicDoubleIsUsedWithRedisTemplateAndNoValueSerializer() { - RedisTemplate template = new RedisTemplate<>(); template.setKeySerializer(StringRedisSerializer.UTF_8); diff --git a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java index 6fe195d0fc..ed8c2f9f18 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisCollectionUnitTests.java @@ -44,7 +44,7 @@ class AbstractRedisCollectionUnitTests { private AbstractRedisCollection collection; - @SuppressWarnings("rawtypes")// + @SuppressWarnings("rawtypes") // private RedisTemplate redisTemplateSpy; private @Mock RedisConnectionFactory connectionFactoryMock; private @Mock(answer = Answers.RETURNS_MOCKS) RedisConnection connectionMock; diff --git a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.java index 692a967c1f..70a6a172e5 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListIntegrationTests.java @@ -15,9 +15,7 @@ */ package org.springframework.data.redis.support.collections; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.assertj.core.api.Assertions.*; import java.util.ArrayList; import java.util.Arrays; @@ -29,6 +27,7 @@ import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.BeforeEach; + import org.springframework.data.redis.ObjectFactory; import org.springframework.data.redis.connection.RedisListCommands; import org.springframework.data.redis.core.RedisTemplate; diff --git a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.java index 8319ee373a..e54d109a14 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisSetIntegrationTests.java @@ -72,7 +72,7 @@ private RedisSet createSetFor(String key) { @ParameterizedRedisTest // GH-2037 @EnabledOnCommand("SMISMEMBER") void testContainsAll() { - + T t1 = getT(); T t2 = getT(); T t3 = getT(); @@ -324,7 +324,7 @@ void testScanWorksCorrectly() throws IOException { @ParameterizedRedisTest // GH-2049 void randMemberReturnsSomething() { - Object[] valuesArray = new Object[]{getT(), getT(), getT()}; + Object[] valuesArray = new Object[] { getT(), getT(), getT() }; collection.addAll((List) Arrays.asList(valuesArray)); diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.java index ecff984147..649a609619 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisCollectionFactoryBeanTests.java @@ -188,7 +188,7 @@ void usesBeanNameIfNoKeyProvided() { assertThat(fb.getObject()).satisfies(value -> { assertThat(value).isInstanceOf(RedisMap.class); - assertThat((RedisMap)value).containsEntry("k", "v"); + assertThat((RedisMap) value).containsEntry("k", "v"); }); } } diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.java index b54c1ba7ec..2ba5e827a8 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisMapIntegrationTests.java @@ -66,8 +66,7 @@ public static Collection testParams() { OxmSerializer serializer = XstreamOxmSerializerSingleton.getInstance(); Jackson2JsonRedisSerializer jackson2JsonSerializer = new Jackson2JsonRedisSerializer<>(Person.class); - Jackson2JsonRedisSerializer jackson2JsonStringSerializer = new Jackson2JsonRedisSerializer<>( - String.class); + Jackson2JsonRedisSerializer jackson2JsonStringSerializer = new Jackson2JsonRedisSerializer<>(String.class); StringRedisSerializer stringSerializer = StringRedisSerializer.UTF_8; // create Jedis Factory diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.java index be3e627a28..50e6db93f9 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesIntegrationTests.java @@ -190,8 +190,7 @@ public static Collection testParams() { OxmSerializer serializer = XstreamOxmSerializerSingleton.getInstance(); Jackson2JsonRedisSerializer jackson2JsonSerializer = new Jackson2JsonRedisSerializer<>(Person.class); - Jackson2JsonRedisSerializer jackson2JsonStringSerializer = new Jackson2JsonRedisSerializer<>( - String.class); + Jackson2JsonRedisSerializer jackson2JsonStringSerializer = new Jackson2JsonRedisSerializer<>(String.class); // create Jedis Factory ObjectFactory stringFactory = new StringObjectFactory(); @@ -239,15 +238,15 @@ public static Collection testParams() { { stringFactory, stringFactory, xstreamGenericTemplate }, // { stringFactory, stringFactory, jackson2JsonPersonTemplate }, // - // lettuce - { stringFactory, stringFactory, genericTemplateLtc }, // - { stringFactory, stringFactory, genericTemplateLtc }, // - { stringFactory, stringFactory, genericTemplateLtc }, // - { stringFactory, stringFactory, genericTemplateLtc }, // - { stringFactory, doubleFactory, genericTemplateLtc }, // - { stringFactory, longFactory, genericTemplateLtc }, // - { stringFactory, stringFactory, xGenericTemplateLtc }, // - { stringFactory, stringFactory, jackson2JsonPersonTemplateLtc } }); + // lettuce + { stringFactory, stringFactory, genericTemplateLtc }, // + { stringFactory, stringFactory, genericTemplateLtc }, // + { stringFactory, stringFactory, genericTemplateLtc }, // + { stringFactory, stringFactory, genericTemplateLtc }, // + { stringFactory, doubleFactory, genericTemplateLtc }, // + { stringFactory, longFactory, genericTemplateLtc }, // + { stringFactory, stringFactory, xGenericTemplateLtc }, // + { stringFactory, stringFactory, jackson2JsonPersonTemplateLtc } }); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.java index b7ec1f82d9..8bf9bbfee3 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisAvailableCondition.java @@ -57,11 +57,10 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con socket.connect(new InetSocketAddress(SettingsUtils.getHost(), annotation.value()), 100); - return enabled("Connection successful to Redis at %s:%d".formatted(SettingsUtils.getHost(), - annotation.value())); + return enabled("Connection successful to Redis at %s:%d".formatted(SettingsUtils.getHost(), annotation.value())); } catch (IOException ex) { - return disabled("Cannot connect to Redis at %s:%d (%s)".formatted(SettingsUtils.getHost(), - annotation.value(), ex)); + return disabled( + "Cannot connect to Redis at %s:%d (%s)".formatted(SettingsUtils.getHost(), annotation.value(), ex)); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.java index fe30380184..8e99f0e17f 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisClusterCondition.java @@ -52,8 +52,8 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con SettingsUtils.getClusterPort())); } - return disabled("Cannot connect to Redis Cluster at %s:%d".formatted(SettingsUtils.getHost(), - SettingsUtils.getClusterPort())); + return disabled( + "Cannot connect to Redis Cluster at %s:%d".formatted(SettingsUtils.getHost(), SettingsUtils.getClusterPort())); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.java index 68286b5e86..a95d810f18 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisDriverCondition.java @@ -81,8 +81,8 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con } if (!foundMatch) { - return disabled("Driver %s not supported; Supported driver(s): %s" - .formatted(formatUnsupportedDriver(value), Arrays.toString(annotation.value()))); + return disabled("Driver %s not supported; Supported driver(s): %s".formatted(formatUnsupportedDriver(value), + Arrays.toString(annotation.value()))); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.java index 26b2665d4d..45641820e2 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisSentinelCondition.java @@ -52,11 +52,10 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con if (RedisDetector.canConnectToPort(annotation.value())) { - return enabled("Connection successful to Redis Sentinel at %s:%d".formatted(SettingsUtils.getHost(), - annotation.value())); + return enabled( + "Connection successful to Redis Sentinel at %s:%d".formatted(SettingsUtils.getHost(), annotation.value())); } - return disabled("Cannot connect to Redis Sentinel at %s:%d".formatted(SettingsUtils.getHost(), - annotation.value())); + return disabled("Cannot connect to Redis Sentinel at %s:%d".formatted(SettingsUtils.getHost(), annotation.value())); } } diff --git a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.java b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.java index 5aec897431..aee466f02a 100644 --- a/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.java +++ b/src/test/java/org/springframework/data/redis/test/condition/EnabledOnRedisVersionCondition.java @@ -64,8 +64,8 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con boolean requiredVersionMet = conditions.hasVersionGreaterOrEqualsTo(requiredVersion); if (requiredVersionMet) { - return enabled("Enabled on version %s; actual version: %s".formatted(requiredVersion, - conditions.getRedisVersion())); + return enabled( + "Enabled on version %s; actual version: %s".formatted(requiredVersion, conditions.getRedisVersion())); } return disabled("Disabled; version %s not available on Redis version %s".formatted(requiredVersion, diff --git a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.java index 0e295527ed..4b3092de0a 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedRedisTestExtension.java @@ -61,8 +61,8 @@ public boolean supportsTestTemplate(ExtensionContext context) { ParameterizedTestContext methodContext = new ParameterizedTestContext(testMethod); ParameterizedTestContext constructorContext = new ParameterizedTestContext(declaredConstructor); - Preconditions.condition(methodContext.hasPotentiallyValidSignature(), () -> - ("@ParameterizedRedisTest method [%s] declares formal parameters in an invalid order: " + Preconditions.condition(methodContext.hasPotentiallyValidSignature(), + () -> ("@ParameterizedRedisTest method [%s] declares formal parameters in an invalid order: " + "argument aggregators must be declared after any indexed arguments " + "and before any arguments resolved by another ParameterResolver.") .formatted(testMethod.toGenericString())); @@ -98,9 +98,10 @@ public Stream provideTestTemplateInvocationContex } // @formatter:off - return hierarchy.stream().flatMap(it -> findRepeatableAnnotations(it, ArgumentsSource.class).stream() - .map(ArgumentsSource::value).map(this::instantiateArgumentsProvider) - .map(provider -> AnnotationConsumerInitializer.initialize(it, provider))) + return hierarchy.stream() + .flatMap(it -> findRepeatableAnnotations(it, ArgumentsSource.class).stream().map(ArgumentsSource::value) + .map(this::instantiateArgumentsProvider) + .map(provider -> AnnotationConsumerInitializer.initialize(it, provider))) .flatMap(provider -> arguments(provider, extensionContext)).map(Arguments::get) .map(arguments -> consumedArguments(arguments, methodContext)) .map(arguments -> createInvocationContext(formatter, constructorContext, methodContext, arguments)) @@ -138,8 +139,8 @@ private ParameterizedTestNameFormatter createNameFormatter(Method templateMethod ParameterizedRedisTest parameterizedTest = findAnnotation(templateMethod, ParameterizedRedisTest.class).get(); - String pattern = Preconditions.notBlank(parameterizedTest.name().trim(), () -> - "Configuration error: @ParameterizedRedisTest on method [%s] must be declared with a non-empty name" + String pattern = Preconditions.notBlank(parameterizedTest.name().trim(), + () -> "Configuration error: @ParameterizedRedisTest on method [%s] must be declared with a non-empty name" .formatted(templateMethod)); return new ParameterizedTestNameFormatter(pattern, displayName, methodContext, argumentMaxLength); diff --git a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.java b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.java index 7c02a0171f..049d991251 100644 --- a/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.java +++ b/src/test/java/org/springframework/data/redis/test/extension/parametrized/ParameterizedTestNameFormatter.java @@ -15,11 +15,8 @@ */ package org.springframework.data.redis.test.extension.parametrized; -import static java.util.stream.Collectors.joining; -import static org.junit.jupiter.params.ParameterizedTest.ARGUMENTS_PLACEHOLDER; -import static org.junit.jupiter.params.ParameterizedTest.ARGUMENTS_WITH_NAMES_PLACEHOLDER; -import static org.junit.jupiter.params.ParameterizedTest.DISPLAY_NAME_PLACEHOLDER; -import static org.junit.jupiter.params.ParameterizedTest.INDEX_PLACEHOLDER; +import static java.util.stream.Collectors.*; +import static org.junit.jupiter.params.ParameterizedTest.*; import java.text.Format; import java.text.MessageFormat; diff --git a/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java b/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java index f808bb23a6..3490e5523f 100644 --- a/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java +++ b/src/test/java/org/springframework/data/redis/test/util/RedisTestData.java @@ -148,7 +148,6 @@ private String getString(String path) { } - private static Map toStringMap(Map source) { Map converted = new LinkedHashMap<>(); From 09f9d8b88e8cde56415cc6e0fc0a689342a2efe1 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 11 Nov 2025 09:36:15 +0100 Subject: [PATCH 41/51] Refine Redis Repository expiry wording. Closes #3255 --- .../ROOT/pages/redis/redis-repositories/expirations.adoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc index ddb794213d..e037a70c45 100644 --- a/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/redis-repositories/expirations.adoc @@ -35,7 +35,7 @@ public class TimeToLiveOnMethod { ---- ==== -NOTE: Annotating a property explicitly with `@TimeToLive` reads back the actual `TTL` or `PTTL` value from Redis. -1 indicates that the object has no associated expiration. +NOTE: Annotating a property explicitly with `@TimeToLive` reads back the actual `TTL` or `PTTL` value from Redis. `-1` indicates that the object has no associated expiration. The repository implementation ensures subscription to https://redis.io/topics/notifications[Redis keyspace notifications] via javadoc:org.springframework.data.redis.listener.RedisMessageListenerContainer[]. @@ -60,8 +60,10 @@ Note that `CONFIG` is disabled on AWS ElastiCache, and enabling the listener lea To work around this behavior, set the `keyspaceNotificationsConfigParameter` parameter to an empty string. This prevents `CONFIG` command usage. -NOTE: Redis Pub/Sub messages are not persistent. +NOTE: Redis repositories rely on Pub/Sub messages for residual index cleanup. +Redis Pub/Sub messages are not persistent. If a key expires while the application is down, the expiry event is not processed, which may lead to secondary indexes containing references to the expired object. +Redis does not allow for expiration of individual entries of a set that is used as secondary index. NOTE: `@EnableKeyspaceEvents(shadowCopy = OFF)` disable storage of phantom copies and reduces data size within Redis. `RedisKeyExpiredEvent` will only contain the `id` of the expired key. From 37306c2c19915a2553d1e60d30b2aff085cd341c Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 14 Nov 2025 10:43:24 +0100 Subject: [PATCH 42/51] Update Update security documentation. See #3239 --- SECURITY.adoc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/SECURITY.adoc b/SECURITY.adoc index 884502dfde..654bfbea58 100644 --- a/SECURITY.adoc +++ b/SECURITY.adoc @@ -1,9 +1,15 @@ -# Security Policy += Security Policy -## Supported Versions +== Reporting a Vulnerability -Please see the https://spring.io/projects/spring-data-redis[Spring Data Redis] project page for supported versions. +Please, https://github.com/spring-projects/security-advisories/security/advisories/new[open a draft security advisory] if you need to disclose and discuss a security issue in private with the Spring Data team. +Note that we only accept reports against https://spring.io/projects/spring-data#support[supported versions]. -## Reporting a Vulnerability +For more details, check out our https://spring.io/security-policy[security policy]. -Please don't raise security vulnerabilities here. Head over to https://pivotal.io/security to learn how to disclose them responsibly. +== JAR signing + +Spring Data JARs released on Maven Central are signed. +You'll find more information about the key here: https://spring.io/GPG-KEY-spring.txt + +Versions released prior to 2023 may be signed with a different key. From 38fea42126c070e72b3b87b8775a2d91d63973d1 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 14 Nov 2025 11:29:46 +0100 Subject: [PATCH 43/51] Prepare 3.5.6 (2025.0.6). See #3239 --- pom.xml | 22 +++++----------------- src/main/resources/notice.txt | 3 ++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 51ae113c44..4332724f36 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.6-SNAPSHOT + 3.5.6 - 3.5.6-SNAPSHOT - 3.5.6-SNAPSHOT + 3.5.6 + 3.5.6 1.9.4 1.4.21 2.11.1 @@ -388,19 +388,7 @@ - - spring-snapshot - https://repo.spring.io/snapshot - - true - - - false - - - - spring-milestone - https://repo.spring.io/milestone - + + diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index aae80dfe9c..e2718f3753 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.5.5 (2025.0.5) +Spring Data Redis 3.5.6 (2025.0.6) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -65,5 +65,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + From a88ff9277fbfc3df1c7d70f8edf0f943cb1a62f0 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 14 Nov 2025 11:30:08 +0100 Subject: [PATCH 44/51] Release version 3.5.6 (2025.0.6). See #3239 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4332724f36..a52997b863 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.6-SNAPSHOT + 3.5.6 Spring Data Redis Spring Data module for Redis From f7a0f4f737e51958afc2fccdd461aebe08f3eb95 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 14 Nov 2025 11:33:14 +0100 Subject: [PATCH 45/51] Prepare next development iteration. See #3239 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a52997b863..9522060216 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.6 + 3.5.7-SNAPSHOT Spring Data Redis Spring Data module for Redis From e504f0e5af4f8d26b933599070163d221f1fd3cc Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 14 Nov 2025 11:33:16 +0100 Subject: [PATCH 46/51] After release cleanups. See #3239 --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 9522060216..8b5f825034 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.6 + 3.5.7-SNAPSHOT - 3.5.6 - 3.5.6 + 3.5.7-SNAPSHOT + 3.5.7-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + From fc66e40530e1df4072793ba04b0cd416c6561193 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 10 Dec 2025 08:34:38 +0100 Subject: [PATCH 47/51] Update CI Properties. See #3262 --- ci/pipeline.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/pipeline.properties b/ci/pipeline.properties index 8dd2295acc..d7277c46d4 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -17,8 +17,8 @@ docker.redis.7.version=7.2.4 docker.valkey.8.version=8.1.1 # Docker environment settings -docker.java.inside.basic=-v $HOME:/tmp/jenkins-home -docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home +docker.java.inside.basic=-v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000 +docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000 # Credentials docker.registry= From 2d782565b3ed340c2d1abd7fdba75e08502c526a Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 12 Dec 2025 11:42:06 +0100 Subject: [PATCH 48/51] Prepare 3.5.7 (2025.0.7). See #3262 --- pom.xml | 22 +++++----------------- src/main/resources/notice.txt | 3 ++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 8b5f825034..2cb5f1631f 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.7-SNAPSHOT + 3.5.7 - 3.5.7-SNAPSHOT - 3.5.7-SNAPSHOT + 3.5.7 + 3.5.7 1.9.4 1.4.21 2.11.1 @@ -388,19 +388,7 @@ - - spring-snapshot - https://repo.spring.io/snapshot - - true - - - false - - - - spring-milestone - https://repo.spring.io/milestone - + + diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index e2718f3753..486d56904f 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Redis 3.5.6 (2025.0.6) +Spring Data Redis 3.5.7 (2025.0.7) Copyright (c) [2010-2019] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -66,5 +66,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + From 8faa19e48f172f547783b9d1003e9094c599f9d1 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 12 Dec 2025 11:42:28 +0100 Subject: [PATCH 49/51] Release version 3.5.7 (2025.0.7). See #3262 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2cb5f1631f..4d5e24c167 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.7-SNAPSHOT + 3.5.7 Spring Data Redis Spring Data module for Redis From ae6c3d6b90481df55c87dc336e9a8e86f3b71523 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 12 Dec 2025 11:45:22 +0100 Subject: [PATCH 50/51] Prepare next development iteration. See #3262 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4d5e24c167..2d72bc120d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.5.7 + 3.5.8-SNAPSHOT Spring Data Redis Spring Data module for Redis From a24fff4710e0a282bcf8a2e0c2ade54b488251a2 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 12 Dec 2025 11:45:23 +0100 Subject: [PATCH 51/51] After release cleanups. See #3262 --- pom.xml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 2d72bc120d..c6a0f9243b 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ org.springframework.data.build spring-data-parent - 3.5.7 + 3.5.8-SNAPSHOT - 3.5.7 - 3.5.7 + 3.5.8-SNAPSHOT + 3.5.8-SNAPSHOT 1.9.4 1.4.21 2.11.1 @@ -388,7 +388,19 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone +