From d4f9893bae2b4cec82f02e46b4c1c20a832acd02 Mon Sep 17 00:00:00 2001 From: Nadia Mayor Date: Mon, 31 Jul 2023 10:58:07 -0300 Subject: [PATCH 1/5] [SDKS-7334] Update CommonRedis to build key without prefix --- .../main/java/redis/common/CommonRedis.java | 3 ++ .../src/test/java/redis/RedisSingleTest.java | 28 +++++++++++++++++-- .../java/redis/common/CommonRedisTest.java | 17 +++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 redis-wrapper/src/test/java/redis/common/CommonRedisTest.java diff --git a/redis-wrapper/src/main/java/redis/common/CommonRedis.java b/redis-wrapper/src/main/java/redis/common/CommonRedis.java index 907c73e8c..895205b96 100644 --- a/redis-wrapper/src/main/java/redis/common/CommonRedis.java +++ b/redis-wrapper/src/main/java/redis/common/CommonRedis.java @@ -17,6 +17,9 @@ public static CommonRedis create(String prefix) { } public String buildKeyWithPrefix(String key) { + if (_prefix.isEmpty()) { + return key; + } return String.format("%s.%s", _prefix, key); } diff --git a/redis-wrapper/src/test/java/redis/RedisSingleTest.java b/redis-wrapper/src/test/java/redis/RedisSingleTest.java index 286c49af2..a58e0673a 100644 --- a/redis-wrapper/src/test/java/redis/RedisSingleTest.java +++ b/redis-wrapper/src/test/java/redis/RedisSingleTest.java @@ -4,7 +4,6 @@ import org.junit.Test; import pluggable.CustomStorageWrapper; import redis.clients.jedis.JedisPool; -import redis.common.CommonRedis; import java.util.ArrayList; import java.util.Arrays; @@ -16,7 +15,6 @@ import java.util.stream.Stream; public class RedisSingleTest { - private final CommonRedis _commonRedis = CommonRedis.create("test-prefix:"); @Test public void testSetAndGet() throws Exception { @@ -255,5 +253,29 @@ public void testDisconnect() throws Exception { RedisSingle storageWrapper = new RedisSingle(new JedisPool(), "test-prefix"); Assert.assertTrue(storageWrapper.disconnect()); } -} + @Test + public void testWithoutPrefix() throws Exception { + Map map = new HashMap<>(); + map.put("item-1", "1"); + map.put("item-2", "2"); + map.put("item-3", "3"); + map.put("i-4", "4"); + RedisSingle storageWrapper = new RedisSingle(new JedisPool(), ""); + try { + for (Map.Entry entry : map.entrySet()) { + storageWrapper.set(entry.getKey(), entry.getValue()); + } + + Set result = storageWrapper.getKeysByPrefix("item*"); + + Assert.assertEquals(3, result.size()); + Assert.assertTrue(result.contains("item-1")); + Assert.assertTrue(result.contains("item-2")); + Assert.assertTrue(result.contains("item-3")); + } + finally { + storageWrapper.delete(new ArrayList<>(map.keySet())); + } + } +} \ No newline at end of file diff --git a/redis-wrapper/src/test/java/redis/common/CommonRedisTest.java b/redis-wrapper/src/test/java/redis/common/CommonRedisTest.java new file mode 100644 index 000000000..4b36b0e97 --- /dev/null +++ b/redis-wrapper/src/test/java/redis/common/CommonRedisTest.java @@ -0,0 +1,17 @@ +package redis.common; + +import org.junit.Assert; +import org.junit.Test; + + +public class CommonRedisTest { + + @Test + public void testBuildKey(){ + CommonRedis commonRedisWithPrefix = CommonRedis.create("testing:"); + Assert.assertEquals("testing:.feature_flag1", commonRedisWithPrefix.buildKeyWithPrefix("feature_flag1")); + + CommonRedis commonRedisWithoutPrefix = CommonRedis.create(""); + Assert.assertEquals("feature_flag2", commonRedisWithoutPrefix.buildKeyWithPrefix("feature_flag2")); + } +} \ No newline at end of file From 8882c10595ee99dd76d082bdcc275470400ca02f Mon Sep 17 00:00:00 2001 From: Nadia Mayor Date: Mon, 31 Jul 2023 16:48:54 -0300 Subject: [PATCH 2/5] Update pom version for tapps --- client/pom.xml | 4 ++-- pluggable-storage/pom.xml | 2 +- pom.xml | 2 +- redis-wrapper/pom.xml | 2 +- testing/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index 4c1afd402..df98f7628 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -5,7 +5,7 @@ io.split.client java-client-parent - 4.8.0 + 4.8.1-rc1 java-client jar @@ -229,7 +229,7 @@ com.squareup.okhttp3 mockwebserver - 4.8.0 + 4.8.1-rc1 test diff --git a/pluggable-storage/pom.xml b/pluggable-storage/pom.xml index 240e626f5..59c90461b 100644 --- a/pluggable-storage/pom.xml +++ b/pluggable-storage/pom.xml @@ -6,7 +6,7 @@ java-client-parent io.split.client - 4.8.0 + 4.8.1-rc1 2.0.0 diff --git a/pom.xml b/pom.xml index dd0b5614e..f16e3c298 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.split.client java-client-parent - 4.8.0 + 4.8.1-rc1 diff --git a/redis-wrapper/pom.xml b/redis-wrapper/pom.xml index 2e6c6da58..cb1c951d0 100644 --- a/redis-wrapper/pom.xml +++ b/redis-wrapper/pom.xml @@ -6,7 +6,7 @@ java-client-parent io.split.client - 4.8.0 + 4.8.1-rc1 redis-wrapper 3.0.0 diff --git a/testing/pom.xml b/testing/pom.xml index b75f26bd4..3273e6736 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -5,7 +5,7 @@ io.split.client java-client-parent - 4.8.0 + 4.8.1-rc1 java-client-testing jar From 6240fe2bc8b9b2291cdcf100e26360b6010ac865 Mon Sep 17 00:00:00 2001 From: Nadia Mayor Date: Mon, 31 Jul 2023 17:09:37 -0300 Subject: [PATCH 3/5] Update redis and client version --- client/pom.xml | 2 +- redis-wrapper/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index df98f7628..b2236278a 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -229,7 +229,7 @@ com.squareup.okhttp3 mockwebserver - 4.8.1-rc1 + 4.8.0 test diff --git a/redis-wrapper/pom.xml b/redis-wrapper/pom.xml index cb1c951d0..f032b8817 100644 --- a/redis-wrapper/pom.xml +++ b/redis-wrapper/pom.xml @@ -9,7 +9,7 @@ 4.8.1-rc1 redis-wrapper - 3.0.0 + 3.0.1-rc1 jar Package for Redis Wrapper Implementation Implements Redis Pluggable Storage From aa631aefab41b294e909e0f16327068aa71e85ab Mon Sep 17 00:00:00 2001 From: Nadia Mayor Date: Tue, 1 Aug 2023 15:35:08 -0300 Subject: [PATCH 4/5] [SDKS-7334] Update the CHANGES --- CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index ee78d8ba1..f920ad693 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +4.8.1 (Aug 1, 2023) +- Added the checkstyle linter. +- Fixed the use case when the prefix is empty for Redis. + 4.8.0 (Jul 18, 2023) - Improved streaming architecture implementation to apply feature flag updates from the notification received which is now enhanced, improving efficiency and reliability of the whole update system. - Updated `com.google.guava` dependence to 32.0.1 for fixing a vulnerability. From ec03eba74a12b7f83faced123de2f8073b7f751d Mon Sep 17 00:00:00 2001 From: Nadia Mayor Date: Tue, 1 Aug 2023 15:44:41 -0300 Subject: [PATCH 5/5] [SDKS-7334] Update client and redis version --- client/pom.xml | 2 +- pluggable-storage/pom.xml | 2 +- pom.xml | 2 +- redis-wrapper/pom.xml | 4 ++-- testing/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index b2236278a..a775f5fb4 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -5,7 +5,7 @@ io.split.client java-client-parent - 4.8.1-rc1 + 4.8.1 java-client jar diff --git a/pluggable-storage/pom.xml b/pluggable-storage/pom.xml index 59c90461b..f2a69fc6a 100644 --- a/pluggable-storage/pom.xml +++ b/pluggable-storage/pom.xml @@ -6,7 +6,7 @@ java-client-parent io.split.client - 4.8.1-rc1 + 4.8.1 2.0.0 diff --git a/pom.xml b/pom.xml index f16e3c298..9b4160086 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.split.client java-client-parent - 4.8.1-rc1 + 4.8.1 diff --git a/redis-wrapper/pom.xml b/redis-wrapper/pom.xml index f032b8817..99b77073e 100644 --- a/redis-wrapper/pom.xml +++ b/redis-wrapper/pom.xml @@ -6,10 +6,10 @@ java-client-parent io.split.client - 4.8.1-rc1 + 4.8.1 redis-wrapper - 3.0.1-rc1 + 3.0.1 jar Package for Redis Wrapper Implementation Implements Redis Pluggable Storage diff --git a/testing/pom.xml b/testing/pom.xml index 3273e6736..d35996d06 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -5,7 +5,7 @@ io.split.client java-client-parent - 4.8.1-rc1 + 4.8.1 java-client-testing jar