org.apache.commons.configuration
Class TestDefaultConfigurationBuilder

java.lang.Object
  extended by org.apache.commons.configuration.TestDefaultConfigurationBuilder

public class TestDefaultConfigurationBuilder
extends Object

Test class for DefaultConfigurationBuilder.

Version:
$Id: TestDefaultConfigurationBuilder.java 1301997 2012-03-17 20:32:02Z sebb $
Author:
Commons Configuration team

Nested Class Summary
static class TestDefaultConfigurationBuilder.ExtendedCombinedConfiguration
          A specialized combined configuration implementation used for testing custom result classes.
static class TestDefaultConfigurationBuilder.ExtendedXMLConfiguration
           
static class TestDefaultConfigurationBuilder.TestLookup
           
 
Constructor Summary
TestDefaultConfigurationBuilder()
           
 
Method Summary
 void setUp()
           
 void testAddConfigurationProvider()
          Tests adding a new configuration provider.
 void testAddConfigurationProviderNull()
          Tries to register a null configuration provider.
 void testAddConfigurationProviderNullTag()
          Tries to register a configuration provider for a null tag.
 void testCombinedConfigurationAttributes()
          Tests whether attributes are correctly set on the combined configurations for the override and additional sections.
 void testCombinedConfigurationListNodes()
          Tests whether the list node definition was correctly processed.
 void testCombinedConfigurationNoAdditional()
          Tests the structure of the returned combined configuration if there is no additional section.
 void testCombinedConfigurationStructure()
          Tests if the returned combined configuration has the expected structure.
 void testComplexInitialization()
          Tests reading a configuration definition file that contains complex initialization of properties of the declared configuration sources.
 void testConfigurationBeanFactoryCreateBean()
          Tests creating a configuration object from a configuration declaration.
 void testConfigurationBeanFactoryCreateUnknownTag()
          Tests creating a configuration object from an unknown tag.
 void testConfigurationBuilderProvider()
          Tests whether a configuration builder can itself be declared in a configuration definition file.
 void testConfigurationBuilderProviderInheritProperties()
          Tests whether settings of the builder are propagated to child builders.
 void testConfigurationBuilderProviderOverrideProperties()
          Tests whether properties of the parent configuration can be overridden.
 void testConfigurationDeclarationGetAttributes()
          Tests access to certain reserved attributes of a ConfigurationDeclaration.
 void testConfigurationDeclarationIsReserved()
          Tests the isReservedNode() method of ConfigurationDeclaration.
 void testConfigurationDeclarationIsReservedAt()
          Tests if the at attribute is correctly detected as reserved attribute.
 void testConfigurationDeclarationIsReservedOptional()
          Tests if the optional attribute is correctly detected as reserved attribute.
 void testConfigurationDeclarationOptionalAttributeInvalid()
          Tests whether an invalid value of an optional attribute is detected.
 void testConfigurationProvider()
          Tests loading a configuration definition file that defines new providers.
 void testDelimiterParsingDisabled()
           
 void testExpression()
           
 void testExtendedClass()
          Tests loading a configuration definition file that defines a custom result class.
 void testExtendedXMLConfigurationProvider()
          Tests loading a configuration definition file that defines new providers.
 void testGlobalLookup()
           
 void testInterpolationOverMultipleSources()
          Tests whether variable substitution works across multiple child configurations.
 void testLoadAdditional()
          Tests loading a configuration definition file with an additional section.
 void testLoadConfiguration()
          Tests loading a simple configuration definition file.
 void testLoadConfigurationFromFile()
          Tests the file constructor.
 void testLoadConfigurationFromFileName()
          Tests the file name constructor.
 void testLoadConfigurationFromURL()
          Tests the URL constructor.
 void testLoadDifferentSources()
          Tests loading a definition file with multiple different sources.
 void testLoadOptional()
          Tests loading a definition file that contains optional configurations.
 void testLoadOptionalBuilderForceCreate()
          Tests loading an embedded optional configuration builder with the force create attribute.
 void testLoadOptionalChildBuilderSuppressErrorLog()
          Tests whether the error log message caused by an optional configuration can be suppressed if a child builder is involved.
 void testLoadOptionalErrorEvent()
          Tests whether loading a failing optional configuration causes an error event.
 void testLoadOptionalForceCreate()
          Tests an optional, non existing configuration with the forceCreate attribute.
 void testLoadOptionalForceCreateWithException()
          Tests loading an optional configuration with the force create attribute set.
 void testLoadOptionalNonFileBased()
          Tries to load a configuration file with an optional, non file-based configuration.
 void testLoadOptionalWithException()
          Tests loading a definition file with optional and non optional configuration sources.
 void testLoadXMLWithSettings()
          Tests whether XML settings can be inherited.
 void testLogErrorListener()
          Tests whether a default log error listener is registered at the builder instance.
 void testMerge()
           
 void testMultiTenantConfigurationAt()
           
 void testMultiTenentConfiguration()
           
 void testMultiTenentConfiguration2()
           
 void testMultiTenentConfiguration3()
           
 void testRemoveConfigurationProvider()
          Tests removing configuration providers.
 void testSetConfigurationBasePath()
          Tests if the base path is correctly evaluated.
 void testSystemProperties()
           
 void testValidation()
           
 void testValidation3()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestDefaultConfigurationBuilder

