public class DynamicPropertiesNamespaceHandlerTest extends TestCase {
public void testDefault() throws Exception {
GenericApplicationContext context = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/spring/config/dynamicproperties-context.xml"));
context.refresh();
DynamicPropertiesBean bean = (DynamicPropertiesBean) context.getBean("testBean");
bean.print();
assertEquals(true, bean.getBooleanValue());
assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("1999-12-12"), bean.getDateValue());
assertEquals(100.1, bean.getDoubleValue());
assertEquals(10.2F, bean.getFloatValue());
assertEquals(100, bean.getIntValue());
assertEquals(2010L, bean.getLongValue());
assertEquals("Phil", bean.getStringValue());
StaticPropertiesPropertySource propertySource = (StaticPropertiesPropertySource) context.getBean("propertySource");
final Properties properties = propertySource.getProperties();
properties.setProperty("string.property", "Phil Z");
//check that this updates
assertEquals("Phil Z", bean.getStringValue());