use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetNonNegativeBigDecimalRequiredPropertyValueBlankStringValue.
@Test
public void testGetNonNegativeBigDecimalRequiredPropertyValueBlankStringValue() {
ConfigurationValue configurationValue = ConfigurationValue.EMR_CLUSTER_LOWEST_CORE_INSTANCE_PRICE_PERCENTAGE;
MockEnvironment environment = new MockEnvironment();
environment.setProperty(configurationValue.getKey(), " ");
try {
configurationHelper.getNonNegativeBigDecimalRequiredProperty(configurationValue, environment);
fail("Should throw an IllegalStatueException when property value is not BigDecimal.");
} catch (IllegalStateException e) {
assertEquals(String.format("Configuration \"%s\" must have a value.", configurationValue.getKey()), e.getMessage());
}
}
use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetBooleanPropertyValue.
@Test
public void testGetBooleanPropertyValue() {
ConfigurationValue configurationValue = ConfigurationValue.USER_NAMESPACE_AUTHORIZATION_ENABLED;
MockEnvironment environment = new MockEnvironment();
environment.setProperty(configurationValue.getKey(), "true");
assertEquals(Boolean.TRUE, configurationHelper.getBooleanProperty(configurationValue, environment));
}
use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetPropertyInstanceNoTargetType.
@Test
public void testGetPropertyInstanceNoTargetType() {
ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
String value = configurationHelper.getProperty(configurationValue);
assertEquals("value", configurationValue.getDefaultValue(), value);
}
use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetPropertyReturnDefaultWhenValueConversionFails.
@Test
public void testGetPropertyReturnDefaultWhenValueConversionFails() throws Exception {
ConfigurationValue configurationValue = ConfigurationValue.BUSINESS_OBJECT_DATA_SEARCH_MAX_RESULTS;
Integer expectedValue = (Integer) configurationValue.getDefaultValue();
MockEnvironment environment = new MockEnvironment();
environment.setProperty(configurationValue.getKey(), "NOT_AN_INTEGER");
executeWithoutLogging(ConfigurationHelper.class, () -> {
Integer value = ConfigurationHelper.getProperty(configurationValue, Integer.class, environment);
assertNotNull("value", value);
assertEquals("value", expectedValue, value);
});
}
use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetBigDecimalRequiredPropertyValueBlankStringValue.
@Test
public void testGetBigDecimalRequiredPropertyValueBlankStringValue() {
ConfigurationValue configurationValue = ConfigurationValue.EMR_CLUSTER_LOWEST_CORE_INSTANCE_PRICE_PERCENTAGE;
MockEnvironment environment = new MockEnvironment();
environment.setProperty(configurationValue.getKey(), " ");
try {
configurationHelper.getBigDecimalRequiredProperty(configurationValue, environment);
fail("Should throw an IllegalStatueException when property value is not BigDecimal.");
} catch (IllegalStateException e) {
assertEquals(String.format("Configuration \"%s\" must have a value.", configurationValue.getKey()), e.getMessage());
}
}
Aggregations