DATAGEODE-330 - Enhance GemFireProperties.from(:String) to handle valid 'gemfire.' prefixed properties.
This commit is contained in:
@@ -24,6 +24,7 @@ import org.apache.geode.distributed.ConfigurationProperties;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -164,10 +165,9 @@ public enum GemFireProperties {
|
||||
}
|
||||
|
||||
private static boolean equals(GemFireProperties property, String propertyName) {
|
||||
return property != null && property.getName().equals(propertyName);
|
||||
return property != null && property.getName().equals(normalizePropertyName(propertyName));
|
||||
}
|
||||
|
||||
/*
|
||||
private static String normalizePropertyName(@Nullable String propertyName) {
|
||||
|
||||
String safePropertyName = String.valueOf(propertyName).trim();
|
||||
@@ -178,7 +178,6 @@ public enum GemFireProperties {
|
||||
|
||||
return index > -1 && gemfireDotPrefixed ? safePropertyName.substring(index + 1) : propertyName;
|
||||
}
|
||||
*/
|
||||
|
||||
private Class<?> nullSafeType(Object target, Class<?> defaultType) {
|
||||
return target != null ? target.getClass() : defaultType;
|
||||
|
||||
@@ -117,8 +117,8 @@ public class GemFirePropertiesUnitTests {
|
||||
public void fromValidGemFireProperty() {
|
||||
|
||||
assertThat(GemFireProperties.from("cache-xml-file")).isEqualTo(GemFireProperties.CACHE_XML_FILE);
|
||||
//assertThat(GemFireProperties.from("gemfire.locators")).isEqualTo(GemFireProperties.LOCATORS);
|
||||
//assertThat(GemFireProperties.from(" gemfire.remote-locators ")).isEqualTo(GemFireProperties.REMOTE_LOCATORS);
|
||||
assertThat(GemFireProperties.from("gemfire.locators")).isEqualTo(GemFireProperties.LOCATORS);
|
||||
assertThat(GemFireProperties.from(" gemfire.remote-locators ")).isEqualTo(GemFireProperties.REMOTE_LOCATORS);
|
||||
}
|
||||
|
||||
private void testFromInvalidGemFireProperty(String propertyName) {
|
||||
|
||||
Reference in New Issue
Block a user