DATAREDIS-1049 - Fix retrieval of empty keyspaceNotificationsConfigParameter used to keep server defaults.

Empty Strings changed to be considered null throwing an exception on getRequiredAttribute so we now set the value explicitly for this attribute when considered empty.

Original pull request: #491.
This commit is contained in:
Christoph Strobl
2019-10-30 10:04:35 +01:00
committed by Mark Paluch
parent 2afb579a94
commit 3dfe7af60e
3 changed files with 17 additions and 2 deletions

View File

@@ -114,6 +114,15 @@ public class RedisRepositoryConfigurationExtensionUnitTests {
assertThat(getKeyspaceNotificationsConfigParameter(beanDefintionRegistry)).isEqualTo((Object) "KEA");
}
@Test // DATAREDIS-1049
public void explicitlyEmptyKeyspaceNotificationsConfigParameterShouldBeCapturedCorrectly() {
metadata = new StandardAnnotationMetadata(ConfigWithEmptyConfigParameter.class, true);
BeanDefinitionRegistry beanDefintionRegistry = getBeanDefinitionRegistry();
assertThat(getKeyspaceNotificationsConfigParameter(beanDefintionRegistry)).isEqualTo("");
}
private static void assertDoesNotHaveRepo(Class<?> repositoryInterface,
Collection<RepositoryConfiguration<RepositoryConfigurationSource>> configs) {
@@ -179,6 +188,12 @@ public class RedisRepositoryConfigurationExtensionUnitTests {
}
@EnableRedisRepositories(considerNestedRepositories = true, enableKeyspaceEvents = EnableKeyspaceEvents.ON_STARTUP,
keyspaceNotificationsConfigParameter = "")
static class ConfigWithEmptyConfigParameter {
}
@RedisHash
static class Sample {
@Id String id;