Polishing.
Add leftPop/rightPop methods to BoundListOperations. Tweak Javadoc and add since tags. Extend tests. Closes #1987
This commit is contained in:
@@ -80,6 +80,7 @@ import org.springframework.data.redis.core.types.RedisClientInfo;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.test.condition.EnabledOnCommand;
|
||||
import org.springframework.data.redis.test.condition.EnabledOnRedisDriver;
|
||||
import org.springframework.data.redis.test.condition.EnabledOnRedisVersion;
|
||||
import org.springframework.data.redis.test.condition.LongRunningTest;
|
||||
import org.springframework.data.redis.test.condition.RedisDriver;
|
||||
import org.springframework.data.redis.test.util.HexStringUtils;
|
||||
@@ -1286,6 +1287,16 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
verifyResults(Arrays.asList(new Object[] { 1L, 2L, "hello" }));
|
||||
}
|
||||
|
||||
@Test // GH-1987
|
||||
@EnabledOnRedisVersion("6.2")
|
||||
void testLPopWithCount() {
|
||||
actual.add(connection.rPush("PopList", "hello"));
|
||||
actual.add(connection.rPush("PopList", "world"));
|
||||
actual.add(connection.rPush("PopList", "42"));
|
||||
actual.add(connection.lPop("PopList", 2));
|
||||
verifyResults(Arrays.asList(new Object[] { 1L, 2L, 3L, Arrays.asList("hello", "world") }));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLRem() {
|
||||
actual.add(connection.rPush("PopList", "hello"));
|
||||
@@ -1335,6 +1346,16 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
verifyResults(Arrays.asList(new Object[] { 1L, 2L, "world" }));
|
||||
}
|
||||
|
||||
@Test // GH-1987
|
||||
@EnabledOnRedisVersion("6.2")
|
||||
void testRPopWithCount() {
|
||||
actual.add(connection.rPush("PopList", "hello"));
|
||||
actual.add(connection.rPush("PopList", "world"));
|
||||
actual.add(connection.rPush("PopList", "42"));
|
||||
actual.add(connection.rPop("PopList", 2));
|
||||
verifyResults(Arrays.asList(new Object[] { 1L, 2L, 3L, Arrays.asList("42", "world") }));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRPopLPush() {
|
||||
actual.add(connection.rPush("PopList", "hello"));
|
||||
|
||||
@@ -670,14 +670,14 @@ public class DefaultStringRedisConnectionTests {
|
||||
verifyResults(Collections.singletonList(bar));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // GH-1987
|
||||
public void testLPopCountBytes() {
|
||||
doReturn(Collections.singletonList(barBytes)).when(nativeConnection).lPop(fooBytes, 2);
|
||||
actual.add(connection.lPop(fooBytes, 2));
|
||||
verifyResults(Collections.singletonList(bytesList));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // GH-1987
|
||||
public void testLPopCount() {
|
||||
doReturn(Collections.singletonList(barBytes)).when(nativeConnection).lPop(fooBytes, 2);
|
||||
actual.add(connection.lPop(foo, 2));
|
||||
@@ -852,14 +852,14 @@ public class DefaultStringRedisConnectionTests {
|
||||
verifyResults(Collections.singletonList(bar));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // GH-1987
|
||||
public void testRPopCountBytes() {
|
||||
doReturn(Collections.singletonList(barBytes)).when(nativeConnection).rPop(fooBytes, 2);
|
||||
actual.add(connection.rPop(fooBytes, 2));
|
||||
verifyResults(Collections.singletonList(bytesList));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // GH-1987
|
||||
public void testRPopCount() {
|
||||
doReturn(Collections.singletonList(barBytes)).when(nativeConnection).rPop(fooBytes, 2);
|
||||
actual.add(connection.rPop(foo, 2));
|
||||
|
||||
@@ -509,6 +509,18 @@ public class DefaultStringRedisConnectionTxTests extends DefaultStringRedisConne
|
||||
super.testLPop();
|
||||
}
|
||||
|
||||
@Test // GH-1987
|
||||
public void testLPopCountBytes() {
|
||||
doReturn(Collections.singletonList(Collections.singletonList(barBytes))).when(nativeConnection).exec();
|
||||
super.testLPopCountBytes();
|
||||
}
|
||||
|
||||
@Test // GH-1987
|
||||
public void testLPopCount() {
|
||||
doReturn(Collections.singletonList(Collections.singletonList(barBytes))).when(nativeConnection).exec();
|
||||
super.testLPopCount();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLPushBytes() {
|
||||
doReturn(Collections.singletonList(8L)).when(nativeConnection).exec();
|
||||
@@ -653,6 +665,18 @@ public class DefaultStringRedisConnectionTxTests extends DefaultStringRedisConne
|
||||
super.testRPop();
|
||||
}
|
||||
|
||||
@Test // GH-1987
|
||||
public void testRPopCountBytes() {
|
||||
doReturn(Collections.singletonList(Collections.singletonList(barBytes))).when(nativeConnection).exec();
|
||||
super.testRPopCountBytes();
|
||||
}
|
||||
|
||||
@Test // GH-1987
|
||||
public void testRPopCount() {
|
||||
doReturn(Collections.singletonList(Collections.singletonList(barBytes))).when(nativeConnection).exec();
|
||||
super.testRPopCount();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRPopLPushBytes() {
|
||||
doReturn(Arrays.asList(new Object[] { barBytes })).when(nativeConnection).exec();
|
||||
|
||||
Reference in New Issue
Block a user