Polishing.

Reformat code. Tweak Javadoc

See #1816.
Original pull request: #1968.
This commit is contained in:
Mark Paluch
2021-02-15 14:53:22 +01:00
parent 507a882e93
commit febdb82e58
6 changed files with 16 additions and 14 deletions

View File

@@ -475,8 +475,8 @@ class JedisClusterZSetCommands implements RedisZSetCommands {
}
try {
return toTupleSet(connection.getCluster().zrangeByScoreWithScores(key, min, max,
Long.valueOf(offset).intValue(), Long.valueOf(count).intValue()));
return toTupleSet(connection.getCluster().zrangeByScoreWithScores(key, min, max, Long.valueOf(offset).intValue(),
Long.valueOf(count).intValue()));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}

View File

@@ -248,10 +248,8 @@ class JedisZSetCommands implements RedisZSetCommands {
.toSet(JedisConverters::toTuple);
}
return connection.invoke()
.fromMany(BinaryJedis::zrevrangeByScoreWithScores, MultiKeyPipelineBase::zrevrangeByScoreWithScores, key, max,
min)
.toSet(JedisConverters::toTuple);
return connection.invoke().fromMany(BinaryJedis::zrevrangeByScoreWithScores,
MultiKeyPipelineBase::zrevrangeByScoreWithScores, key, max, min).toSet(JedisConverters::toTuple);
}
/*
@@ -511,10 +509,8 @@ class JedisZSetCommands implements RedisZSetCommands {
}
String keyStr = new String(key, StandardCharsets.UTF_8);
return connection.invoke()
.fromMany(Jedis::zrangeByScore, MultiKeyPipelineBase::zrangeByScore, keyStr, min, max, (int) offset,
(int) count)
.toSet(JedisConverters::toBytes);
return connection.invoke().fromMany(Jedis::zrangeByScore, MultiKeyPipelineBase::zrangeByScore, keyStr, min, max,
(int) offset, (int) count).toSet(JedisConverters::toBytes);
}
/*
@@ -575,7 +571,6 @@ class JedisZSetCommands implements RedisZSetCommands {
byte[] min = JedisConverters.boundaryToBytesForZRangeByLex(range.getMin(), JedisConverters.MINUS_BYTES);
byte[] max = JedisConverters.boundaryToBytesForZRangeByLex(range.getMax(), JedisConverters.PLUS_BYTES);
if (!limit.isUnlimited()) {
return connection.invoke().from(BinaryJedis::zrevrangeByLex, MultiKeyPipelineBase::zrevrangeByLex, key, max, min,
limit.getOffset(), limit.getCount()).get(LinkedHashSet::new);

View File

@@ -1925,7 +1925,7 @@ public abstract class AbstractConnectionIntegrationTests {
actual.add(connection.zRemRangeByLex("myset", Range.range().gte("alpha").lte("omega")));
actual.add(connection.zRange("myset", 0L, -1L));
verifyResults(Arrays.asList(new Object[] { true, true, true,true, true, true,true, true, true,true, 6L, new LinkedHashSet<String>(Arrays.asList("ALPHA", "aaaa", "zap", "zip")) }));
verifyResults(Arrays.asList( true, true, true, true, true, true, true, true, true, true, 6L, new LinkedHashSet<>(Arrays.asList("ALPHA", "aaaa", "zap", "zip"))));
}
@Test
@@ -1935,7 +1935,8 @@ public abstract class AbstractConnectionIntegrationTests {
actual.add(connection.zRemRangeByScore("myset", 0d, 1d));
actual.add(connection.zRange("myset", 0L, -1L));
verifyResults(
Arrays.asList(new Object[] { true, true, 1L, new LinkedHashSet<>(Arrays.asList("Bob")) }));
Arrays.asList(new Object[] { true, true, 1L, new LinkedHashSet<>(Collections
.singletonList("Bob")) }));
}
@Test

View File

@@ -21,11 +21,13 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.serializer.RedisSerializer;
/**
* Test extension to {@link RedisTemplate} to use a Mockito mocked {@link RedisConnection}.
*
* @author Christoph Strobl
*/
public class ConnectionMockingRedisTemplate<K, V> extends RedisTemplate<K, V> {
private RedisConnection connectionMock;
private final RedisConnection connectionMock;
private ConnectionMockingRedisTemplate() {

View File

@@ -22,6 +22,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.data.redis.connection.RedisZSetCommands.Range;
/**
* Unit tests for {@link DefaultBoundZSetOperations}.
*
* @author Christoph Strobl
*/
class DefaultBoundZSetOperationsUnitTests {

View File

@@ -22,6 +22,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.data.redis.connection.RedisZSetCommands.Range;
/**
* Unit tests for {@link DefaultZSetOperations}.
*
* @author Christoph Strobl
*/
class DefaultZSetOperationsUnitTests {