org.apache.commons.configuration
Class TestSubnodeConfiguration

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

public class TestSubnodeConfiguration
extends Object

Test case for SubnodeConfiguration.

Version:
$Id: TestSubnodeConfiguration.java 1225018 2011-12-27 21:14:59Z oheger $
Author:
Commons Configuration team

Field Summary
 org.junit.rules.TemporaryFolder folder
          A helper object for creating temporary files.
 
Constructor Summary
TestSubnodeConfiguration()
           
 
Method Summary
protected  ConfigurationNode getSubnodeRoot(HierarchicalConfiguration conf)
          Returns the root node for the subnode config.
 void setUp()
           
protected  HierarchicalConfiguration setUpParentConfig()
          Initializes the parent configuration.
protected  void setUpSubnodeConfig()
          Performs a standard initialization of the subnode config to test.
 void testAddProperty()
          Tests adding of properties.
 void testConfiguarationAt()
          Tests the configurationAt() method.
 void testGetKeys()
          Tests listing the defined keys.
 void testGetProperties()
          Tests if properties of the sub node can be accessed.
 void testInitSubNodeConfig()
          Tests creation of a subnode config.
 void testInitSubNodeConfigWithNullNode()
          Tests constructing a subnode configuration with a null root node.
 void testInitSubNodeConfigWithNullParent()
          Tests constructing a subnode configuration with a null parent.
 void testInterpolation()
          Tests interpolation features.
 void testInterpolationFromConfigurationAt()
          An additional test for interpolation when the configurationAt() method is involved.
 void testInterpolator()
          Tests manipulating the interpolator.
 void testLocalInterpolationFromConfigurationAt()
          An additional test for interpolation when the configurationAt() method is involved for a local interpolation.
 void testLocalLookupsInInterpolatorAreInherited()
           
 void testParentChangeDetach()
          Tests a manipulation of the parent configuration that causes the subnode configuration to become invalid.
 void testParentChangeDetatchException()
          Tests detaching a subnode configuration when an exception is thrown during reconstruction.
 void testParentReloadEvents()
          Tests whether events are fired if a change of the parent is detected.
 void testParentReloadNotSupported()
          Tests a reload operation for the parent configuration when the subnode configuration does not support reloads.
 void testParentReloadSubSubnode()
          Tests whether reloads work with sub subnode configurations.
 void testParentReloadSubSubnodeNoChangeSupport()
          Tests creating a sub sub config when the sub config is not aware of changes.
 void testParentReloadSupportAccessParent()
          Tests a reload operation for the parent configuration when the subnode configuration is aware of reloads, and the parent configuration is accessed first.
 void testParentReloadSupported()
          Tests a reload operation for the parent configuration when the subnode configuration does support reloads.
 void testSetDelimiterParsingDisabled()
          Tests handling of the delimiter parsing disabled flag.
 void testSetExpressionEngine()
          Tests changing the expression engine.
 void testSetListDelimiter()
          Tests manipulating the list delimiter.
 void testSetProperty()
          Tests setting of properties in both the parent and the subnode configuration and whether the changes are visible to each other.
 void testSetThrowExceptionOnMissing()
          Tests setting the exception on missing flag.
 void testSetThrowExceptionOnMissingAffectsParent()
          Tests whether the exception flag can be set independently from the parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

folder

public org.junit.rules.TemporaryFolder folder
A helper object for creating temporary files.

Constructor Detail

TestSubnodeConfiguration

public TestSubnodeConfiguration()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

testInitSubNodeConfig

public void testInitSubNodeConfig()
Tests creation of a subnode config.


testInitSubNodeConfigWithNullParent

public void testInitSubNodeConfigWithNullParent()
Tests constructing a subnode configuration with a null parent. This should cause an exception.


testInitSubNodeConfigWithNullNode

public void testInitSubNodeConfigWithNullNode()
Tests constructing a subnode configuration with a null root node. This should cause an exception.


testGetProperties

public void testGetProperties()
Tests if properties of the sub node can be accessed.


testSetProperty

