commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1625137 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration2/ConfigurationConverter.java test/java/org/apache/commons/configuration2/TestConfigurationConverter.java
Date Mon, 15 Sep 2014 19:57:33 GMT
Author: oheger
Date: Mon Sep 15 19:57:33 2014
New Revision: 1625137

URL: http://svn.apache.org/r1625137
Log:
[CONFIGURATION-591] Removed conversion methods related to ExtendedProperties.

ExtendedProperties is no longer supported by recent versions of Commons
Collections. Therefore, the corresponding conversion methods have been
removed.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/ConfigurationConverter.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/TestConfigurationConverter.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/ConfigurationConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/ConfigurationConverter.java?rev=1625137&r1=1625136&r2=1625137&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/ConfigurationConverter.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/ConfigurationConverter.java
Mon Sep 15 19:57:33 2014
@@ -17,13 +17,11 @@
 
 package org.apache.commons.configuration2;
 
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.commons.collections.ExtendedProperties;
 import org.apache.commons.configuration2.convert.ListDelimiterHandler;
 import org.apache.commons.lang3.StringUtils;
 
@@ -48,17 +46,6 @@ public final class ConfigurationConverte
     }
 
     /**
-     * Convert a ExtendedProperties class into a Configuration class.
-     *
-     * @param eprops ExtendedProperties object to convert
-     * @return Configuration created from the ExtendedProperties
-     */
-    public static Configuration getConfiguration(ExtendedProperties eprops)
-    {
-        return new MapConfiguration(eprops);
-    }
-
-    /**
      * Convert a standard Properties class into a configuration class.
      *
      * @param props properties object to convert
@@ -70,33 +57,6 @@ public final class ConfigurationConverte
     }
 
     /**
-     * Convert a Configuration class into a ExtendedProperties class.
-     *
-     * @param config Configuration object to convert
-     * @return ExtendedProperties created from the Configuration
-     */
-    public static ExtendedProperties getExtendedProperties(Configuration config)
-    {
-        ExtendedProperties props = new ExtendedProperties();
-
-        for (Iterator<String> keys = config.getKeys(); keys.hasNext();)
-        {
-            String key = keys.next();
-            Object property = config.getProperty(key);
-
-            // turn lists into vectors
-            if (property instanceof List)
-            {
-                property = new ArrayList<Object>((List<?>) property);
-            }
-
-            props.setProperty(key, property);
-        }
-
-        return props;
-    }
-
-    /**
      * Convert a Configuration class into a Properties class. List properties
      * are joined into a string using either the list delimiter handler of the
      * configuration (if it extends AbstractConfiguration) or with a comma as

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/TestConfigurationConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/TestConfigurationConverter.java?rev=1625137&r1=1625136&r2=1625137&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/TestConfigurationConverter.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/TestConfigurationConverter.java
Mon Sep 15 19:57:33 2014
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.commons.collections.ExtendedProperties;
 import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
@@ -40,24 +39,6 @@ import org.junit.Test;
 public class TestConfigurationConverter
 {
     @Test
-    public void testExtendedPropertiesToConfiguration()
-    {
-        ExtendedProperties eprops = new ExtendedProperties();
-        eprops.setProperty("string", "teststring");
-        eprops.setProperty("int", "123");
-        eprops.addProperty("list", "item 1");
-        eprops.addProperty("list", "item 2");
-
-        Configuration config = ConfigurationConverter.getConfiguration(eprops);
-
-        assertEquals("This returns 'teststring'", "teststring", config.getString("string"));
-        List<Object> item1 = config.getList("list");
-        assertEquals("This returns 'item 1'", "item 1", item1.get(0));
-
-        assertEquals("This returns 123", 123, config.getInt("int"));
-    }
-
-    @Test
     public void testPropertiesToConfiguration()
     {
         Properties props = new Properties();
@@ -76,23 +57,6 @@ public class TestConfigurationConverter
         assertEquals("This returns 123", 123, config.getInt("int"));
     }
 
-    @Test
-    public void testConfigurationToExtendedProperties()
-    {
-        Configuration config = new BaseConfiguration();
-        config.setProperty("string", "teststring");
-        config.setProperty("int", "123");
-        config.addProperty("list", "item 1");
-        config.addProperty("list", "item 2");
-
-        ExtendedProperties eprops = ConfigurationConverter.getExtendedProperties(config);
-
-        assertEquals("This returns 'teststring'", "teststring", eprops.getString("string"));
-        List<?> list = eprops.getVector("list");
-        assertEquals("This returns 'item 1'", "item 1", list.get(0));
-        assertEquals("This returns 123", 123, eprops.getInt("int"));
-    }
-
     /**
      * Creates a configuration object with some test values.
      * @return the test configuration



Mime
View raw message