DATAREDIS-1207 - Fix LettuceStreamCommands.xRevRange Range conversion.
LettuceStreamCommands.xRevRange converts Ranges with a StringCodec that produces Boundary<ByteBuffer>, while Lettuce expects the range's Boundary to include strings. The conversion worked well only in cases where the Range was unbounded (- or +), and failed with ClassCastException on the consuming site for other cases. Original pull request: #556
This commit is contained in:
committed by
Christoph Strobl
parent
9b87d3f080
commit
0ee04a7dc6
@@ -99,6 +99,7 @@ import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
||||
* @author Thomas Darimont
|
||||
* @author Mark Paluch
|
||||
* @author Tugdual Grall
|
||||
* @author Dejan Jankov
|
||||
*/
|
||||
@ProfileValueSourceConfiguration(RedisTestProfileValueSource.class)
|
||||
public abstract class AbstractConnectionIntegrationTests {
|
||||
@@ -3125,6 +3126,28 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
assertThat(messages.get(1).getValue()).isEqualTo(Collections.singletonMap(KEY_2, VALUE_2));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-1207
|
||||
@IfProfileValue(name = "redisVersion", value = "5.0")
|
||||
@WithRedisDriver({ RedisDriver.LETTUCE })
|
||||
public void xRevRangeShouldWorkWithBoundedRange() {
|
||||
|
||||
actual.add(connection.xAdd(KEY_1, Collections.singletonMap(KEY_2, VALUE_2)));
|
||||
actual.add(connection.xAdd(KEY_1, Collections.singletonMap(KEY_3, VALUE_3)));
|
||||
actual.add(connection.xRevRange(KEY_1, org.springframework.data.domain.Range.closed("0-0", "+")));
|
||||
|
||||
List<Object> results = getResults();
|
||||
assertThat(results).hasSize(3);
|
||||
|
||||
List<MapRecord<String, String, String>> messages = (List) results.get(2);
|
||||
assertThat(messages).hasSize(2);
|
||||
|
||||
assertThat(messages.get(0).getStream()).isEqualTo(KEY_1);
|
||||
assertThat(messages.get(0).getValue()).isEqualTo(Collections.singletonMap(KEY_3, VALUE_3));
|
||||
|
||||
assertThat(messages.get(1).getStream()).isEqualTo(KEY_1);
|
||||
assertThat(messages.get(1).getValue()).isEqualTo(Collections.singletonMap(KEY_2, VALUE_2));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-1084
|
||||
@IfProfileValue(name = "redisVersion", value = "5.0")
|
||||
@WithRedisDriver({ RedisDriver.LETTUCE })
|
||||
|
||||
Reference in New Issue
Block a user