From c39753001ed74c37d0a607d7c05b24a2304eba5d Mon Sep 17 00:00:00 2001 From: Fabian Nonnenmacher Date: Fri, 29 Jan 2016 18:10:42 +0100 Subject: [PATCH] Bugfix: Setting and getting configuration values - removed cache from global getter, because it was overriding the cache of the tenant specific getter - changed Type of AuthName key, type of key was not important before the huge configuration refactoring - fixed test conditions Signed-off-by: Nonnenmacher Fabian --- .../hawkbit/tenancy/configuration/TenantConfigurationKey.java | 4 ++-- .../hawkbit/repository/TenantConfigurationManagement.java | 1 - .../hawkbit/repository/TenantConfigurationManagementTest.java | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/TenantConfigurationKey.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/TenantConfigurationKey.java index fc1e3a856..1f5481dc0 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/TenantConfigurationKey.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/TenantConfigurationKey.java @@ -35,8 +35,8 @@ public enum TenantConfigurationKey { * */ AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME("authentication.header.authority", - "hawkbit.server.controller.security.authentication.header.authority", Boolean.class, - Boolean.FALSE.toString(), TenantConfigurationBooleanValidator.class), + "hawkbit.server.controller.security.authentication.header.authority", String.class, + Boolean.FALSE.toString(), TenantConfigurationStringValidator.class), /** * boolean value {@code true} {@code false}. */ diff --git a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/TenantConfigurationManagement.java b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/TenantConfigurationManagement.java index 522437bd0..85432e8a2 100644 --- a/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/TenantConfigurationManagement.java +++ b/hawkbit-repository/src/main/java/org/eclipse/hawkbit/repository/TenantConfigurationManagement.java @@ -146,7 +146,6 @@ public class TenantConfigurationManagement implements EnvironmentAware { * if the property cannot be converted to the given * {@code propertyType} */ - @Cacheable(value = "tenantConfiguration", key = "#configurationKey.getKeyName()") @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION) public T getGlobalConfigurationValue(final TenantConfigurationKey configurationKey, final Class propertyType) throws TenantConfigurationValidatorException { diff --git a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TenantConfigurationManagementTest.java b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TenantConfigurationManagementTest.java index 6b267aa24..1fb41048f 100644 --- a/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TenantConfigurationManagementTest.java +++ b/hawkbit-repository/src/test/java/org/eclipse/hawkbit/repository/TenantConfigurationManagementTest.java @@ -14,7 +14,6 @@ import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey; import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationValidatorException; import org.junit.Assert; import org.junit.Test; -import org.springframework.core.convert.ConversionFailedException; import ru.yandex.qatools.allure.annotations.Description; import ru.yandex.qatools.allure.annotations.Features; @@ -86,7 +85,7 @@ public class TenantConfigurationManagementTest extends AbstractIntegrationTestWi .isEqualTo(value2); } - @Test(expected = ConversionFailedException.class) + @Test(expected = TenantConfigurationValidatorException.class) @Description("Tests that the get configuration throws exception in case the value cannot be automatically converted from String to Boolean") public void wrongTenantConfigurationValueTypeThrowsException() { final TenantConfigurationKey configKey = TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_ENABLED;