use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetBigDecimalRequiredPropertyValue.
@Test
public void testGetBigDecimalRequiredPropertyValue() {
ConfigurationValue configurationValue = ConfigurationValue.EMR_CLUSTER_LOWEST_CORE_INSTANCE_PRICE_PERCENTAGE;
MockEnvironment environment = new MockEnvironment();
environment.setProperty(configurationValue.getKey(), "0.05");
assertEquals(new BigDecimal("0.05"), configurationHelper.getBigDecimalRequiredProperty(configurationValue, environment));
}
use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetBooleanPropertyValueConversionFails.
@Test
public void testGetBooleanPropertyValueConversionFails() {
ConfigurationValue configurationValue = ConfigurationValue.USER_NAMESPACE_AUTHORIZATION_ENABLED;
MockEnvironment environment = new MockEnvironment();
environment.setProperty(configurationValue.getKey(), "NOT_A_BOOLEAN");
try {
configurationHelper.getBooleanProperty(configurationValue, environment);
fail("Should throw an IllegalStatueException when property value is not boolean.");
} catch (IllegalStateException e) {
assertEquals(String.format("Configuration \"%s\" has an invalid boolean value: \"NOT_A_BOOLEAN\".", configurationValue.getKey()), e.getMessage());
}
}
use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetRequiredProperty.
@Test
public void testGetRequiredProperty() {
ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
String value = configurationHelper.getRequiredProperty(configurationValue);
assertEquals(configurationValue.getDefaultValue(), value);
}
use of org.finra.herd.model.dto.ConfigurationValue in project herd by FINRAOS.
the class ConfigurationHelperTest method testGetPropertyReturnDefaultWhenPropertyDoesNotExists.
@Test
public void testGetPropertyReturnDefaultWhenPropertyDoesNotExists() {
ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
String expectedValue = (String) configurationValue.getDefaultValue();
MockEnvironment environment = new MockEnvironment();
environment.setProperty(configurationValue.getKey(), expectedValue);
String value = ConfigurationHelper.getProperty(configurationValue, String.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 testGetPropertyInstance.
@Test
public void testGetPropertyInstance() {
ConfigurationValue configurationValue = ConfigurationValue.HERD_ENVIRONMENT;
String value = configurationHelper.getProperty(configurationValue, String.class);
assertEquals("value", configurationValue.getDefaultValue(), value);
}
Aggregations