public TestDefaultConfigurationBuilder()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

testConfigurationDeclarationIsReserved

public void testConfigurationDeclarationIsReserved()
Tests the isReservedNode() method of ConfigurationDeclaration.


testConfigurationDeclarationIsReservedAt

public void testConfigurationDeclarationIsReservedAt()
Tests if the at attribute is correctly detected as reserved attribute.


testConfigurationDeclarationIsReservedOptional

public void testConfigurationDeclarationIsReservedOptional()
Tests if the optional attribute is correctly detected as reserved attribute.


testConfigurationDeclarationGetAttributes

public void testConfigurationDeclarationGetAttributes()
Tests access to certain reserved attributes of a ConfigurationDeclaration.


testConfigurationDeclarationOptionalAttributeInvalid

public void testConfigurationDeclarationOptionalAttributeInvalid()
Tests whether an invalid value of an optional attribute is detected.


testAddConfigurationProvider

public void testAddConfigurationProvider()
Tests adding a new configuration provider.


testAddConfigurationProviderNull

public void testAddConfigurationProviderNull()
Tries to register a null configuration provider. This should cause an exception.


testAddConfigurationProviderNullTag

public void testAddConfigurationProviderNullTag()
Tries to register a configuration provider for a null tag. This should cause an exception to be thrown.


testRemoveConfigurationProvider

public void testRemoveConfigurationProvider()
Tests removing configuration providers.


testConfigurationBeanFactoryCreateBean

public void testConfigurationBeanFactoryCreateBean()
Tests creating a configuration object from a configuration declaration.


testConfigurationBeanFactoryCreateUnknownTag

public void testConfigurationBeanFactoryCreateUnknownTag()
Tests creating a configuration object from an unknown tag. This should cause an exception.


testLoadConfiguration

public void testLoadConfiguration()
                           throws ConfigurationException
Tests loading a simple configuration definition file.

Throws:
ConfigurationException

testLoadConfigurationFromFile

public void testLoadConfigurationFromFile()
                                   throws ConfigurationException
Tests the file constructor.

Throws:
ConfigurationException

testLoadConfigurationFromFileName

public void testLoadConfigurationFromFileName()
                                       throws ConfigurationException
Tests the file name constructor.

Throws:
ConfigurationException

testLoadConfigurationFromURL

public void testLoadConfigurationFromURL()
                                  throws Exception
Tests the URL constructor.

Throws:
Exception

testLoadAdditional

public void testLoadAdditional()
                        throws ConfigurationException
Tests loading a configuration definition file with an additional section.

Throws:
ConfigurationException

testLogErrorListener

public void testLogErrorListener()
Tests whether a default log error listener is registered at the builder instance.


testLoadOptional

public void testLoadOptional()
                      throws Exception
Tests loading a definition file that contains optional configurations.

Throws:
Exception

testLoadOptionalErrorEvent

public void testLoadOptionalErrorEvent()
                                throws Exception
Tests whether loading a failing optional configuration causes an error event.

Throws:
Exception

testLoadOptionalWithException

public void testLoadOptionalWithException()
                                   throws ConfigurationException
Tests loading a definition file with optional and non optional configuration sources. One non optional does not exist, so this should cause an exception.

Throws:
ConfigurationException

testLoadOptionalNonFileBased

public void testLoadOptionalNonFileBased()
                                  throws ConfigurationException
Tries to load a configuration file with an optional, non file-based configuration. The optional attribute should work for other configuration classes, too.

Throws:
ConfigurationException

testLoadOptionalForceCreate

public void testLoadOptionalForceCreate()
                                 throws ConfigurationException
Tests an optional, non existing configuration with the forceCreate attribute. This configuration should be added to the resulting configuration.

Throws:
ConfigurationException

testLoadOptionalBuilderForceCreate

public void testLoadOptionalBuilderForceCreate()
                                        throws ConfigurationException
Tests loading an embedded optional configuration builder with the force create attribute.

Throws:
ConfigurationException

