commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1072377 - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/ test/java/org/apache/commons/configuration2/ test/resources/
Date Sat, 19 Feb 2011 16:31:00 GMT
Author: oheger
Date: Sat Feb 19 16:31:00 2011
New Revision: 1072377

URL: http://svn.apache.org/viewvc?rev=1072377&view=rev
Log:
[CONFIGURATION-389] Added support for ini files to DefaultConfigurationBuilder. Ported fix
to configuration2 branch.

Added:
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/test.ini
  (with props)
Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testDigesterConfiguration3.xml

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java?rev=1072377&r1=1072376&r2=1072377&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
Sat Feb 19 16:31:00 2011
@@ -389,10 +389,14 @@ public class DefaultConfigurationBuilder
     private static final ConfigurationProvider ENVIRONMENT_PROVIDER =
             new ConfigurationProvider(EnvironmentConfiguration.class);
 
-    /** Constant for the provider for environment variables. */
+    /** Constant for the provider for database configurations. */
     private static final ConfigurationProvider DATABASE_PROVIDER =
             new DatabaseConfigurationProvider();
 
+    /** Constant for the provider for ini files. */
+    private static final ConfigurationProvider INI_PROVIDER =
+            new FileConfigurationProvider(INIConfiguration.class);
+
     /** Constant for the provider for plist files. */
     private static final ConfigurationProvider PLIST_PROVIDER = new FileExtensionConfigurationProvider(
             "org.apache.commons.configuration2.plist.XMLPropertyListConfiguration",
@@ -404,12 +408,14 @@ public class DefaultConfigurationBuilder
 
     /** An array with the names of the default tags. */
     private static final String[] DEFAULT_TAGS =
-    {"properties", "xml", "hierarchicalXml", "jndi", "system", "environment", "plist", "configuration",
"database"};
+    {"properties", "xml", "hierarchicalXml", "jndi", "system", "environment",
+        "plist", "configuration", "database", "ini"};
 
     /** An array with the providers for the default tags. */
     private static final ConfigurationProvider[] DEFAULT_PROVIDERS =
     {PROPERTIES_PROVIDER, XML_PROVIDER, XML_PROVIDER, JNDI_PROVIDER,
-            SYSTEM_PROVIDER, ENVIRONMENT_PROVIDER, PLIST_PROVIDER, BUILDER_PROVIDER, DATABASE_PROVIDER};
+            SYSTEM_PROVIDER, ENVIRONMENT_PROVIDER, PLIST_PROVIDER, BUILDER_PROVIDER,
+            DATABASE_PROVIDER, INI_PROVIDER};
 
     /**
      * The serial version UID.

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java?rev=1072377&r1=1072376&r2=1072377&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDefaultConfigurationBuilder.java
Sat Feb 19 16:31:00 2011
@@ -633,6 +633,10 @@ public class TestDefaultConfigurationBui
 
         // test EnvironmentConfiguration
         assertNotNull("JAVA_HOME property not found", config.getProperty("JAVA_HOME"));
+
+        // test INIConfiguration
+        assertEquals("Property from ini file not found", "yes",
+                config.getString("testini.loaded"));
     }
 
     /**

Added: commons/proper/configuration/branches/configuration2_experimental/src/test/resources/test.ini
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/resources/test.ini?rev=1072377&view=auto
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/resources/test.ini
(added)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/resources/test.ini
Sat Feb 19 16:31:00 2011
@@ -0,0 +1,3 @@
+; Test ini file to be included by a configuration definition
+[testini]
+loaded=yes

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/test/resources/test.ini
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/configuration/branches/configuration2_experimental/src/test/resources/test.ini
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testDigesterConfiguration3.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testDigesterConfiguration3.xml?rev=1072377&r1=1072376&r2=1072377&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testDigesterConfiguration3.xml
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/resources/testDigesterConfiguration3.xml
Sat Feb 19 16:31:00 2011
@@ -9,5 +9,6 @@
     <hierarchicalXml fileName="testDigesterConfigurationInclude1.xml" at="tables"/>
     <properties fileName="testDigesterConfigurationInclude2.properties" at="mail"/>
     <jndi prefix=""/>
+    <ini fileName="test.ini"/>
   </additional>
 </configuration>



Mime
View raw message