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 1923978f88
commit 515cec689b
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

@@ -65,7 +65,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;
@@ -2155,7 +2154,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);
@@ -2183,7 +2182,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

@@ -91,13 +91,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;
@@ -177,7 +174,6 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
factory.destroy();
}
@Test // DATAREDIS-315
public void appendShouldAddValueCorrectly() {
@@ -2193,6 +2189,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);
@@ -2205,6 +2203,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);
@@ -2376,8 +2376,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
@@ -2494,8 +2494,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