Update of /cvsroot/springframework/spring/test/org/springframework/beans/factory/config
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22459/test/org/springframework/beans/factory/config
Modified Files:
PropertiesFactoryBeanTests.java
Log Message:
added "propertiesArray" bean property, for merging multiple local Properties instances
Index: PropertiesFactoryBeanTests.java
===================================================================
RCS file: /cvsroot/springframework/spring/test/org/springframework/beans/factory/config/PropertiesFactoryBeanTests.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PropertiesFactoryBeanTests.java 24 Jun 2005 17:33:31 -0000 1.9
--- PropertiesFactoryBeanTests.java 19 Apr 2006 19:43:58 -0000 1.10
***************
*** 1,11 ****
/*
! * Copyright 2002-2005 the original author or authors.
! *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
! *
* http://www.apache.org/licenses/LICENSE-2.0
! *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
--- 1,11 ----
/*
! * Copyright 2002-2006 the original author or authors.
! *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
! *
* http://www.apache.org/licenses/LICENSE-2.0
! *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
***************
*** 74,77 ****
--- 74,105 ----
}
+ public void testWithPropertiesFileAndMultipleLocalProperties() throws Exception {
+ PropertiesFactoryBean pfb = new PropertiesFactoryBean();
+ pfb.setLocation(new ClassPathResource("/org/springframework/beans/factory/config/test.properties"));
+
+ Properties props1 = new Properties();
+ props1.setProperty("key2", "value2");
+ props1.setProperty("tb.array[0].age", "0");
+
+ Properties props2 = new Properties();
+ props2.setProperty("spring", "framework");
+ props2.setProperty("Don", "Mattingly");
+
+ Properties props3 = new Properties();
+ props3.setProperty("spider", "man");
+ props3.setProperty("bat", "man");
+
+ pfb.setPropertiesArray(new Properties[] {props1, props2, props3});
+ pfb.afterPropertiesSet();
+
+ Properties props = (Properties) pfb.getObject();
+ assertEquals("99", props.getProperty("tb.array[0].age"));
+ assertEquals("value2", props.getProperty("key2"));
+ assertEquals("framework", props.getProperty("spring"));
+ assertEquals("Mattingly", props.getProperty("Don"));
+ assertEquals("man", props.getProperty("spider"));
+ assertEquals("man", props.getProperty("bat"));
+ }
+
public void testWithPropertiesFileAndLocalPropertiesAndLocalOverride() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
|