public void testSetProperty()
Tests setting of properties in both the parent and the subnode configuration and whether the changes are visible to each other.


testAddProperty

public void testAddProperty()
Tests adding of properties.


testGetKeys

public void testGetKeys()
Tests listing the defined keys.


testSetThrowExceptionOnMissing

public void testSetThrowExceptionOnMissing()
Tests setting the exception on missing flag. The subnode config obtains this flag from its parent.


testSetThrowExceptionOnMissingAffectsParent

public void testSetThrowExceptionOnMissingAffectsParent()
Tests whether the exception flag can be set independently from the parent.


testSetDelimiterParsingDisabled

public void testSetDelimiterParsingDisabled()
Tests handling of the delimiter parsing disabled flag. This is shared with the parent, too.


testSetListDelimiter

public void testSetListDelimiter()
Tests manipulating the list delimiter. This piece of data is derived from the parent.


testSetExpressionEngine

public void testSetExpressionEngine()
Tests changing the expression engine.


testConfiguarationAt

public void testConfiguarationAt()
Tests the configurationAt() method.


testInterpolation

public void testInterpolation()
Tests interpolation features. The subnode config should use its parent for interpolation.


testInterpolationFromConfigurationAt

public void testInterpolationFromConfigurationAt()
An additional test for interpolation when the configurationAt() method is involved.


testLocalInterpolationFromConfigurationAt

public void testLocalInterpolationFromConfigurationAt()
An additional test for interpolation when the configurationAt() method is involved for a local interpolation.


testInterpolator

public void testInterpolator()
Tests manipulating the interpolator.


testLocalLookupsInInterpolatorAreInherited

public void testLocalLookupsInInterpolatorAreInherited()

testParentReloadNotSupported

public void testParentReloadNotSupported()
                                  throws ConfigurationException
Tests a reload operation for the parent configuration when the subnode configuration does not support reloads. Then the new value should not be detected.

Throws:
ConfigurationException

testParentReloadSupported

public void testParentReloadSupported()
                               throws ConfigurationException
Tests a reload operation for the parent configuration when the subnode configuration does support reloads. The new value should be returned.

Throws:
ConfigurationException

testParentReloadEvents

public void testParentReloadEvents()
                            throws ConfigurationException
Tests whether events are fired if a change of the parent is detected.

Throws:
ConfigurationException

testParentReloadSupportAccessParent

public void testParentReloadSupportAccessParent()
                                         throws ConfigurationException
Tests a reload operation for the parent configuration when the subnode configuration is aware of reloads, and the parent configuration is accessed first. The new value should be returned.

Throws:
ConfigurationException

testParentReloadSubSubnode

public void testParentReloadSubSubnode()
                                throws ConfigurationException
Tests whether reloads work with sub subnode configurations.

Throws:
ConfigurationException

testParentReloadSubSubnodeNoChangeSupport

public void testParentReloadSubSubnodeNoChangeSupport()
                                               throws ConfigurationException
Tests creating a sub sub config when the sub config is not aware of changes. Then the sub sub config shouldn't be either.

Throws:
ConfigurationException

testParentChangeDetach

public void testParentChangeDetach()
Tests a manipulation of the parent configuration that causes the subnode configuration to become invalid. In this case the sub config should be detached and keep its old values.


testParentChangeDetatchException

public void testParentChangeDetatchException()
Tests detaching a subnode configuration when an exception is thrown during reconstruction. This can happen e.g. if the expression engine is changed for the parent.


setUpParentConfig

protected HierarchicalConfiguration setUpParentConfig()
Initializes the parent configuration. This method creates the typical structure of tables and fields nodes.

Returns:
the parent configuration

getSubnodeRoot

protected ConfigurationNode getSubnodeRoot(HierarchicalConfiguration conf)
Returns the root node for the subnode config. This method returns the first table node.

Parameters:
conf - the parent config
Returns:
the root node for the subnode config

setUpSubnodeConfig

protected void setUpSubnodeConfig()
Performs a standard initialization of the subnode config to test.



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