commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1231749 - in /commons/proper/configuration/trunk/src: changes/ main/java/org/apache/commons/configuration/ test/java/org/apache/commons/configuration/
Date Sun, 15 Jan 2012 20:48:56 GMT
Author: oheger
Date: Sun Jan 15 20:48:56 2012
New Revision: 1231749

URL: http://svn.apache.org/viewvc?rev=1231749&view=rev
Log:
[CONFIGURATION-475] Deprecated ConfigurationKey.

Modified:
    commons/proper/configuration/trunk/src/changes/changes.xml
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationKey.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationKey.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java

Modified: commons/proper/configuration/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/changes/changes.xml?rev=1231749&r1=1231748&r2=1231749&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/changes/changes.xml (original)
+++ commons/proper/configuration/trunk/src/changes/changes.xml Sun Jan 15 20:48:56 2012
@@ -27,6 +27,9 @@
   <body>
     <release version="1.8" date="in SVN"
       description="TBD">
+      <action dev="oheger" type="update" issue="CONFIGURATION-475">
+        Class ConfigurationKey was deprecated in favour of DefaultConfigurationKey.
+      </action>
       <action dev="oheger" type="update" issue="CONFIGURATION-470">
         Classes generated by JavaCC are now created dynamically during the
         build process.

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationKey.java?rev=1231749&r1=1231748&r2=1231749&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationKey.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationKey.java
Sun Jan 15 20:48:56 2012
@@ -39,7 +39,11 @@ import java.util.NoSuchElementException;
  * href="http://commons.apache.org/configuration/team-list.html">Commons
  * Configuration team</a>
  * @version $Id$
+ * @deprecated Use {@link org.apache.commons.configuration.tree.DefaultConfigurationKey}
+ * instead. It is associated with a {@code DefaultExpressionEngine} and thus
+ * can produce correct keys even if key separators have been changed.
  */
+@Deprecated
 public class ConfigurationKey implements Serializable
 {
     /** Constant for a property delimiter.*/

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationKey.java?rev=1231749&r1=1231748&r2=1231749&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationKey.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationKey.java
Sun Jan 15 20:48:56 2012
@@ -31,6 +31,7 @@ import org.junit.Test;
  *
  * @version $Id$
  */
+@SuppressWarnings("deprecation")
 public class TestConfigurationKey
 {
     private static final String TESTPROPS = "tables.table(0).fields.field(1)";

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java?rev=1231749&r1=1231748&r2=1231749&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestHierarchicalConfiguration.java
Sun Jan 15 20:48:56 2012
@@ -38,6 +38,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.event.ConfigurationEvent;
 import org.apache.commons.configuration.event.ConfigurationListener;
 import org.apache.commons.configuration.tree.ConfigurationNode;
+import org.apache.commons.configuration.tree.DefaultConfigurationKey;
 import org.apache.commons.configuration.tree.DefaultConfigurationNode;
 import org.apache.commons.configuration.tree.DefaultExpressionEngine;
 import org.apache.commons.configuration.tree.ExpressionEngine;
@@ -444,13 +445,23 @@ public class TestHierarchicalConfigurati
         config.addProperty("connection.passwd", "tiger");
         assertEquals("tiger", config.getProperty("connection.passwd"));
 
-        ConfigurationKey key = new ConfigurationKey();
+        DefaultConfigurationKey key = createConfigurationKey();
         key.append("tables").append("table").appendIndex(0);
         key.appendAttribute("tableType");
         config.addProperty(key.toString(), "system");
         assertEquals("system", config.getProperty(key.toString()));
     }
 
+    /**
+     * Creates a {@code DefaultConfigurationKey} object.
+     *
+     * @return the new key object
+     */
+    private static DefaultConfigurationKey createConfigurationKey()
+    {
+        return new DefaultConfigurationKey(new DefaultExpressionEngine());
+    }
+
     @Test(expected = IllegalArgumentException.class)
     public void testAddPropertyInvalidKey()
     {
@@ -471,7 +482,9 @@ public class TestHierarchicalConfigurati
         int maxIdx = config.getMaxIndex("tables.table(0).fields.field.name");
         for(int i = 0; i <= maxIdx; i++)
         {
-            ConfigurationKey key = new ConfigurationKey("tables.table(0).fields");
+            DefaultConfigurationKey key =
+                    new DefaultConfigurationKey(new DefaultExpressionEngine(),
+                            "tables.table(0).fields");
             key.append("field").appendIndex(i).append("name");
             assertNotNull(config.getProperty(key.toString()));
         }
@@ -491,7 +504,7 @@ public class TestHierarchicalConfigurati
 
         for (int i = 0; i < fields[0].length; i++)
         {
-            ConfigurationKey key = new ConfigurationKey();
+            DefaultConfigurationKey key = createConfigurationKey();
             key.append("fields").append("field").appendIndex(i);
             key.append("name");
             assertEquals(fields[0][i], subset.getProperty(key.toString()));
@@ -809,6 +822,7 @@ public class TestHierarchicalConfigurati
     public void testNodeVisitorKeys()
     {
         CountVisitor v = new CountVisitor();
+        @SuppressWarnings("deprecation")
         ConfigurationKey configKey = new ConfigurationKey();
         config.getRoot().visit(v, configKey);
         for (Iterator<String> it = config.getKeys(); it.hasNext();)
@@ -1198,6 +1212,7 @@ public class TestHierarchicalConfigurati
      * A test visitor implementation for checking whether all visitor methods
      * are correctly called.
      */
+    @SuppressWarnings("deprecation")
     static class CountVisitor extends HierarchicalConfiguration.NodeVisitor
     {
         /** The number of invocations of visitBeforeChildren(). */



Mime
View raw message