Polishing.

Add author tags. Align Lettuce BZPOPMIN/MAX tests. Increase timeout to 10ms as Redis blocks indefinitely if the timeout is less than 0.01.

See #2324
This commit is contained in:
Mark Paluch
2022-09-16 11:44:32 +02:00
parent 9af608247b
commit 4144b459eb
3 changed files with 15 additions and 15 deletions

View File

@@ -43,6 +43,7 @@ import org.springframework.util.Assert;
* @author Mark Paluch
* @author Clement Ong
* @author Andrey Shlykov
* @author Jens Deppe
* @since 2.0
*/
class JedisClusterZSetCommands implements RedisZSetCommands {
@@ -1254,7 +1255,7 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
*/
@Nullable
@SuppressWarnings("unchecked")
private static Tuple toTuple(List<?> bytes) {
private static Tuple toTuple(@Nullable List<?> bytes) {
if (bytes == null || bytes.isEmpty()) {
return null;

View File

@@ -66,7 +66,6 @@ import org.springframework.data.redis.connection.RedisStringCommands.BitOperatio
import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
import org.springframework.data.redis.connection.ReturnType;
import org.springframework.data.redis.connection.ValueEncoding.RedisValueEncoding;
import org.springframework.data.redis.connection.RedisListCommands.*;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.script.DigestUtils;
@@ -2277,7 +2276,7 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
@EnabledOnCommand("BZPOPMIN")
public void bzPopMinShouldWorkCorrectly() {
assertThat(clusterConnection.bZPopMin(KEY_1_BYTES, 1, TimeUnit.MILLISECONDS))
assertThat(clusterConnection.bZPopMin(KEY_1_BYTES, 10, TimeUnit.MILLISECONDS))
.isNull();
nativeConnection.zadd(KEY_1_BYTES, 10D, VALUE_1_BYTES);
@@ -2305,7 +2304,7 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
@EnabledOnCommand("BZPOPMAX")
public void bzPopMaxShouldWorkCorrectly() {
assertThat(clusterConnection.bZPopMax(KEY_1_BYTES, 1, TimeUnit.MILLISECONDS))
assertThat(clusterConnection.bZPopMax(KEY_1_BYTES, 10, TimeUnit.MILLISECONDS))
.isNull();
nativeConnection.zadd(KEY_1_BYTES, 10D, VALUE_1_BYTES);

View File

@@ -93,13 +93,10 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
private static final GeoLocation<String> PALERMO = new GeoLocation<>("palermo", POINT_PALERMO);
private static final GeoLocation<byte[]> ARIGENTO_BYTES = new GeoLocation<>(
"arigento".getBytes(StandardCharsets.UTF_8),
POINT_ARIGENTO);
private static final GeoLocation<byte[]> CATANIA_BYTES = new GeoLocation<>(
"catania".getBytes(StandardCharsets.UTF_8),
"arigento".getBytes(StandardCharsets.UTF_8), POINT_ARIGENTO);
private static final GeoLocation<byte[]> CATANIA_BYTES = new GeoLocation<>("catania".getBytes(StandardCharsets.UTF_8),
POINT_CATANIA);
private static final GeoLocation<byte[]> PALERMO_BYTES = new GeoLocation<>(
"palermo".getBytes(StandardCharsets.UTF_8),
private static final GeoLocation<byte[]> PALERMO_BYTES = new GeoLocation<>("palermo".getBytes(StandardCharsets.UTF_8),
POINT_PALERMO);
private final RedisClusterClient client;
@@ -179,7 +176,6 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
factory.destroy();
}
@Test // DATAREDIS-315
public void appendShouldAddValueCorrectly() {
@@ -2315,6 +2311,8 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
@EnabledOnCommand("BZPOPMIN")
public void bzPopMinShouldWorkCorrectly() {
assertThat(clusterConnection.bZPopMin(KEY_1_BYTES, 10, TimeUnit.MILLISECONDS)).isNull();
nativeConnection.zadd(KEY_1, 10D, VALUE_1);
nativeConnection.zadd(KEY_1, 20D, VALUE_2);
nativeConnection.zadd(KEY_1, 30D, VALUE_3);
@@ -2327,6 +2325,8 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
@EnabledOnCommand("ZPOPMAX")
public void zPopMaxShouldWorkCorrectly() {
assertThat(clusterConnection.bZPopMax(KEY_1_BYTES, 10, TimeUnit.MILLISECONDS)).isNull();
nativeConnection.zadd(KEY_1, 10D, VALUE_1);
nativeConnection.zadd(KEY_1, 20D, VALUE_2);
nativeConnection.zadd(KEY_1, 30D, VALUE_3);
@@ -2498,8 +2498,8 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
nativeConnection.zadd(KEY_1, 20D, VALUE_2);
nativeConnection.zadd(KEY_1, 5D, VALUE_3);
assertThat(clusterConnection.zRangeWithScores(KEY_1_BYTES, 1, 2))
.contains(new DefaultTuple(VALUE_1_BYTES, 10D), new DefaultTuple(VALUE_2_BYTES, 20D));
assertThat(clusterConnection.zRangeWithScores(KEY_1_BYTES, 1, 2)).contains(new DefaultTuple(VALUE_1_BYTES, 10D),
new DefaultTuple(VALUE_2_BYTES, 20D));
}
@Test // DATAREDIS-315
@@ -2616,8 +2616,8 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
nativeConnection.zadd(KEY_1, 20D, VALUE_2);
nativeConnection.zadd(KEY_1, 5D, VALUE_3);
assertThat(clusterConnection.zRevRangeWithScores(KEY_1_BYTES, 1, 2))
.contains(new DefaultTuple(VALUE_3_BYTES, 5D), new DefaultTuple(VALUE_1_BYTES, 10D));
assertThat(clusterConnection.zRevRangeWithScores(KEY_1_BYTES, 1, 2)).contains(new DefaultTuple(VALUE_3_BYTES, 5D),
new DefaultTuple(VALUE_1_BYTES, 10D));
}
@Test