diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java index b014afc8d..60bff2cf1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java @@ -220,7 +220,7 @@ class LettuceClusterServerCommands extends LettuceServerCommands implements Redi public void setConfig(String param, String value) { Assert.hasText(param, "Parameter must not be null or empty"); - Assert.hasText(value, "Value must not be null or empty"); + Assert.notNull(value, "Value must not be null"); executeCommandOnAllNodes(client -> client.configSet(param, value)); } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java index 15c203b89..5a95ace74 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java @@ -130,7 +130,7 @@ class LettuceReactiveServerCommands implements ReactiveServerCommands { public Mono setConfig(String param, String value) { Assert.hasText(param, "Parameter must not be null or empty"); - Assert.hasText(value, "Value must not be null or empty"); + Assert.notNull(value, "Value must not be null"); return connection.execute(c -> c.configSet(param, value)).next(); } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java index 1acb7dff1..3f2099f84 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java @@ -145,7 +145,7 @@ class LettuceServerCommands implements RedisServerCommands { public void setConfig(String param, String value) { Assert.hasText(param, "Parameter must not be null or empty"); - Assert.hasText(value, "Value must not be null or empty"); + Assert.notNull(value, "Value must not be null"); connection.invokeStatus().just(RedisServerAsyncCommands::configSet, param, value); } diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java index 0361f7dbf..7967ecf39 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java @@ -215,6 +215,23 @@ public class LettuceReactiveServerCommandsIntegrationTests extends LettuceReacti } } + @ParameterizedRedisTest // GH-2798 + void setConfigShouldRespondCorrectly() { + + if (!(connection instanceof LettuceReactiveRedisClusterConnection)) { + + connection.serverCommands().setConfig("notify-keyspace-events", "") // + .as(StepVerifier::create) // + .expectNext("OK") + .verifyComplete(); + + connection.serverCommands().setConfig("notify-keyspace-events", "KEA") // + .as(StepVerifier::create) // + .expectNext("OK") + .verifyComplete(); + } + } + @ParameterizedRedisTest // DATAREDIS-659 void setConfigShouldApplyConfiguration() { diff --git a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java index d9ac4c732..2d913ded5 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java @@ -91,6 +91,7 @@ public class RedisKeyValueAdapterTests { RedisConnection connection = template.getConnectionFactory().getConnection(); try { + connection.setConfig("notify-keyspace-events", ""); connection.setConfig("notify-keyspace-events", "KEA"); } finally { connection.close();