commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r681798 - in /commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/DataConfiguration.java src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java xdocs/changes.xml
Date Fri, 01 Aug 2008 19:38:43 GMT
Author: oheger
Date: Fri Aug  1 12:38:42 2008
New Revision: 681798

URL: http://svn.apache.org/viewvc?rev=681798&view=rev
Log:
CONFIGURATION-332: DataConfiguration now collaborates better with PropertiesConfiguration.

Modified:
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DataConfiguration.java
    commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
    commons/proper/configuration/trunk/xdocs/changes.xml

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DataConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DataConfiguration.java?rev=681798&r1=681797&r2=681798&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DataConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DataConfiguration.java
Fri Aug  1 12:38:42 2008
@@ -140,6 +140,11 @@
         }
     }
 
+    public void addProperty(String key, Object value)
+    {
+        getConfiguration().addProperty(key, value);
+    }
+
     public boolean isEmpty()
     {
         return configuration.isEmpty();
@@ -155,6 +160,11 @@
         configuration.clearProperty(key);
     }
 
+    public void setProperty(String key, Object value)
+    {
+        configuration.setProperty(key, value);
+    }
+
     public Iterator getKeys()
     {
         return configuration.getKeys();

Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java?rev=681798&r1=681797&r2=681798&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
Fri Aug  1 12:38:42 2008
@@ -34,11 +34,11 @@
 import java.util.Iterator;
 import java.util.List;
 
+import junit.framework.TestCase;
+
 import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;
 import org.apache.commons.lang.SystemUtils;
 
-import junit.framework.TestCase;
-
 /**
  * Test for loading and saving properties files.
  *
@@ -799,6 +799,23 @@
     }
 
     /**
+     * Tests adding properties through a DataConfiguration. This is related to
+     * CONFIGURATION-332.
+     */
+    public void testSaveWithDataConfig() throws ConfigurationException
+    {
+        conf = new PropertiesConfiguration(testSavePropertiesFile);
+        DataConfiguration dataConfig = new DataConfiguration(conf);
+        dataConfig.setProperty("foo", "bar");
+        assertEquals("Property not set", "bar", conf.getString("foo"));
+
+        conf.save();
+        PropertiesConfiguration config2 = new PropertiesConfiguration(
+                testSavePropertiesFile);
+        assertEquals("Property not saved", "bar", config2.getString("foo"));
+    }
+
+    /**
      * Creates a configuration that can be used for testing copy operations.
      *
      * @return the configuration to be copied

Modified: commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=681798&r1=681797&r2=681798&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Fri Aug  1 12:38:42 2008
@@ -23,6 +23,11 @@
 
   <body>
     <release version="1.6" date="in SVN" description="">
+      <action dev="oheger" type="fix" issue="CONFIGURATION-332">
+        Properties written through a DataConfiguration to a wrapped
+        PropertiesConfiguration got lost when the PropertiesConfiguration was
+        saved. This has been fixed.
+      </action>
       <action dev="oheger" type="add" issue="CONFIGURATION-331">
         XMLBeanDeclaration now defines a factory method createBeanDeclaration()
         for creating the declarations for complex nested properties. This



Mime
View raw message