commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r468694 - in /jakarta/commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/CompositeConfiguration.java src/test/org/apache/commons/configuration/TestCompositeConfiguration.java xdocs/changes.xml
Date Sat, 28 Oct 2006 15:11:03 GMT
Author: oheger
Date: Sat Oct 28 08:11:02 2006
New Revision: 468694

URL: http://svn.apache.org/viewvc?view=rev&rev=468694
Log:
Updated CompositeConfiguration.getList() to fully support interpolation; fix for CONFIGURATION-233;
thanks to Rainer Jung for the patch

Modified:
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CompositeConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
    jakarta/commons/proper/configuration/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CompositeConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CompositeConfiguration.java?view=diff&rev=468694&r1=468693&r2=468694
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CompositeConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CompositeConfiguration.java
Sat Oct 28 08:11:02 2006
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.ListIterator;
 
 /**
  * This Configuration class allows you to add multiple different types of Configuration
@@ -319,6 +320,12 @@
         if (list.isEmpty())
         {
             return defaultValue;
+        }
+        
+        ListIterator lit = list.listIterator();
+        while (lit.hasNext())
+        {
+        	lit.set(interpolate(lit.next()));
         }
 
         return list;

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java?view=diff&rev=468694&r1=468693&r2=468694
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
(original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
Sat Oct 28 08:11:02 2006
@@ -440,6 +440,24 @@
         assertEquals("2nd element", "foo.bar2", array[1]);
         assertEquals("3rd element", "foo.bar3", array[2]);
     }
+    
+    /**
+     * Tests whether global interpolation works with lists.
+     */
+    public void testListInterpolation()
+    {
+        PropertiesConfiguration c1 = new PropertiesConfiguration();
+        c1.addProperty("c1.value", "test1");
+        c1.addProperty("c1.value", "${c2.value}");
+        cc.addConfiguration(c1);
+        PropertiesConfiguration c2 = new PropertiesConfiguration();
+        c2.addProperty("c2.value", "test2");
+        cc.addConfiguration(c2);
+        List lst = cc.getList("c1.value");
+        assertEquals("Wrong list size", 2, lst.size());
+        assertEquals("Wrong first element", "test1", lst.get(0));
+        assertEquals("Wrong second element", "test2", lst.get(1));
+    }
 
     public void testInstanciateWithCollection()
     {

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?view=diff&rev=468694&r1=468693&r2=468694
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Sat Oct 28 08:11:02 2006
@@ -23,6 +23,11 @@
 
   <body>
     <release version="1.4-dev" date="in SVN">
+      <action dev="oheger" type="update" issue="CONFIGURATION-233" due-to="Rainer Jung">
+        The getList() method of CompositeConfiguration does now fully support
+        variable interpolation. So it is possible to refer to a variable in
+        one (sub) configuration that is defined in another configuration.
+      </action>
       <action dev="oheger" type="update" issue="CONFIGURATION-230">
         XPathExpressionEngine used to create wrong keys for attribute nodes.
         This caused some operations on XMLConfiguration to fail when such an



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message