org.apache.commons.configuration
Class TestFileConfiguration

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.configuration.TestFileConfiguration
All Implemented Interfaces:
junit.framework.Test

public class TestFileConfiguration
extends junit.framework.TestCase

Version:
$Revision: 561230 $, $Date: 2007-07-31 05:17:09 +0100 (Tue, 31 Jul 2007) $
Author:
Emmanuel Bourg

Constructor Summary
TestFileConfiguration()
           
 
Method Summary
 void testClone()
          Tests cloning a file based configuration.
 void testCreateFile1()
           
 void testCreateFile2()
           
 void testCreateFile3()
           
 void testFileOverwrite()
          Tests if the URL used by the load() method is also used by save().
 void testGetFile()
          Tests the getFile() method.
 void testGetFileAfterLoad()
          Tests whether getFile() returns a valid file after a configuration has been loaded.
 void testInitFromClassPath()
          Tests whether the constructor behaves the same as setFileName() when the configuration source is in the classpath.
 void testLoadDirectory()
          Checks that loading a directory instead of a file throws an exception.
 void testLoadFromClassPath()
          Tests the loading of configuration file in a Combined configuration when the configuration source is in the classpath.
 void testLoadMultiple()
          Tests whether calling load() multiple times changes the source.
 void testLocations()
           
 void testLogErrorListener()
          Tests whether an error log listener was registered at the configuration.
 void testPathWithSpaces()
          Tests loading and saving a configuration file with a complicated path name including spaces.
 void testReloadError()
          Tests handling of errors in the reload() method.
 void testReloadingWithAutoSave()
          Tests setting a file changed reloading strategy together with the auto save feature.
 void testSaveInvalidURL()
          Tests if invalid URLs cause an exception.
 void testSaveWithoutFileName()
          Tests to invoke save() without explicitely setting a file name.
 void testSetURL()
           
 void testSetURLWithParams()
           
 void testWithConfigurationFactory()
          Tests collaboration with ConfigurationFactory: Is the base path set on loading is valid in file based configurations?
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestFileConfiguration

public TestFileConfiguration()
Method Detail

testSetURL

public void testSetURL()
                throws java.lang.Exception
Throws:
java.lang.Exception

testSetURLWithParams

public void testSetURLWithParams()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testLocations

public void testLocations()
                   throws java.lang.Exception
Throws:
java.lang.Exception

testCreateFile1

public void testCreateFile1()
                     throws java.lang.Exception
Throws:
java.lang.Exception

testCreateFile2

public void testCreateFile2()
                     throws java.lang.Exception
Throws:
java.lang.Exception

testCreateFile3

public void testCreateFile3()
                     throws java.lang.Exception
Throws:
java.lang.Exception

testWithConfigurationFactory

public void testWithConfigurationFactory()
                                  throws java.lang.Exception
Tests collaboration with ConfigurationFactory: Is the base path set on loading is valid in file based configurations?

Throws:
java.lang.Exception - if an error occurs

testSaveInvalidURL

public void testSaveInvalidURL()
                        throws java.lang.Exception
Tests if invalid URLs cause an exception.

Throws:
java.lang.Exception

testFileOverwrite

public void testFileOverwrite()
                       throws java.lang.Exception
Tests if the URL used by the load() method is also used by save().

Throws:
java.lang.Exception

testReloadingWithAutoSave

public void testReloadingWithAutoSave()
                               throws java.lang.Exception
Tests setting a file changed reloading strategy together with the auto save feature.

Throws:
java.lang.Exception

testPathWithSpaces

public void testPathWithSpaces()
                        throws java.lang.Exception
Tests loading and saving a configuration file with a complicated path name including spaces. (related to issue 35210)

Throws:
java.lang.Exception

testGetFile

public void testGetFile()
                 throws org.apache.commons.configuration.ConfigurationException
Tests the getFile() method.

Throws:
org.apache.commons.configuration.ConfigurationException

testGetFileAfterLoad

public void testGetFileAfterLoad()
                          throws org.apache.commons.configuration.ConfigurationException,
                                 java.io.IOException
Tests whether getFile() returns a valid file after a configuration has been loaded.

Throws:
org.apache.commons.configuration.ConfigurationException
java.io.IOException

testLoadMultiple

public void testLoadMultiple()
                      throws org.apache.commons.configuration.ConfigurationException
Tests whether calling load() multiple times changes the source. This should not be the case.

Throws:
org.apache.commons.configuration.ConfigurationException

testSaveWithoutFileName

public void testSaveWithoutFileName()
                             throws java.lang.Exception
Tests to invoke save() without explicitely setting a file name. This will cause an exception.

Throws:
java.lang.Exception

testLoadDirectory

public void testLoadDirectory()
Checks that loading a directory instead of a file throws an exception.


testInitFromClassPath

public void testInitFromClassPath()
                           throws org.apache.commons.configuration.ConfigurationException
Tests whether the constructor behaves the same as setFileName() when the configuration source is in the classpath.

Throws:
org.apache.commons.configuration.ConfigurationException

testLoadFromClassPath

public void testLoadFromClassPath()
                           throws org.apache.commons.configuration.ConfigurationException
Tests the loading of configuration file in a Combined configuration when the configuration source is in the classpath.

Throws:
org.apache.commons.configuration.ConfigurationException

testClone

public void testClone()
               throws org.apache.commons.configuration.ConfigurationException
Tests cloning a file based configuration.

Throws:
org.apache.commons.configuration.ConfigurationException

testLogErrorListener

public void testLogErrorListener()
Tests whether an error log listener was registered at the configuration.


testReloadError

public void testReloadError()
                     throws org.apache.commons.configuration.ConfigurationException
Tests handling of errors in the reload() method.

Throws:
org.apache.commons.configuration.ConfigurationException


Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.