commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe...@apache.org
Subject svn commit: r751926 - in /commons/proper/configuration/trunk: ./ src/java/org/apache/commons/configuration/ src/java/org/apache/commons/configuration/interpol/ src/test/org/apache/commons/configuration/
Date Tue, 10 Mar 2009 00:55:41 GMT
Author: joehni
Date: Tue Mar 10 00:55:40 2009
New Revision: 751926

URL: http://svn.apache.org/viewvc?rev=751926&view=rev
Log:
Merge changes for CONFIGURATION-369 from experimental branch into trunk.

Modified:
    commons/proper/configuration/trunk/   (props changed)
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/   (props
changed)
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/interpol/ConfigurationInterpolator.java
    commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/   (props
changed)
    commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestSubsetConfiguration.java

Propchange: commons/proper/configuration/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Mar 10 00:55:40 2009
@@ -2,7 +2,7 @@
 *.iws
 *.ipr
 *.iml
-.nbattrs
+.*
 docs
 target
 test-reports
@@ -10,8 +10,7 @@
 maven.log
 STRING0
 lib
-.classpath
-.project
 *.ser
 junit*.properties
 *.patch
+maven-eclipse.xml

Propchange: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Mar 10 00:55:40 2009
@@ -0,0 +1 @@
+/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2:751544-751840

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java?rev=751926&r1=751925&r2=751926&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/SubsetConfiguration.java
Tue Mar 10 00:55:40 2009
@@ -120,7 +120,7 @@
     }
 
     /**
-     * Return the parent configuation for this subset.
+     * Return the parent configuration for this subset.
      *
      * @return the parent configuration
      */
@@ -205,7 +205,7 @@
             }
         });
     }
-
+    
     protected Object interpolate(Object base)
     {
         if (delimiter == null && "".equals(prefix))
@@ -215,6 +215,7 @@
         else
         {
             SubsetConfiguration config = new SubsetConfiguration(parent, "");
+            getInterpolator().registerLocalLookups(config.getInterpolator());
             return config.interpolate(base);
         }
     }

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/interpol/ConfigurationInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/interpol/ConfigurationInterpolator.java?rev=751926&r1=751925&r2=751926&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/interpol/ConfigurationInterpolator.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/interpol/ConfigurationInterpolator.java
Tue Mar 10 00:55:40 2009
@@ -322,6 +322,16 @@
         }
         return lookup;
     }
+    
+    /**
+     * Registers the local lookup instances for the given interpolator.
+     * 
+     * @param interpolator the instance receiving the local lookups
+     * @since upcoming
+     */
+    public void registerLocalLookups(ConfigurationInterpolator interpolator) {
+        interpolator.localLookups.putAll(localLookups);
+    }
 
     // static initializer, sets up the map with the standard lookups
     static

Propchange: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Mar 10 00:55:40 2009
@@ -0,0 +1 @@
+/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2:751544-751840

Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestSubsetConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestSubsetConfiguration.java?rev=751926&r1=751925&r2=751926&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestSubsetConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestSubsetConfiguration.java
Tue Mar 10 00:55:40 2009
@@ -25,6 +25,8 @@
 import java.util.NoSuchElementException;
 import java.util.Set;
 
+import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
+import org.apache.commons.lang.text.StrLookup;
 import junit.framework.TestCase;
 
 /**
@@ -158,7 +160,7 @@
         assertEquals("prefix", "prefix", subset.getPrefix());
     }
 
-    public void testThrowtExceptionOnMissing()
+    public void testThrowExceptionOnMissing()
     {
         BaseConfiguration config = new BaseConfiguration();
         config.setThrowExceptionOnMissing(true);
@@ -281,4 +283,32 @@
         assertFalse("Wrong value of list parsing flag in parent", config
                 .isDelimiterParsingDisabled());
     }
+
+    /**
+     * Tests manipulating the interpolator.
+     */
+    public void testInterpolator()
+    {
+        BaseConfiguration config = new BaseConfiguration();
+        AbstractConfiguration subset = (AbstractConfiguration) config
+                .subset("prefix");
+        InterpolationTestHelper.testGetInterpolator(subset);
+    }
+    
+    // TODO: Next step
+    public void todoTestLocalLookupsInInterpolorAreInherited() {
+        BaseConfiguration config = new BaseConfiguration();
+        ConfigurationInterpolator interpolator = config.getInterpolator();
+        interpolator.registerLookup("brackets", new StrLookup(){
+
+            public String lookup(String key) {
+                return "(" + key +")";
+            }
+            
+        });
+        config.setProperty("prefix.var", "${brackets:x}");
+        AbstractConfiguration subset = (AbstractConfiguration) config
+                .subset("prefix");
+        assertEquals("Local lookup was not inherited", "(x)", subset.getString("var", ""));
+    }
 }



Mime
View raw message