use of org.mule.runtime.config.api.dsl.model.properties.DefaultConfigurationPropertiesProvider in project mule by mulesoft.
the class YamlConfigurationPropertiesComponentTestCase method complexListOfObjectsNotSuported.
@Description("Validates that a list of complex objects is not valid")
@Test
public void complexListOfObjectsNotSuported() throws InitialisationException {
configurationComponent = new DefaultConfigurationPropertiesProvider("complex-list-object.yaml", externalResourceProvider);
expectedException.expectMessage("Configuration properties does not support type a list of complex types. Complex type keys are: complex");
expectedException.expect(ConfigurationPropertiesException.class);
configurationComponent.initialise();
}
use of org.mule.runtime.config.api.dsl.model.properties.DefaultConfigurationPropertiesProvider in project mule by mulesoft.
the class YamlConfigurationPropertiesComponentTestCase method unsupportedType.
@Description("Validates that a only string types are supported")
@Test
public void unsupportedType() throws InitialisationException {
configurationComponent = new DefaultConfigurationPropertiesProvider("unsupported-type.yaml", externalResourceProvider);
expectedException.expectMessage("YAML configuration properties only supports string values, make sure to wrap the value with \" so you force the value to be an string. Offending property is integer with value 1235");
expectedException.expect(ConfigurationPropertiesException.class);
configurationComponent.initialise();
}
use of org.mule.runtime.config.api.dsl.model.properties.DefaultConfigurationPropertiesProvider in project mule by mulesoft.
the class YamlConfigurationPropertiesComponentTestCase method validConfig.
@Description("Validates the values obtained for the different types in the properties")
@Test
public void validConfig() throws InitialisationException {
configurationComponent = new DefaultConfigurationPropertiesProvider("properties.yaml", externalResourceProvider);
configurationComponent.initialise();
assertThat(configurationComponent.getConfigurationProperty("number").get().getRawValue(), is("34843"));
assertThat(configurationComponent.getConfigurationProperty("float").get().getRawValue(), is("2392.00"));
assertThat(configurationComponent.getConfigurationProperty("date").get().getRawValue(), is("2001-01-23"));
assertThat(configurationComponent.getConfigurationProperty("lines").get().getRawValue(), is("458 Walkman Dr.\nSuite #292\n"));
assertThat(configurationComponent.getConfigurationProperty("list").get().getRawValue(), is("one,two,three"));
assertThat(configurationComponent.getConfigurationProperty("complex.prop0").get().getRawValue(), is("value0"));
assertThat(configurationComponent.getConfigurationProperty("complex.complex2.prop1").get().getRawValue(), is("value1"));
assertThat(configurationComponent.getConfigurationProperty("complex.complex2.prop2").get().getRawValue(), is("value2"));
}
Aggregations