From 7cdc0f5eee5829928c89a6a60396a4f7c8cec48f Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Wed, 16 Sep 2020 07:38:24 +0200 Subject: [PATCH] DATAREDIS-1196 - Adapt to Lettuce 6.0-RC2 changes --- .../data/redis/connection/lettuce/LettuceListCommands.java | 2 +- .../connection/lettuce/LettuceReactiveListCommands.java | 2 +- .../connection/AbstractConnectionIntegrationTests.java | 3 --- .../lettuce/LettuceReactiveListCommandTests.java | 4 ---- .../data/redis/core/DefaultListOperationsTests.java | 5 ++--- .../DefaultReactiveListOperationsIntegrationTests.java | 2 -- .../redis/support/collections/AbstractRedisListTests.java | 7 +++---- 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java index 616ac8efe3..1d51b32a21 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java @@ -76,7 +76,7 @@ public List lPos(byte[] key, byte[] element, @Nullable Integer rank, @Null LPosArgs args = new LPosArgs(); if (rank != null) { - args.first(rank); + args.rank(rank); } try { if (isPipelined()) { diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java index 377d08ded9..65602c0c03 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java @@ -162,7 +162,7 @@ public Flux> lPos(Publisher comm LPosArgs args = new LPosArgs(); if (command.getRank() != null) { - args.first(command.getRank()); + args.rank(command.getRank()); } Flux values; diff --git a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java index 2cd3463c67..7a75d97f97 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java @@ -1493,7 +1493,6 @@ public void lPos() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") @WithRedisDriver({ RedisDriver.LETTUCE }) - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lPosRank() { actual.add(connection.rPush("mylist", "a", "b", "c", "1", "2", "3", "c", "c")); @@ -1505,7 +1504,6 @@ public void lPosRank() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") @WithRedisDriver({ RedisDriver.LETTUCE }) - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lPosNegativeRank() { actual.add(connection.rPush("mylist", "a", "b", "c", "1", "2", "3", "c", "c")); @@ -1528,7 +1526,6 @@ public void lPosCount() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") @WithRedisDriver({ RedisDriver.LETTUCE }) - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lPosRankCount() { actual.add(connection.rPush("mylist", "a", "b", "c", "1", "2", "3", "c", "c")); diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandTests.java index fd23cba9b2..c2136469d6 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommandTests.java @@ -27,7 +27,6 @@ import java.time.Duration; import java.util.Arrays; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.springframework.dao.InvalidDataAccessApiUsageException; @@ -327,7 +326,6 @@ public void lPos() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lPosRank() { nativeCommands.rpush(KEY_1, "a", "b", "c", "1", "2", "3", "c", "c"); @@ -341,7 +339,6 @@ public void lPosRank() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lPosNegativeRank() { nativeCommands.rpush(KEY_1, "a", "b", "c", "1", "2", "3", "c", "c"); @@ -369,7 +366,6 @@ public void lPosCount() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lPosRankCount() { nativeCommands.rpush(KEY_1, "a", "b", "c", "1", "2", "3", "c", "c"); diff --git a/src/test/java/org/springframework/data/redis/core/DefaultListOperationsTests.java b/src/test/java/org/springframework/data/redis/core/DefaultListOperationsTests.java index 7bc74c1253..aefc4651ff 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultListOperationsTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultListOperationsTests.java @@ -27,7 +27,6 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -337,7 +336,6 @@ public void indexOf() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lastIndexOf() { K key = keyFactory.instance(); @@ -347,7 +345,8 @@ public void lastIndexOf() { assertThat(listOps.rightPush(key, v1)).isEqualTo(Long.valueOf(1)); assertThat(listOps.rightPush(key, v2)).isEqualTo(Long.valueOf(2)); - assertThat(listOps.rightPush(key, v1, v3)).isEqualTo(Long.valueOf(3)); + assertThat(listOps.rightPush(key, v1)).isEqualTo(Long.valueOf(3)); + assertThat(listOps.rightPush(key, v3)).isEqualTo(Long.valueOf(4)); assertThat(listOps.lastIndexOf(key, v1)).isEqualTo(2); } } diff --git a/src/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.java b/src/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.java index 2d2f44761c..ef454cfc4b 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultReactiveListOperationsIntegrationTests.java @@ -24,7 +24,6 @@ import org.junit.AfterClass; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -388,7 +387,6 @@ public void indexOf() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lastIndexOf() { K key = keyFactory.instance(); diff --git a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java index ecec788b8a..f02c1f1cc5 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/AbstractRedisListTests.java @@ -26,7 +26,6 @@ import org.assertj.core.api.Assumptions; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.springframework.data.redis.ObjectFactory; @@ -44,7 +43,7 @@ public abstract class AbstractRedisListTests extends AbstractRedisCollectionTests { @Rule public MinimumRedisVersionRule redisVersion = new MinimumRedisVersionRule(); - + protected RedisList list; /** @@ -534,7 +533,6 @@ public void testTakeLast() { @Test // DATAREDIS-1196 @IfProfileValue(name = "redisVersion", value = "6.0.6+") - @Ignore("https://github.com/lettuce-io/lettuce-core/issues/1410") public void lastIndexOf() { Assumptions.assumeThat(template.getConnectionFactory()).isInstanceOf(LettuceConnectionFactory.class); @@ -545,8 +543,9 @@ public void lastIndexOf() { list.add(t1); list.add(t2); + list.add(t1); list.add(t3); - assertThat(list.indexOf(t1)).isEqualTo(2); + assertThat(list.lastIndexOf(t1)).isEqualTo(2); } }