DATAREDIS-1042 - Polishing.
Set MKSTREAM by default when calling createGroup on the operations API as that should be the default behavior in the first place. Reformat code. Add since tags. Original pull request: #527.
This commit is contained in:
@@ -3064,7 +3064,7 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
@WithRedisDriver({ RedisDriver.LETTUCE })
|
||||
public void xGroupCreateShouldWorkWithAndWithoutExistingStream() {
|
||||
|
||||
actual.add(connection.xGroupCreate(KEY_1, ReadOffset.from("0"), "my-group",true));
|
||||
actual.add(connection.xGroupCreate(KEY_1, ReadOffset.from("0"), "my-group", true));
|
||||
actual.add(connection.xAdd(KEY_1, Collections.singletonMap(KEY_2, VALUE_2)));
|
||||
|
||||
actual.add(connection.xReadGroupAsString(Consumer.from("my-group", "my-consumer"),
|
||||
@@ -3276,7 +3276,7 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
@WithRedisDriver({ RedisDriver.LETTUCE })
|
||||
public void xinfo() {
|
||||
|
||||
actual.add(connection.xGroupCreate(KEY_1, ReadOffset.from("0"), "my-group-without-stream",true));
|
||||
actual.add(connection.xGroupCreate(KEY_1, ReadOffset.from("0"), "my-group-without-stream", true));
|
||||
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.xGroupCreate(KEY_1, ReadOffset.from("0"), "my-group"));
|
||||
|
||||
@@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import io.lettuce.core.XReadArgs;
|
||||
import org.springframework.data.redis.RedisSystemException;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import java.time.Duration;
|
||||
@@ -29,7 +28,9 @@ import org.assertj.core.data.Offset;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.data.domain.Range;
|
||||
import org.springframework.data.redis.RedisSystemException;
|
||||
import org.springframework.data.redis.RedisTestProfileValueSource;
|
||||
import org.springframework.data.redis.connection.RedisStreamCommands.XClaimOptions;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Limit;
|
||||
|
||||
@@ -55,7 +55,6 @@ import org.springframework.data.redis.stream.StreamReceiver.StreamReceiverOption
|
||||
* Integration tests for {@link StreamReceiver}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Tugdual Grall
|
||||
*/
|
||||
public class StreamReceiverIntegrationTests {
|
||||
|
||||
@@ -213,9 +212,8 @@ public class StreamReceiverIntegrationTests {
|
||||
Flux<MapRecord<String, String, String>> messages = receiver.receive(Consumer.from("my-group", "my-consumer-id"),
|
||||
StreamOffset.create("my-stream", ReadOffset.lastConsumed()));
|
||||
|
||||
// required to initialize stream
|
||||
redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key", "value"));
|
||||
redisTemplate.opsForStream().createGroup("my-stream", ReadOffset.from("0-0"), "my-group");
|
||||
redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key", "value"));
|
||||
redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key2", "value2"));
|
||||
|
||||
messages.as(StepVerifier::create) //
|
||||
@@ -246,9 +244,8 @@ public class StreamReceiverIntegrationTests {
|
||||
Flux<MapRecord<String, String, String>> messages = receiver.receive(Consumer.from("my-group", "my-consumer-id"),
|
||||
StreamOffset.create("my-stream", ReadOffset.lastConsumed()));
|
||||
|
||||
// required to initialize stream
|
||||
redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key", "value"));
|
||||
redisTemplate.opsForStream().createGroup("my-stream", ReadOffset.from("0-0"), "my-group");
|
||||
redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key", "value"));
|
||||
|
||||
messages.as(StepVerifier::create) //
|
||||
.expectNextCount(1) //
|
||||
@@ -257,31 +254,6 @@ public class StreamReceiverIntegrationTests {
|
||||
.verify(Duration.ofSeconds(5));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-864
|
||||
public void shouldCreateGroupWithOrWithoutExistingStream() {
|
||||
StreamReceiver<String, MapRecord<String, String, String>> receiver = StreamReceiver.create(connectionFactory);
|
||||
|
||||
Flux<MapRecord<String, String, String>> messages = receiver.receive(Consumer.from("my-group", "my-consumer-id"),
|
||||
StreamOffset.create("my-stream", ReadOffset.lastConsumed()));
|
||||
|
||||
// required to initialize stream
|
||||
redisTemplate.opsForStream().createGroup("my-stream", ReadOffset.from("0-0"), "my-group", true);
|
||||
redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key", "value"));
|
||||
redisTemplate.opsForStream().add("my-stream", Collections.singletonMap("key2", "value2"));
|
||||
|
||||
messages.as(StepVerifier::create) //
|
||||
.consumeNextWith(it -> {
|
||||
assertThat(it.getStream()).isEqualTo("my-stream");
|
||||
assertThat(it.getValue()).containsValue("value");
|
||||
}).consumeNextWith(it -> {
|
||||
|
||||
assertThat(it.getStream()).isEqualTo("my-stream");
|
||||
assertThat(it.getValue()).containsValue("value2");
|
||||
}) //
|
||||
.thenCancel() //
|
||||
.verify(Duration.ofSeconds(5));
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
static class LoginEvent {
|
||||
|
||||
Reference in New Issue
Block a user