DATAREDIS-645 - Polishing.

Migrate LettuceReactiveStringCommandsTests to StepVerifier and replace Collection.stream().toArray(…) with Collection.toArray(…).

Original Pull Request: #249
This commit is contained in:
Mark Paluch
2017-05-11 13:28:50 +02:00
committed by Christoph Strobl
parent d6ea867e37
commit 95768983b6
3 changed files with 130 additions and 89 deletions

View File

@@ -192,7 +192,7 @@ public interface ReactiveStringCommands {
* Get single element stored at {@literal key}.
*
* @param key must not be {@literal null}.
* @return empty {@link ByteBuffer} in case {@literal key} does not exist.
* @return {@link Mono#empty()} in case {@literal key} does not exist.
* @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a>
*/
default Mono<ByteBuffer> get(ByteBuffer key) {
@@ -218,7 +218,7 @@ public interface ReactiveStringCommands {
*
* @param key must not be {@literal null}.
* @param value must not be {@literal null}.
* @return
* @return {@link Mono#empty()} if key did not exist.
* @see <a href="http://redis.io/commands/getset">Redis Documentation: GETSET</a>
*/
default Mono<ByteBuffer> getSet(ByteBuffer key, ByteBuffer value) {

View File

@@ -67,7 +67,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
Assert.notNull(keys, "Keys must not be null!");
return cmd.mget(keys.stream().toArray(ByteBuffer[]::new)).map((value) -> value.getValueOrElse(EMPTY_BYTE_BUFFER))
return cmd.mget(keys.toArray(new ByteBuffer[0])).map((value) -> value.getValueOrElse(EMPTY_BYTE_BUFFER))
.collectList().map((values) -> new MultiValueResponse<>(keys, values));
}));
}
@@ -337,7 +337,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
Mono<Long> result = null;
ByteBuffer destinationKey = command.getDestinationKey();
ByteBuffer[] sourceKeys = command.getKeys().stream().toArray(ByteBuffer[]::new);
ByteBuffer[] sourceKeys = command.getKeys().toArray(new ByteBuffer[0]);
switch (command.getBitOp()) {
case AND:
@@ -369,6 +369,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands {
*/
@Override
public Flux<NumericResponse<KeyCommand, Long>> strLen(Publisher<KeyCommand> commands) {
return connection.execute(cmd -> {
return Flux.from(commands).flatMap(command -> {