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:
committed by
Nonnenmacher Fabian
parent
d83286c94a
commit
4be880587a
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user