Index: src/test/java/info/magnolia/cms/beans/config/PropertiesInitializerTest.java =================================================================== --- src/test/java/info/magnolia/cms/beans/config/PropertiesInitializerTest.java (revision 41320) +++ src/test/java/info/magnolia/cms/beans/config/PropertiesInitializerTest.java (working copy) @@ -65,6 +65,7 @@ protected void tearDown() throws Exception { SystemProperty.getProperties().clear(); + System.getProperties().remove("testProp"); super.tearDown(); } @@ -119,4 +120,19 @@ assertEquals("WEB-INF/paramvalue/attributevalue", replaced); } + + public void testSystemPropertiesCanBeUsed() { + System.setProperty("testProp", "hello"); + final String res = PropertiesInitializer.processPropertyFilesString(null, null, null, "WEB-INF/${systemProperty/testProp}/magnolia.properties"); + assertEquals("WEB-INF/hello/magnolia.properties", res); + } + + public void testEnvironmentPropertiesCanBeUsed() { + // since we can't add properties to System.env, we just an env property whose value we can know otherwise. + // This test will most likely fail on Windows (where the env property seems to be USERNAME), unless someone comes up with a brighter idea. + final String user = System.getProperty("user.name"); + + final String res = PropertiesInitializer.processPropertyFilesString(null, null, null, "WEB-INF/${env/USER}/magnolia.properties"); + assertEquals("WEB-INF/"+user+"/magnolia.properties", res); + } }