Added validation before saving TenantConfiguration and updated tests

* run the validation methodes inside the storing methode, to make sure that only
  valid values are written inside the database
* updated TenantConfigurationManagementTest to match the validation
* added new Tests to test all validators

Signed-off-by: Nonnenmacher Fabian <fabian.nonnenmacher@bosch-si.com>
This commit is contained in:
Fabian Nonnenmacher
2016-01-28 18:16:31 +01:00
committed by Nonnenmacher Fabian
parent d83286c94a
commit 4be880587a
9 changed files with 193 additions and 74 deletions

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit.tenancy.configuration;
import java.util.Arrays;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationBooleanValidator;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationPollingDurationValidator;
import org.eclipse.hawkbit.tenancy.configuration.validator.TenantConfigurationStringValidator;
@@ -19,9 +21,6 @@ import org.springframework.context.ApplicationContext;
* An enum which defines the tenant specific configurations which can be
* configured for each tenant seperately.
*
*
*
*
*/
public enum TenantConfigurationKey {
@@ -150,4 +149,10 @@ public enum TenantConfigurationKey {
context.getAutowireCapableBeanFactory().destroyBean(createBean);
}
}
public static TenantConfigurationKey fromKeyName(final String keyName) {
return Arrays.stream(TenantConfigurationKey.values()).filter(conf -> conf.getKeyName().equals(keyName))
.findFirst().get();
}
}