org.apache.commons.configuration
Class TestCompositeConfiguration

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

public class TestCompositeConfiguration
extends Object

Test loading multiple configurations.

Version:
$Id: TestCompositeConfiguration.java 1233058 2012-01-18 20:49:12Z oheger $

Field Summary
protected  CompositeConfiguration cc
           
protected  PropertiesConfiguration conf1
           
protected  PropertiesConfiguration conf2
           
protected  XMLConfiguration xmlConf
           
 
Constructor Summary
TestCompositeConfiguration()
           
 
Method Summary
 void setUp()
           
 void testAddingProperty()
          Tests adding values.
 void testAddRemoveConfigurations()
           
 void testCantRemoveMemoryConfig()
           
 void testCheckingInMemoryConfiguration()
           
 void testClearingProperty()
          Tests setting values.
 void testClone()
           
 void testCloneEventListener()
          Ensures that event listeners are not cloned.
 void testCloneNotSupported()
          Tests cloning if one of the contained configurations does not support this operation.
 void testDefaultValueWhenKeyMissing()
          Tests getting a default when the key doesn't exist
 void testEventAddProperty()
          Tests whether add property events are triggered.
 void testEventClearProperty()
          Tests whether clear property events are triggered.
 void testEventSetProperty()
          Tests whether set property events are triggered.
 void testGetKeys2PreservesOrder()
          Tests getKeys(String key) preserves the order
 void testGetKeysPreservesOrder()
          Tests getKeys preserves the order
 void testGetList()
           
 void testGetListWithInterpolation()
          Tests querying a list when a tricky interpolation is involved.
 void testGetProperty()
           
 void testGetPropertyMissing()
           
 void testGetPropertyWIncludes()
           
 void testGetSourceInMemory()
          Tests the getSource() method for a property contained in the in memory configuration.
 void testGetSourceMultiple()
          Tests the getSource() method if the property is defined by multiple child configurations.
 void testGetSourceNull()
          Tests the getSource() method for a null key.
 void testGetSourceSingle()
          Tests the getSource() method if the property is defined in a single child configuration.
 void testGetSourceUnknown()
          Tests the getSource() method for an unknown property key.
 void testGetStringArrayWithInterpolation()
          Tests querying a string array when a tricky interpolation is involved.
 void testGetStringWithDefaults()
           
 void testGettingConfiguration()
           
 void testGettingSubset()
          Tests retrieving subsets of configurations
 void testInstanciateWithCollection()
           
 void testInterpolationInMultipleConfigs()
          Tests whether interpolation works if multiple configurations are involved.
 void testInterpolationWithReload()
          Tests interpolation in combination with reloading.
 void testList()
          Tests List parsing.
 void testListInterpolation()
          Tests whether global interpolation works with lists.
 void testMultipleTypesOfConfigs()
          Tests List parsing.
 void testPropertyExistsInOnlyOneConfig()
           
 void testReplaceInMemoryConfig()
          Tests whether the in-memory configuration can be replaced by a new child configuration.
 void testSetDelimiterParsingDisabled()
          Tests whether list splitting can be disabled.
 void testSetDelimiterParsingDisabledAfterClear()
          Tests whether the list parsing flag is correctly handled after a clear() operation.
 void testSetDelimiterParsingDisabledInMemoryConfigNonBaseConfig()
          Tests the behavior of setDelimiterParsingDisabled() if the in-memory configuration is not derived from BaseConfiguration.
 void testSetListDelimiter()
          Tests changing the list delimiter character.
 void testSetListDelimiterAfterClear()
          Tests whether the correct list delimiter is set after a clear operation.
 void testSetListDelimiterInMemoryConfigNonBaseConfig()
          Tests the behavior of setListDelimiter() if the in-memory configuration is not derived from BaseConfiguration.
 void testSettingMissingProperty()
          Tests setting values.
 void testStringArray()
          Tests String array parsing.
 void testStringArrayInterpolation()
           
 void testSubsetCanResolve()
          Tests subsets and still can resolve elements
 void testThrowExceptionOnMissing()
           
 void testUseChildConfigAsInMemoryConfig()
          Tests whether a configuration can act as both regular child configuration and in-memory configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conf1

protected PropertiesConfiguration conf1

conf2

protected PropertiesConfiguration conf2

xmlConf

protected XMLConfiguration xmlConf

cc

protected CompositeConfiguration cc
Constructor Detail

TestCompositeConfiguration

public TestCompositeConfiguration()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

testThrowExceptionOnMissing

public void testThrowExceptionOnMissing()

testAddRemoveConfigurations

public void testAddRemoveConfigurations()
                                 throws Exception
Throws:
Exception

testGetPropertyWIncludes

public void testGetPropertyWIncludes()
                              throws Exception
Throws:
Exception

testGetProperty

public void testGetProperty()
                     throws Exception
Throws:
Exception

testCantRemoveMemoryConfig

public void testCantRemoveMemoryConfig()
                                throws Exception
Throws:
Exception

testGetPropertyMissing

public void testGetPropertyMissing()
                            throws Exception
Throws:
Exception

testMultipleTypesOfConfigs

public void testMultipleTypesOfConfigs()
                                throws Exception
Tests List parsing.

Throws:
Exception

testPropertyExistsInOnlyOneConfig

public void testPropertyExistsInOnlyOneConfig()
                                       throws Exception
