From 86d0b4f61def35838b8b149429c92ebb5a4a1340 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 10 Mar 2022 10:43:30 +0100 Subject: [PATCH] Polishing. Update since tags. Move FlushOption converters to client-specific converters. Use method-references where possible. See #2187 Original pull request: #2190. --- .../ReactiveClusterServerCommands.java | 8 ++--- .../connection/ReactiveServerCommands.java | 8 ++--- .../RedisClusterServerCommands.java | 4 +-- .../redis/connection/RedisServerCommands.java | 10 +++--- .../jedis/JedisClusterServerCommands.java | 34 ++++++------------- .../connection/jedis/JedisConverters.java | 24 +++++++++++-- .../connection/jedis/JedisServerCommands.java | 13 +++---- .../lettuce/LettuceClusterServerCommands.java | 8 ++--- .../connection/lettuce/LettuceConverters.java | 21 ++++++++++-- .../LettuceReactiveClusterServerCommands.java | 4 +-- .../LettuceReactiveServerCommands.java | 4 +-- .../lettuce/LettuceServerCommands.java | 20 ++--------- .../data/redis/core/ClusterOperations.java | 6 ++-- .../redis/core/DefaultClusterOperations.java | 26 +++++++------- ...eactiveServerCommandsIntegrationTests.java | 5 --- 15 files changed, 96 insertions(+), 99 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java index 40d497d98..84bbfe332 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java @@ -94,13 +94,13 @@ public interface ReactiveClusterServerCommands extends ReactiveServerCommands { Mono flushDb(RedisClusterNode node); /** - * Delete all keys of the currently selected database using the specified flush option. + * Delete all keys of the currently selected database using the specified {@link FlushOption}. * * @param node must not be {@literal null}. {@link Mono} indicating command completion. * @param option * @throws IllegalArgumentException when {@code node} is {@literal null}. * @see RedisServerCommands#flushDb(FlushOption) - * @since 2.6 + * @since 2.7 */ Mono flushDb(RedisClusterNode node, FlushOption option); @@ -115,14 +115,14 @@ public interface ReactiveClusterServerCommands extends ReactiveServerCommands { Mono flushAll(RedisClusterNode node); /** - * Delete all all keys from all databases using the specified flush option. + * Delete all all keys from all databases using the specified {@link FlushOption}. * * @param node must not be {@literal null}. * @param option * @return {@link Mono} indicating command completion. * @throws IllegalArgumentException when {@code node} is {@literal null}. * @see RedisServerCommands#flushAll(FlushOption) - * @since 2.6 + * @since 2.7 */ Mono flushAll(RedisClusterNode node, FlushOption option); diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveServerCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveServerCommands.java index c1f8c9a90..17f206b9f 100644 --- a/src/main/java/org/springframework/data/redis/connection/ReactiveServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/ReactiveServerCommands.java @@ -84,12 +84,12 @@ public interface ReactiveServerCommands { Mono flushDb(); /** - * Delete all keys of the currently selected database using the specified flush option. + * Delete all keys of the currently selected database using the specified {@link FlushOption}. * * @param option * @return {@link Mono} indicating command completion. * @see Redis Documentation: FLUSHDB - * @since 2.6 + * @since 2.7 */ Mono flushDb(FlushOption option); @@ -102,12 +102,12 @@ public interface ReactiveServerCommands { Mono flushAll(); /** - * Delete all all keys from all databases using the specified flush option. + * Delete all all keys from all databases using the specified {@link FlushOption}. * * @param option * @return {@link Mono} indicating command completion. * @see Redis Documentation: FLUSHALL - * @since 2.6 + * @since 2.7 */ Mono flushAll(FlushOption option); diff --git a/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java index 362d044ce..8e57ce75e 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisClusterServerCommands.java @@ -70,7 +70,7 @@ public interface RedisClusterServerCommands extends RedisServerCommands { * @param node must not be {@literal null}. * @param option * @see RedisServerCommands#flushDb(FlushOption) - * @since 2.6 + * @since 2.7 */ void flushDb(RedisClusterNode node, FlushOption option); @@ -84,7 +84,7 @@ public interface RedisClusterServerCommands extends RedisServerCommands { * @param node must not be {@literal null}. * @param option * @see RedisServerCommands#flushAll(FlushOption) - * @since 2.6 + * @since 2.7 */ void flushAll(RedisClusterNode node, FlushOption option); diff --git a/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java b/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java index 86686f33f..241158b1e 100644 --- a/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/RedisServerCommands.java @@ -45,7 +45,7 @@ public interface RedisServerCommands { } /** - * @since 2.6 + * @since 2.7 */ enum FlushOption { SYNC, ASYNC @@ -110,11 +110,11 @@ public interface RedisServerCommands { void flushDb(); /** - * Delete all keys of the currently selected database using the specified flush option. + * Delete all keys of the currently selected database using the specified {@link FlushOption}. * * @param option * @see Redis Documentation: FLUSHDB - * @since 2.6 + * @since 2.7 */ void flushDb(FlushOption option); @@ -126,11 +126,11 @@ public interface RedisServerCommands { void flushAll(); /** - * Delete all all keys from all databases using the specified flush option. + * Delete all all keys from all databases using the specified {@link FlushOption}. * * @param option * @see Redis Documentation: FLUSHALL - * @since 2.6 + * @since 2.7 */ void flushAll(FlushOption option); 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 9e06b6188..4db10909b 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 @@ -17,7 +17,6 @@ package org.springframework.data.redis.connection.jedis; import redis.clients.jedis.BinaryJedis; import redis.clients.jedis.Jedis; -import redis.clients.jedis.args.FlushMode; import java.util.ArrayList; import java.util.Collection; @@ -179,7 +178,7 @@ class JedisClusterServerCommands implements RedisClusterServerCommands { */ @Override public void flushDb(FlushOption option) { - executeCommandOnAllNodes(it -> it.flushDB(toFlushMode(option))); + executeCommandOnAllNodes(it -> it.flushDB(JedisConverters.toFlushMode(option))); } /* @@ -197,7 +196,7 @@ class JedisClusterServerCommands implements RedisClusterServerCommands { */ @Override public void flushDb(RedisClusterNode node, FlushOption option) { - executeCommandOnSingleNode(it -> it.flushDB(toFlushMode(option)), node); + executeCommandOnSingleNode(it -> it.flushDB(JedisConverters.toFlushMode(option)), node); } /* @@ -217,7 +216,8 @@ class JedisClusterServerCommands implements RedisClusterServerCommands { @Override public void flushAll(FlushOption option) { connection.getClusterCommandExecutor() - .executeCommandOnAllNodes((JedisClusterCommandCallback) it -> it.flushAll(toFlushMode(option))); + .executeCommandOnAllNodes( + (JedisClusterCommandCallback) it -> it.flushAll(JedisConverters.toFlushMode(option))); } /* @@ -235,7 +235,7 @@ class JedisClusterServerCommands implements RedisClusterServerCommands { */ @Override public void flushAll(RedisClusterNode node, FlushOption option) { - executeCommandOnSingleNode(it -> it.flushAll(toFlushMode(option)), node); + executeCommandOnSingleNode(it -> it.flushAll(JedisConverters.toFlushMode(option)), node); } /* @@ -455,8 +455,9 @@ class JedisClusterServerCommands implements RedisClusterServerCommands { @Override public Long time(TimeUnit timeUnit) { - return convertListOfStringToTime(connection.getClusterCommandExecutor() - .executeCommandOnArbitraryNode((JedisClusterCommandCallback>) BinaryJedis::time).getValue(), + return convertListOfStringToTime( + connection.getClusterCommandExecutor() + .executeCommandOnArbitraryNode((JedisClusterCommandCallback>) BinaryJedis::time).getValue(), timeUnit); } @@ -467,8 +468,9 @@ class JedisClusterServerCommands implements RedisClusterServerCommands { @Override public Long time(RedisClusterNode node, TimeUnit timeUnit) { - return convertListOfStringToTime(connection.getClusterCommandExecutor() - .executeCommandOnSingleNode((JedisClusterCommandCallback>) BinaryJedis::time, node).getValue(), + return convertListOfStringToTime( + connection.getClusterCommandExecutor() + .executeCommandOnSingleNode((JedisClusterCommandCallback>) BinaryJedis::time, node).getValue(), timeUnit); } @@ -595,18 +597,4 @@ class JedisClusterServerCommands implements RedisClusterServerCommands { return connection.getClusterCommandExecutor().executeCommandOnAllNodes(cmd); } - static FlushMode toFlushMode(@Nullable FlushOption option) { - - if (option == null) { - return FlushMode.SYNC; - } - - switch (option) { - case ASYNC: - return FlushMode.ASYNC; - case SYNC: - return FlushMode.SYNC; - } - throw new UnsupportedOperationException("Flush option " + option + " is not implemented."); - } } diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java index bfd7b6d6f..004d604ec 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java @@ -22,6 +22,7 @@ import redis.clients.jedis.GeoUnit; import redis.clients.jedis.ListPosition; import redis.clients.jedis.ScanParams; import redis.clients.jedis.SortingParams; +import redis.clients.jedis.args.FlushMode; import redis.clients.jedis.params.GeoRadiusParam; import redis.clients.jedis.params.GetExParams; import redis.clients.jedis.params.SetParams; @@ -59,6 +60,7 @@ import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusComma import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusCommandArgs.Flag; import org.springframework.data.redis.connection.RedisListCommands.Position; import org.springframework.data.redis.connection.RedisServer; +import org.springframework.data.redis.connection.RedisServerCommands; import org.springframework.data.redis.connection.RedisStringCommands.BitOperation; import org.springframework.data.redis.connection.RedisStringCommands.SetOption; import org.springframework.data.redis.connection.RedisZSetCommands.Range.Boundary; @@ -436,10 +438,12 @@ public abstract class JedisConverters extends Converters { } if (expiration.getTimeUnit() == TimeUnit.MILLISECONDS) { - return expiration.isUnixTimestamp() ? paramsToUse.pxAt(expiration.getExpirationTime()) : paramsToUse.px(expiration.getExpirationTime()); + return expiration.isUnixTimestamp() ? paramsToUse.pxAt(expiration.getExpirationTime()) + : paramsToUse.px(expiration.getExpirationTime()); } - return expiration.isUnixTimestamp() ? paramsToUse.exAt(expiration.getConverted(TimeUnit.SECONDS)) : paramsToUse.ex(expiration.getConverted(TimeUnit.SECONDS)); + return expiration.isUnixTimestamp() ? paramsToUse.exAt(expiration.getConverted(TimeUnit.SECONDS)) + : paramsToUse.ex(expiration.getConverted(TimeUnit.SECONDS)); } /** @@ -814,6 +818,22 @@ public abstract class JedisConverters extends Converters { return args.toArray(new byte[0][0]); } + static FlushMode toFlushMode(@Nullable RedisServerCommands.FlushOption option) { + + if (option == null) { + return FlushMode.SYNC; + } + + switch (option) { + case ASYNC: + return FlushMode.ASYNC; + case SYNC: + return FlushMode.SYNC; + default: + throw new IllegalArgumentException("Flush option " + option + " is not supported."); + } + } + /** * @author Christoph Strobl * @since 1.8 diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java index c2d7df8c9..a93030a02 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java @@ -18,7 +18,6 @@ package org.springframework.data.redis.connection.jedis; import redis.clients.jedis.BinaryJedis; import redis.clients.jedis.Jedis; import redis.clients.jedis.MultiKeyPipelineBase; -import redis.clients.jedis.args.FlushMode; import redis.clients.jedis.args.SaveMode; import java.util.List; @@ -39,8 +38,6 @@ import org.springframework.util.Assert; */ class JedisServerCommands implements RedisServerCommands { - private static final String SHUTDOWN_SCRIPT = "return redis.call('SHUTDOWN','%s')"; - private final JedisConnection connection; JedisServerCommands(JedisConnection connection) { @@ -107,9 +104,8 @@ class JedisServerCommands implements RedisServerCommands { */ @Override public void flushDb(FlushOption option) { - - FlushMode flushMode = JedisClusterServerCommands.toFlushMode(option); - connection.invokeStatus().just(it -> it.flushDB(flushMode), it -> it.flushDB(flushMode)); + connection.invokeStatus().just(BinaryJedis::flushDB, MultiKeyPipelineBase::flushDB, + JedisConverters.toFlushMode(option)); } /* @@ -127,9 +123,8 @@ class JedisServerCommands implements RedisServerCommands { */ @Override public void flushAll(FlushOption option) { - - FlushMode flushMode = JedisClusterServerCommands.toFlushMode(option); - connection.invokeStatus().just(it -> it.flushAll(flushMode), it -> it.flushAll(flushMode)); + connection.invokeStatus().just(BinaryJedis::flushAll, MultiKeyPipelineBase::flushAll, + JedisConverters.toFlushMode(option)); } /* diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java index 90e84c382..bde6b4fe7 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java @@ -131,7 +131,7 @@ class LettuceClusterServerCommands extends LettuceServerCommands implements Redi */ @Override public void flushDb(FlushOption option) { - executeCommandOnAllNodes(it -> it.flushdb(toFlushMode(option))); + executeCommandOnAllNodes(it -> it.flushdb(LettuceConverters.toFlushMode(option))); } /* @@ -149,7 +149,7 @@ class LettuceClusterServerCommands extends LettuceServerCommands implements Redi */ @Override public void flushDb(RedisClusterNode node, FlushOption option) { - executeCommandOnSingleNode(it -> it.flushdb(toFlushMode(option)), node); + executeCommandOnSingleNode(it -> it.flushdb(LettuceConverters.toFlushMode(option)), node); } /* @@ -167,7 +167,7 @@ class LettuceClusterServerCommands extends LettuceServerCommands implements Redi */ @Override public void flushAll(FlushOption option) { - executeCommandOnAllNodes(it -> it.flushall(toFlushMode(option))); + executeCommandOnAllNodes(it -> it.flushall(LettuceConverters.toFlushMode(option))); } /* @@ -185,7 +185,7 @@ class LettuceClusterServerCommands extends LettuceServerCommands implements Redi */ @Override public void flushAll(RedisClusterNode node, FlushOption option) { - executeCommandOnSingleNode(it -> it.flushall(toFlushMode(option)), node); + executeCommandOnSingleNode(it -> it.flushall(LettuceConverters.toFlushMode(option)), node); } /* 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 f54c3f3a0..47b1b02c5 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 @@ -896,10 +896,9 @@ public abstract class LettuceConverters extends Converters { if (args.hasFlags()) { for (GeoCommandArgs.GeoCommandFlag flag : args.getFlags()) { - if(flag.equals(GeoRadiusCommandArgs.Flag.WITHCOORD)) { + if (flag.equals(GeoRadiusCommandArgs.Flag.WITHCOORD)) { geoArgs.withCoordinates(); - } - else if(flag.equals(GeoRadiusCommandArgs.Flag.WITHDIST)) { + } else if (flag.equals(GeoRadiusCommandArgs.Flag.WITHDIST)) { geoArgs.withDistance(); } } @@ -1171,6 +1170,22 @@ public abstract class LettuceConverters extends Converters { throw new IllegalArgumentException(String.format("Cannot convert %s to Lettuce GeoRef", reference)); } + static FlushMode toFlushMode(@Nullable RedisServerCommands.FlushOption option) { + + if (option == null) { + return FlushMode.SYNC; + } + + switch (option) { + case ASYNC: + return FlushMode.ASYNC; + case SYNC: + return FlushMode.SYNC; + default: + throw new IllegalArgumentException("Flush option " + option + " is not supported."); + } + } + /** * @author Christoph Strobl * @since 1.8 diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java index ae6d88136..acbe78212 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java @@ -137,7 +137,7 @@ class LettuceReactiveClusterServerCommands extends LettuceReactiveServerCommands */ @Override public Mono flushDb(RedisClusterNode node, FlushOption option) { - return connection.execute(node, it -> it.flushdb(LettuceServerCommands.toFlushMode(option))).next(); + return connection.execute(node, it -> it.flushdb(LettuceConverters.toFlushMode(option))).next(); } /* @@ -155,7 +155,7 @@ class LettuceReactiveClusterServerCommands extends LettuceReactiveServerCommands */ @Override public Mono flushAll(RedisClusterNode node, FlushOption option) { - return connection.execute(node, it -> it.flushall(LettuceServerCommands.toFlushMode(option))).next(); + return connection.execute(node, it -> it.flushall(LettuceConverters.toFlushMode(option))).next(); } /* diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java index d0f6aa5eb..cee638f05 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java @@ -114,7 +114,7 @@ class LettuceReactiveServerCommands implements ReactiveServerCommands { */ @Override public Mono flushDb(FlushOption option) { - return connection.execute(it -> it.flushdb(LettuceServerCommands.toFlushMode(option))).next(); + return connection.execute(it -> it.flushdb(LettuceConverters.toFlushMode(option))).next(); } /* @@ -132,7 +132,7 @@ class LettuceReactiveServerCommands implements ReactiveServerCommands { */ @Override public Mono flushAll(FlushOption option) { - return connection.execute(it -> it.flushall(LettuceServerCommands.toFlushMode(option))).next(); + return connection.execute(it -> it.flushall(LettuceConverters.toFlushMode(option))).next(); } /* diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java index 1de500522..51bab6dff 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java @@ -15,7 +15,6 @@ */ package org.springframework.data.redis.connection.lettuce; -import io.lettuce.core.FlushMode; import io.lettuce.core.LettuceFutures; import io.lettuce.core.RedisFuture; import io.lettuce.core.api.async.RedisKeyAsyncCommands; @@ -106,7 +105,7 @@ class LettuceServerCommands implements RedisServerCommands { */ @Override public void flushDb(FlushOption option) { - connection.invoke().just(it -> it.flushdb(toFlushMode(option))); + connection.invokeStatus().just(RedisServerAsyncCommands::flushdb, LettuceConverters.toFlushMode(option)); } /* @@ -124,7 +123,7 @@ class LettuceServerCommands implements RedisServerCommands { */ @Override public void flushAll(FlushOption option) { - connection.invokeStatus().just(it -> it.flushall(toFlushMode(option))); + connection.invokeStatus().just(RedisServerAsyncCommands::flushall, LettuceConverters.toFlushMode(option)); } /* @@ -337,21 +336,6 @@ class LettuceServerCommands implements RedisServerCommands { return connection.getConnection(); } - static FlushMode toFlushMode(@Nullable FlushOption option) { - - if (option == null) { - return FlushMode.SYNC; - } - - switch (option) { - case ASYNC: - return FlushMode.ASYNC; - case SYNC: - return FlushMode.SYNC; - } - throw new UnsupportedOperationException("Flush option " + option + " is not implemented."); - } - static class CompletedRedisFuture extends CompletableFuture implements RedisFuture { public CompletedRedisFuture(T value) { 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 64396b55e..aa0210f56 100644 --- a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java +++ b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java @@ -120,12 +120,12 @@ public interface ClusterOperations { void flushDb(RedisClusterNode node); /** - * Flush db on node using the specified flush option. + * Flush db on node using the specified {@link FlushOption}. * * @param node must not be {@literal null}. - * @param option + * @param option must not be {@literal null}. * @see RedisConnection#flushDb(FlushOption) - * @since 2.6 + * @since 2.7 */ void flushDb(RedisClusterNode node, FlushOption option); diff --git a/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java index 354a61786..c8a2f8478 100644 --- a/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java +++ b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java @@ -57,7 +57,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#keys(org.springframework.data.redis.connection.RedisNode, byte[]) */ @Override - public Set keys(final RedisClusterNode node, final K pattern) { + public Set keys(RedisClusterNode node, K pattern) { Assert.notNull(node, "ClusterNode must not be null."); @@ -69,7 +69,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#randomKey(org.springframework.data.redis.connection.RedisNode) */ @Override - public K randomKey(final RedisClusterNode node) { + public K randomKey(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -81,7 +81,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#ping(org.springframework.data.redis.connection.RedisNode) */ @Override - public String ping(final RedisClusterNode node) { + public String ping(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -93,7 +93,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#addSlots(org.springframework.data.redis.connection.RedisClusterNode, int[]) */ @Override - public void addSlots(final RedisClusterNode node, final int... slots) { + public void addSlots(RedisClusterNode node, int... slots) { Assert.notNull(node, "ClusterNode must not be null."); @@ -121,7 +121,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#bgReWriteAof(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void bgReWriteAof(final RedisClusterNode node) { + public void bgReWriteAof(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -136,7 +136,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#bgSave(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void bgSave(final RedisClusterNode node) { + public void bgSave(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -151,7 +151,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#meet(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void meet(final RedisClusterNode node) { + public void meet(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -166,7 +166,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#forget(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void forget(final RedisClusterNode node) { + public void forget(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -181,7 +181,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#flushDb(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void flushDb(final RedisClusterNode node) { + public void flushDb(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -211,7 +211,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#getSlaves(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public Collection getSlaves(final RedisClusterNode node) { + public Collection getSlaves(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -223,7 +223,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#save(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void save(final RedisClusterNode node) { + public void save(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -238,7 +238,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.RedisClusterOperations#shutdown(org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void shutdown(final RedisClusterNode node) { + public void shutdown(RedisClusterNode node) { Assert.notNull(node, "ClusterNode must not be null."); @@ -253,7 +253,7 @@ class DefaultClusterOperations extends AbstractOperations implements * @see org.springframework.data.redis.core.ClusterOperations#reshard(org.springframework.data.redis.connection.RedisClusterNode, int, org.springframework.data.redis.connection.RedisClusterNode) */ @Override - public void reshard(final RedisClusterNode source, final int slot, final RedisClusterNode target) { + public void reshard(RedisClusterNode source, int slot, RedisClusterNode target) { Assert.notNull(source, "Source node must not be null."); Assert.notNull(target, "Target node must not be null."); 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 5cc6180a7..9d6439e76 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 @@ -20,7 +20,6 @@ import static org.assertj.core.api.Assumptions.*; import reactor.test.StepVerifier; -import org.junit.jupiter.api.Disabled; import org.springframework.data.redis.connection.RedisServerCommands.FlushOption; import org.springframework.data.redis.test.extension.parametrized.ParameterizedRedisTest; @@ -73,7 +72,6 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete(); } - @Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908") @ParameterizedRedisTest // GH-2187 void flushDbSyncShouldRespondCorrectly() { @@ -91,7 +89,6 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete(); } - @Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908") @ParameterizedRedisTest // GH-2187 void flushDbAsyncShouldRespondCorrectly() { @@ -124,7 +121,6 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete(); } - @Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908") @ParameterizedRedisTest // GH-2187 void flushAllSyncShouldRespondCorrectly() { @@ -140,7 +136,6 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti connection.serverCommands().dbSize().as(StepVerifier::create).expectNext(0L).verifyComplete(); } - @Disabled("Wait for https://github.com/lettuce-io/lettuce-core/pull/1908") @ParameterizedRedisTest // GH-2187 void flushAllAsyncShouldRespondCorrectly() {