Added REST interfaces for tenant configuration

- added GET, DELETE and PUT function on configuration value interfaces
- changed Exception in TenantConfigurationManagement for correct mapping to HTTP Status
- added function to get global configurations from TenantConfigurationManagement, to have
  only one class for handling these configuration values

Signed-off-by: Nonnenmacher Fabian <fabian.nonnenmacher@bosch-si.com>
This commit is contained in:
Fabian Nonnenmacher
2016-01-28 18:44:31 +01:00
committed by Nonnenmacher Fabian
parent 4be880587a
commit ec79e9bd19
20 changed files with 389 additions and 246 deletions

View File

@@ -11,8 +11,10 @@ import org.eclipse.hawkbit.AbstractIntegrationTestWithMongoDB;
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
import org.eclipse.hawkbit.tenancy.configuration.DurationHelper;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.eclipse.hawkbit.tenancy.configuration.validator.exceptions.TenantConfigurationValidatorException;
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;
@@ -84,7 +86,7 @@ public class TenantConfigurationManagementTest extends AbstractIntegrationTestWi
.isEqualTo(value2);
}
@Test(expected = TenantConfigurationValidatorException.class)
@Test(expected = ConversionFailedException.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;
@@ -179,10 +181,16 @@ public class TenantConfigurationManagementTest extends AbstractIntegrationTestWi
assertThat(duration).isEqualTo(durationHelper.formattedStringToDuration(storedDurationString));
}
@Test(expected = IllegalAccessError.class)
@Test
@Description("Request a config value in a wrong Value")
public void requestConfigValueWithWrongType() {
tenantConfigurationManagement.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, Object.class);
try {
tenantConfigurationManagement.getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL,
Object.class);
Assert.fail("");
} catch (final TenantConfigurationValidatorException e) {
}
}
@Test