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 c8f4d0c414
commit 7469ce009a
3 changed files with 15 additions and 16 deletions

View File

@@ -48,6 +48,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 {
@@ -1042,7 +1043,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

@@ -2280,8 +2280,7 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
@EnabledOnCommand("BZPOPMIN")
public void bzPopMinShouldWorkCorrectly() {
assertThat(clusterConnection.bZPopMin(KEY_1_BYTES, 1, TimeUnit.MILLISECONDS))
.isNull();
assertThat(clusterConnection.bZPopMin(KEY_1_BYTES, 10, TimeUnit.MILLISECONDS)).isNull();
nativeConnection.zadd(KEY_1_BYTES, 10D, VALUE_1_BYTES);
nativeConnection.zadd(KEY_1_BYTES, 20D, VALUE_2_BYTES);
@@ -2308,8 +2307,7 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
@EnabledOnCommand("BZPOPMAX")
public void bzPopMaxShouldWorkCorrectly() {
assertThat(clusterConnection.bZPopMax(KEY_1_BYTES, 1, TimeUnit.MILLISECONDS))
.isNull();
assertThat(clusterConnection.bZPopMax(KEY_1_BYTES, 10, TimeUnit.MILLISECONDS)).isNull();
nativeConnection.zadd(KEY_1_BYTES, 10D, VALUE_1_BYTES);
nativeConnection.zadd(KEY_1_BYTES, 20D, VALUE_2_BYTES);

View File

@@ -97,13 +97,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;
@@ -183,7 +180,6 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
factory.destroy();
}
@Test // DATAREDIS-315
public void appendShouldAddValueCorrectly() {
@@ -2320,6 +2316,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);
@@ -2332,6 +2330,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);
@@ -2504,8 +2504,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
@@ -2622,8 +2622,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