DATAREDIS-852 - Polishing.
Refactor lower/upper bound retrieval into LettuceConverters for a consistent lower/upper boundary return value. Use minus one (-1) as the upper bound index to always retrieve the last element if the upper boundary is not bounded. Original pull request: #353.
This commit is contained in:
@@ -20,9 +20,12 @@ import static org.hamcrest.core.Is.*;
|
||||
import static org.hamcrest.core.IsEqual.*;
|
||||
import static org.hamcrest.core.IsNot.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.assumeThat;
|
||||
import static org.junit.Assume.*;
|
||||
import static org.springframework.data.domain.Range.Bound.*;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
@@ -36,8 +39,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection;
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.CommandResponse;
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.RangeCommand;
|
||||
import org.springframework.data.redis.connection.RedisListCommands.Position;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
@@ -118,9 +119,7 @@ public class LettuceReactiveListCommandTests extends LettuceReactiveCommandsTest
|
||||
RangeCommand rangeCommand = RangeCommand.key(KEY_1_BBUFFER).within(Range.of(unbounded(), inclusive(1L)));
|
||||
|
||||
StepVerifier.create(connection.listCommands().lRange(Mono.just(rangeCommand)).flatMap(CommandResponse::getOutput)) //
|
||||
.expectNext(VALUE_1_BBUFFER)
|
||||
.expectNext(VALUE_2_BBUFFER)
|
||||
.verifyComplete();
|
||||
.expectNext(VALUE_1_BBUFFER).expectNext(VALUE_2_BBUFFER).verifyComplete();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-852
|
||||
@@ -131,9 +130,7 @@ public class LettuceReactiveListCommandTests extends LettuceReactiveCommandsTest
|
||||
RangeCommand rangeCommand = RangeCommand.key(KEY_1_BBUFFER).within(Range.of(inclusive(1L), unbounded()));
|
||||
|
||||
StepVerifier.create(connection.listCommands().lRange(Mono.just(rangeCommand)).flatMap(CommandResponse::getOutput)) //
|
||||
.expectNext(VALUE_2_BBUFFER)
|
||||
.expectNext(VALUE_3_BBUFFER)
|
||||
.verifyComplete();
|
||||
.expectNext(VALUE_2_BBUFFER).expectNext(VALUE_3_BBUFFER).verifyComplete();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-525
|
||||
|
||||
@@ -150,8 +150,9 @@ public class LettuceReactiveZSetCommandsTests extends LettuceReactiveCommandsTes
|
||||
nativeCommands.zadd(KEY_1, 2D, VALUE_2);
|
||||
nativeCommands.zadd(KEY_1, 3D, VALUE_3);
|
||||
|
||||
StepVerifier.create(connection.zSetCommands().zRangeByScore(KEY_1_BBUFFER, Range.of(Range.Bound.unbounded(),
|
||||
Range.Bound.inclusive(3D)))) //
|
||||
StepVerifier
|
||||
.create(connection.zSetCommands().zRangeByScore(KEY_1_BBUFFER,
|
||||
Range.of(Range.Bound.unbounded(), Range.Bound.inclusive(3D)))) //
|
||||
.expectNext(VALUE_1_BBUFFER, VALUE_2_BBUFFER, VALUE_3_BBUFFER) //
|
||||
.verifyComplete();
|
||||
}
|
||||
@@ -163,8 +164,9 @@ public class LettuceReactiveZSetCommandsTests extends LettuceReactiveCommandsTes
|
||||
nativeCommands.zadd(KEY_1, 2D, VALUE_2);
|
||||
nativeCommands.zadd(KEY_1, 3D, VALUE_3);
|
||||
|
||||
StepVerifier.create(connection.zSetCommands().zRangeByScore(KEY_1_BBUFFER, Range.of(Range.Bound.inclusive(0D),
|
||||
Range.Bound.unbounded()))) //
|
||||
StepVerifier
|
||||
.create(connection.zSetCommands().zRangeByScore(KEY_1_BBUFFER,
|
||||
Range.of(Range.Bound.inclusive(0D), Range.Bound.unbounded()))) //
|
||||
.expectNext(VALUE_1_BBUFFER, VALUE_2_BBUFFER, VALUE_3_BBUFFER) //
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user