Preferences.systemRoot().node("mySystemPath").remove("myTouchy");
Preferences.systemRoot().node("mySystemPath").remove("myName");
}
public void testPreferencesPlaceholderConfigurerWithPathInPlaceholder() {
StaticApplicationContext ac = new StaticApplicationContext();
MutablePropertyValues pvs = new MutablePropertyValues();
pvs.addPropertyValue("name", "${mypath/myName}");
pvs.addPropertyValue("age", "${myAge}");
pvs.addPropertyValue("touchy", "${myotherpath/myTouchy}");
ac.registerSingleton("tb", TestBean.class, pvs);
pvs = new MutablePropertyValues();
Properties props = new Properties();
props.put("myAge", "99");
pvs.addPropertyValue("properties", props);
pvs.addPropertyValue("systemTreePath", "mySystemPath");
pvs.addPropertyValue("userTreePath", "myUserPath");
ac.registerSingleton("configurer", PreferencesPlaceholderConfigurer.class, pvs);
Preferences.systemRoot().node("mySystemPath").node("mypath").put("myName", "myNameValue");
Preferences.systemRoot().node("mySystemPath/myotherpath").put("myTouchy", "myTouchyValue");
Preferences.userRoot().node("myUserPath/myotherpath").put("myTouchy", "myOtherTouchyValue");
ac.refresh();
TestBean tb = (TestBean) ac.getBean("tb");
assertEquals("myNameValue", tb.getName());
assertEquals(99, tb.getAge());
assertEquals("myOtherTouchyValue", tb.getTouchy());
Preferences.userRoot().node("myUserPath/myotherpath").remove("myTouchy");
Preferences.systemRoot().node("mySystemPath/myotherpath").remove("myTouchy");