commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r629186 - in /commons/proper/configuration/branches/configuration2_experimental/src: test-cactus/org/apache/commons/configuration/ test/java/org/apache/commons/configuration2/
Date Tue, 19 Feb 2008 18:43:14 GMT
Author: ebourg
Date: Tue Feb 19 10:43:13 2008
New Revision: 629186

URL: http://svn.apache.org/viewvc?rev=629186&view=rev
Log:
Replaced ConfigurationFactory with ConfigurationBuilder in the test cases

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestEqualBehaviour.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesSequence.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestSubsetConfiguration.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java?rev=629186&r1=629185&r2=629186&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test-cactus/org/apache/commons/configuration/TestConfigurationFactoryWithJNDI.java
Tue Feb 19 10:43:13 2008
@@ -25,7 +25,7 @@
 import org.apache.commons.collections.IteratorUtils;
 import org.apache.commons.configuration2.CompositeConfiguration;
 import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.ConfigurationFactory;
+import org.apache.commons.configuration2.DefaultConfigurationBuilder;
 import org.apache.commons.configuration2.JNDIConfiguration;
 import org.apache.commons.configuration2.PropertiesConfiguration;
 
@@ -35,9 +35,9 @@
 
     public void testLoadingWithDigester() throws Exception
     {
-        ConfigurationFactory cf = new ConfigurationFactory();
-        cf.setConfigurationFileName(testDigesterFile.toString());
-        CompositeConfiguration compositeConfiguration = (CompositeConfiguration) cf.getConfiguration();
+        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+        builder.setFileName(testDigesterFile.toString());
+        CompositeConfiguration compositeConfiguration = (CompositeConfiguration) builder.getConfiguration();
 
         assertEquals("Verify how many configs", 4, compositeConfiguration.getNumberOfConfigurations());
 
@@ -61,10 +61,10 @@
      */
     public void testGetKeys() throws Exception
     {
-        ConfigurationFactory cf = new ConfigurationFactory();
-        cf.setConfigurationFileName(testDigesterFile.toString());
+        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+        builder.setFileName(testDigesterFile.toString());
 
-        Configuration c = cf.getConfiguration();
+        Configuration c = builder.getConfiguration();
 
         List iteratedList = IteratorUtils.toList(c.getKeys());
         assertTrue(iteratedList.contains("test.jndi"));
@@ -78,10 +78,10 @@
     public void testGetKeysWithString() throws Exception
     {
         String KEY = "test";
-        ConfigurationFactory cf = new ConfigurationFactory();
-        cf.setConfigurationFileName(testDigesterFile.toString());
+        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+        builder.setFileName(testDigesterFile.toString());
 
-        Configuration c = cf.getConfiguration();
+        Configuration c = builder.getConfiguration();
 
         List iteratedList = IteratorUtils.toList(c.getKeys(KEY));
 
@@ -103,10 +103,10 @@
     public void testGetKeysWithString2() throws Exception
     {
         String KEY = "test.deep";
-        ConfigurationFactory cf = new ConfigurationFactory();
-        cf.setConfigurationFileName(testDigesterFile.toString());
+        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+        builder.setFileName(testDigesterFile.toString());
 
-        Configuration c = cf.getConfiguration();
+        Configuration c = builder.getConfiguration();
 
         List iteratedList = IteratorUtils.toList(c.getKeys(KEY));
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestEqualBehaviour.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestEqualBehaviour.java?rev=629186&r1=629185&r2=629186&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestEqualBehaviour.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestEqualBehaviour.java
Tue Feb 19 10:43:13 2008
@@ -20,10 +20,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.ConfigurationFactory;
-import org.apache.commons.configuration2.PropertiesConfiguration;
-
 import junit.framework.TestCase;
 
 /**
@@ -34,21 +30,18 @@
  */
 public class TestEqualBehaviour  extends TestCase
 {
-    private Configuration setupSimpleConfiguration()
-            throws Exception
+    private Configuration setupSimpleConfiguration() throws Exception
     {
         String simpleConfigurationFile = ConfigurationAssert.getTestFile("testEqual.properties").getAbsolutePath();
         return new PropertiesConfiguration(simpleConfigurationFile);
     }
 
-    private Configuration setupCompositeConfiguration()
-            throws Exception
+    private Configuration setupCompositeConfiguration() throws Exception
     {
         String compositeConfigurationFile = ConfigurationAssert.getTestFile("testEqualDigester.xml").getAbsolutePath();
 
-        ConfigurationFactory configurationFactory = new ConfigurationFactory();
-        configurationFactory.setConfigurationFileName(compositeConfigurationFile);
-        return configurationFactory.getConfiguration();
+        ConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder(compositeConfigurationFile);
+        return configurationBuilder.getConfiguration();
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java?rev=629186&r1=629185&r2=629186&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestFileConfiguration.java
Tue Feb 19 10:43:13 2008
@@ -17,25 +17,15 @@
 
 package org.apache.commons.configuration2;
 
-import java.net.URL;
-import java.util.Properties;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.net.URL;
+import java.util.Properties;
 
-import org.apache.commons.configuration2.AbstractFileConfiguration;
-import org.apache.commons.configuration2.CombinedConfiguration;
-import org.apache.commons.configuration2.CompositeConfiguration;
-import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.ConfigurationException;
-import org.apache.commons.configuration2.ConfigurationFactory;
-import org.apache.commons.configuration2.DefaultConfigurationBuilder;
-import org.apache.commons.configuration2.FileConfiguration;
-import org.apache.commons.configuration2.PropertiesConfiguration;
-import org.apache.commons.configuration2.StrictConfigurationComparator;
 import org.apache.commons.configuration2.reloading.FileAlwaysReloadingStrategy;
 import org.apache.commons.configuration2.reloading.FileChangedReloadingStrategy;
 
@@ -173,9 +163,9 @@
 
         try
         {
-            ConfigurationFactory factory = new ConfigurationFactory();
-            factory.setConfigurationURL(ConfigurationAssert.getTestFile("testDigesterConfiguration2.xml").toURL());
-            CompositeConfiguration cc = (CompositeConfiguration) factory.getConfiguration();
+            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+            builder.setURL(ConfigurationAssert.getTestFile("testDigesterConfiguration2.xml").toURL());
+            CombinedConfiguration cc = (CombinedConfiguration) builder.getConfiguration();
             PropertiesConfiguration config = null;
             for (int i = 0; config == null; i++)
             {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java?rev=629186&r1=629185&r2=629186&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java
Tue Feb 19 10:43:13 2008
@@ -141,7 +141,7 @@
     {
         // add an array of strings to the configuration
         conf.addProperty("string", "value1");
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         for (int i = 1; i < 5; i++)
         {
             list.add("value" + i);
@@ -178,7 +178,7 @@
         PropertiesConfiguration pc = new PropertiesConfiguration();
         // add an array of strings to the configuration
         pc.addProperty("string", "value1");
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
         for (int i = 1; i < 5; i++)
         {
             list.add("value" + i);
@@ -565,8 +565,8 @@
      */
     public void testIncludeInSubDir() throws ConfigurationException
     {
-        ConfigurationFactory factory = new ConfigurationFactory("conf/testFactoryPropertiesInclude.xml");
-        Configuration config = factory.getConfiguration();
+        ConfigurationBuilder builder = new DefaultConfigurationBuilder("testFactoryPropertiesInclude.xml");
+        Configuration config = builder.getConfiguration();
         assertEquals(true, config.getBoolean("deeptest"));
         assertEquals(true, config.getBoolean("deepinclude"));
         assertFalse(config.containsKey("deeptestinvalid"));

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesSequence.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesSequence.java?rev=629186&r1=629185&r2=629186&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesSequence.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestPropertiesSequence.java
Tue Feb 19 10:43:13 2008
@@ -21,14 +21,10 @@
 import java.util.Iterator;
 import java.util.List;
 
-import junit.framework.TestCase;
-
-import org.apache.commons.configuration2.BaseConfiguration;
-import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.ConfigurationFactory;
-import org.apache.commons.configuration2.PropertiesConfiguration;
 import org.apache.commons.lang.StringUtils;
 
+import junit.framework.TestCase;
+
 /**
  * Test that the configuration factory returns keys in the same
  * sequence as the properties configurator
@@ -45,9 +41,9 @@
 
         Configuration simpleConfiguration = new PropertiesConfiguration(simpleConfigurationFile);
 
-        ConfigurationFactory configurationFactory = new ConfigurationFactory();
-        configurationFactory.setConfigurationFileName(compositeConfigurationFile);
-        Configuration compositeConfiguration = configurationFactory.getConfiguration();
+        DefaultConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder();
+        configurationBuilder.setFileName(compositeConfigurationFile);
+        Configuration compositeConfiguration = configurationBuilder.getConfiguration();
 
         Configuration a = simpleConfiguration.subset("prefix");
         Configuration b = compositeConfiguration.subset("prefix");
@@ -71,9 +67,9 @@
 
         Configuration simpleConfiguration = new PropertiesConfiguration(simpleConfigurationFile);
 
-        ConfigurationFactory configurationFactory = new ConfigurationFactory();
-        configurationFactory.setConfigurationFileName(compositeConfigurationFile);
-        Configuration compositeConfiguration = configurationFactory.getConfiguration();
+        DefaultConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder();
+        configurationBuilder.setFileName(compositeConfigurationFile);
+        Configuration compositeConfiguration = configurationBuilder.getConfiguration();
 
         simpleConfiguration.setProperty("prefix.Co.test", Boolean.TRUE);
         simpleConfiguration.setProperty("prefix.Av.test", Boolean.TRUE);
@@ -103,9 +99,9 @@
 
         Configuration simpleConfiguration = new PropertiesConfiguration(simpleConfigurationFile);
 
-        ConfigurationFactory configurationFactory = new ConfigurationFactory();
-        configurationFactory.setConfigurationFileName(compositeConfigurationFile);
-        Configuration compositeConfiguration = configurationFactory.getConfiguration();
+        DefaultConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder();
+        configurationBuilder.setFileName(compositeConfigurationFile);
+        Configuration compositeConfiguration = configurationBuilder.getConfiguration();
 
         Configuration mapping = new BaseConfiguration();
         Configuration mapping2 = new BaseConfiguration();

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestSubsetConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestSubsetConfiguration.java?rev=629186&r1=629185&r2=629186&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestSubsetConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestSubsetConfiguration.java
Tue Feb 19 10:43:13 2008
@@ -25,12 +25,6 @@
 import java.util.NoSuchElementException;
 import java.util.Set;
 
-import org.apache.commons.configuration2.AbstractConfiguration;
-import org.apache.commons.configuration2.BaseConfiguration;
-import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.ConfigurationFactory;
-import org.apache.commons.configuration2.SubsetConfiguration;
-
 import junit.framework.TestCase;
 
 /**
@@ -199,10 +193,10 @@
 
     public void testNested() throws Exception
     {
-        ConfigurationFactory factory = new ConfigurationFactory();
+        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
         File src = new File(new File(TEST_DIR), TEST_FILE);
-        factory.setConfigurationURL(src.toURI().toURL());
-        Configuration config = factory.getConfiguration();
+        builder.setURL(src.toURI().toURL());
+        Configuration config = builder.getConfiguration();
         Configuration subConf = config.subset("tables.table(0)");
         assertTrue(subConf.getKeys().hasNext());
         Configuration subSubConf = subConf.subset("fields.field(1)");



Mime
View raw message