testLoadOptionalForceCreateWithException

public void testLoadOptionalForceCreateWithException()
                                              throws ConfigurationException
Tests loading an optional configuration with the force create attribute set. The provider will always throw an exception. In this case the configuration will not be added to the resulting combined configuration.

Throws:
ConfigurationException

testLoadOptionalChildBuilderSuppressErrorLog

public void testLoadOptionalChildBuilderSuppressErrorLog()
                                                  throws ConfigurationException
Tests whether the error log message caused by an optional configuration can be suppressed if a child builder is involved.

Throws:
ConfigurationException

testLoadDifferentSources

public void testLoadDifferentSources()
                              throws ConfigurationException
Tests loading a definition file with multiple different sources.

Throws:
ConfigurationException

testSetConfigurationBasePath

public void testSetConfigurationBasePath()
                                  throws ConfigurationException
Tests if the base path is correctly evaluated.

Throws:
ConfigurationException

testComplexInitialization

public void testComplexInitialization()
                               throws ConfigurationException
Tests reading a configuration definition file that contains complex initialization of properties of the declared configuration sources.

Throws:
ConfigurationException

testCombinedConfigurationStructure

public void testCombinedConfigurationStructure()
                                        throws ConfigurationException
Tests if the returned combined configuration has the expected structure.

Throws:
ConfigurationException

testCombinedConfigurationAttributes

public void testCombinedConfigurationAttributes()
                                         throws ConfigurationException
Tests whether attributes are correctly set on the combined configurations for the override and additional sections.

Throws:
ConfigurationException

testCombinedConfigurationNoAdditional

public void testCombinedConfigurationNoAdditional()
                                           throws ConfigurationException
Tests the structure of the returned combined configuration if there is no additional section.

Throws:
ConfigurationException

testCombinedConfigurationListNodes

public void testCombinedConfigurationListNodes()
                                        throws ConfigurationException
Tests whether the list node definition was correctly processed.

Throws:
ConfigurationException

testConfigurationBuilderProvider

public void testConfigurationBuilderProvider()
                                      throws ConfigurationException
Tests whether a configuration builder can itself be declared in a configuration definition file.

Throws:
ConfigurationException

testConfigurationBuilderProviderInheritProperties

public void testConfigurationBuilderProviderInheritProperties()
                                                       throws Exception
Tests whether settings of the builder are propagated to child builders.

Throws:
Exception

testConfigurationBuilderProviderOverrideProperties

public void testConfigurationBuilderProviderOverrideProperties()
                                                        throws Exception
Tests whether properties of the parent configuration can be overridden.

Throws:
Exception

testLoadXMLWithSettings

public void testLoadXMLWithSettings()
                             throws Exception
Tests whether XML settings can be inherited.

Throws:
Exception

testExtendedClass

public void testExtendedClass()
                       throws ConfigurationException
Tests loading a configuration definition file that defines a custom result class.

Throws:
ConfigurationException

testConfigurationProvider

public void testConfigurationProvider()
                               throws ConfigurationException
Tests loading a configuration definition file that defines new providers.

Throws:
ConfigurationException

testExtendedXMLConfigurationProvider

public void testExtendedXMLConfigurationProvider()
                                          throws ConfigurationException
Tests loading a configuration definition file that defines new providers.

Throws:
ConfigurationException

testGlobalLookup

public void testGlobalLookup()
                      throws Exception
Throws:
Exception

testSystemProperties

public void testSystemProperties()
                          throws Exception
Throws:
Exception

testValidation

public void testValidation()
                    throws Exception
Throws:
Exception

testValidation3

public void testValidation3()
                     throws Exception
Throws:
Exception

testMultiTenentConfiguration

public void testMultiTenentConfiguration()
                                  throws Exception
Throws:
Exception

testMultiTenentConfiguration2

public void testMultiTenentConfiguration2()
                                   throws Exception
Throws:
Exception

testMultiTenentConfiguration3

public void testMultiTenentConfiguration3()
                                   throws Exception
Throws:
Exception

testMultiTenantConfigurationAt

public void testMultiTenantConfigurationAt()
                                    throws Exception
Throws:
Exception

testMerge

public void testMerge()
               throws Exception
Throws:
Exception

testDelimiterParsingDisabled

public void testDelimiterParsingDisabled()
                                  throws Exception
Throws:
Exception

testExpression

public void testExpression()
                    throws Exception
Throws:
Exception

testInterpolationOverMultipleSources

public void testInterpolationOverMultipleSources()
                                          throws ConfigurationException
Tests whether variable substitution works across multiple child configurations. This test is related to CONFIGURATION-481.

Throws:
ConfigurationException


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