Throws:
Exception

testDefaultValueWhenKeyMissing

public void testDefaultValueWhenKeyMissing()
                                    throws Exception
Tests getting a default when the key doesn't exist

Throws:
Exception

testGettingConfiguration

public void testGettingConfiguration()
                              throws Exception
Throws:
Exception

testClearingProperty

public void testClearingProperty()
                          throws Exception
Tests setting values. These are set in memory mode only!

Throws:
Exception

testAddingProperty

public void testAddingProperty()
                        throws Exception
Tests adding values. Make sure they _DON'T_ override any other properties but add to the existing properties and keep sequence

Throws:
Exception

testSettingMissingProperty

public void testSettingMissingProperty()
                                throws Exception
Tests setting values. These are set in memory mode only!

Throws:
Exception

testGettingSubset

public void testGettingSubset()
                       throws Exception
Tests retrieving subsets of configurations

Throws:
Exception

testSubsetCanResolve

public void testSubsetCanResolve()
                          throws Exception
Tests subsets and still can resolve elements

Throws:
Exception

testList

public void testList()
              throws Exception
Tests List parsing.

Throws:
Exception

testStringArray

public void testStringArray()
                     throws Exception
Tests String array parsing.

Throws:
Exception

testGetList

public void testGetList()

testGetKeysPreservesOrder

public void testGetKeysPreservesOrder()
                               throws Exception
Tests getKeys preserves the order

Throws:
Exception

testGetKeys2PreservesOrder

public void testGetKeys2PreservesOrder()
                                throws Exception
Tests getKeys(String key) preserves the order

Throws:
Exception

testGetStringWithDefaults

public void testGetStringWithDefaults()

testCheckingInMemoryConfiguration

public void testCheckingInMemoryConfiguration()
                                       throws Exception
Throws:
Exception

testStringArrayInterpolation

public void testStringArrayInterpolation()

testListInterpolation

public void testListInterpolation()
Tests whether global interpolation works with lists.


testInterpolationWithReload

public void testInterpolationWithReload()
                                 throws IOException,
                                        ConfigurationException
Tests interpolation in combination with reloading.

Throws:
IOException
ConfigurationException

testInstanciateWithCollection

public void testInstanciateWithCollection()

testClone

public void testClone()

testCloneNotSupported

public void testCloneNotSupported()
Tests cloning if one of the contained configurations does not support this operation. This should cause an exception.


testCloneEventListener

public void testCloneEventListener()
Ensures that event listeners are not cloned.


testEventAddProperty

public void testEventAddProperty()
Tests whether add property events are triggered.


testEventSetProperty

public void testEventSetProperty()
Tests whether set property events are triggered.


testEventClearProperty

public void testEventClearProperty()
Tests whether clear property events are triggered.


testSetListDelimiter

public void testSetListDelimiter()
Tests changing the list delimiter character.


testSetListDelimiterAfterClear

public void testSetListDelimiterAfterClear()
Tests whether the correct list delimiter is set after a clear operation.


testSetDelimiterParsingDisabled

public void testSetDelimiterParsingDisabled()
Tests whether list splitting can be disabled.


testSetDelimiterParsingDisabledAfterClear

public void testSetDelimiterParsingDisabledAfterClear()
Tests whether the list parsing flag is correctly handled after a clear() operation.


testGetSourceSingle

public void testGetSourceSingle()
Tests the getSource() method if the property is defined in a single child configuration.


testGetSourceUnknown

public void testGetSourceUnknown()
Tests the getSource() method for an unknown property key.


testGetSourceInMemory

public void testGetSourceInMemory()
Tests the getSource() method for a property contained in the in memory configuration.


testGetSourceMultiple

public void testGetSourceMultiple()
Tests the getSource() method if the property is defined by multiple child configurations. In this case an exception should be thrown.


testGetSourceNull

public void testGetSourceNull()
Tests the getSource() method for a null key. This should cause an exception.


testGetListWithInterpolation

public void testGetListWithInterpolation()
Tests querying a list when a tricky interpolation is involved. This is related to CONFIGURATION-339.


testGetStringArrayWithInterpolation

public void testGetStringArrayWithInterpolation()
Tests querying a string array when a tricky interpolation is involved.


testInterpolationInMultipleConfigs

public void testInterpolationInMultipleConfigs()
Tests whether interpolation works if multiple configurations are involved. This test is related to CONFIGURATION-441.


testSetListDelimiterInMemoryConfigNonBaseConfig

public void testSetListDelimiterInMemoryConfigNonBaseConfig()
Tests the behavior of setListDelimiter() if the in-memory configuration is not derived from BaseConfiguration. This test is related to CONFIGURATION-476.


testSetDelimiterParsingDisabledInMemoryConfigNonBaseConfig

public void testSetDelimiterParsingDisabledInMemoryConfigNonBaseConfig()
Tests the behavior of setDelimiterParsingDisabled() if the in-memory configuration is not derived from BaseConfiguration. This test is related to CONFIGURATION-476.


testUseChildConfigAsInMemoryConfig

public void testUseChildConfigAsInMemoryConfig()
Tests whether a configuration can act as both regular child configuration and in-memory configuration. This test is related to CONFIGURATION-471.


testReplaceInMemoryConfig

public void testReplaceInMemoryConfig()
Tests whether the in-memory configuration can be replaced by a new child configuration.



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