org.apache.commons.configuration
Class TestHierarchicalConfiguration

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

public class TestHierarchicalConfiguration
extends Object

Test class for HierarchicalConfiguration.

Version:
$Id: TestHierarchicalConfiguration.java 1231749 2012-01-15 20:48:56Z oheger $

Constructor Summary
TestHierarchicalConfiguration()
           
 
Method Summary
 void setUp()
           
 void testAddNodes()
           
 void testAddNodesAttributeNode()
          Tests adding an attribute node with the addNodes() method.
 void testAddNodesCopy()
          Tests copying nodes from one configuration to another one.
 void testAddNodesForNonExistingKey()
          Tests the addNodes() method when the provided key does not exist.
 void testAddNodesWithAttributeKey()
          Tests the addNodes() method when the new nodes should be added to an attribute node.
 void testAddProperty()
           
 void testAddPropertyInvalidKey()
           
 void testClear()
           
 void testClearProperty()
           
 void testClearTree()
           
 void testClearTreeComplex()
          Tests removing more complex node structures.
 void testClearTreeHierarchy()
          Tests the clearTree() method on a hierarchical structure of nodes.
 void testClone()
           
 void testCloneWithEventListeners()
          Tests whether registered event handlers are handled correctly when a configuration is cloned.
 void testConfigurationAt()
          Tests the configurationAt() method to obtain a configuration for a sub tree.
 void testConfigurationAtClear()
          Tests whether a sub configuration obtained by configurationAt() can be cleared.
 void testConfigurationAtMultipleNodes()
          Tests the configurationAt() method when the passed in key selects multiple nodes.
 void testConfigurationAtUnknownSubTree()
          Tests the configurationAt() method when the passed in key does not exist.
 void testConfigurationsAt()
          Tests the configurationsAt() method.
 void testConfigurationsAtEmpty()
          Tests the configurationsAt() method when the passed in key does not select any sub nodes.
 void testContainsKey()
           
 void testGetKeys()
           
 void testGetKeysString()
           
 void testGetKeysWithKeyAsPrefix()
          Tests getKeys() with a prefix when the prefix matches exactly a key.
 void testGetKeysWithKeyAsPrefixMultiple()
          Tests getKeys() with a prefix when the prefix matches exactly a key, and there are multiple keys starting with this prefix.
 void testGetMaxIndex()
           
 void testGetProperty()
           
 void testGetPropertyKeyWithBrackets()
          Tests whether keys that contains brackets can be used.
 void testGetRootAfterSetRootNode()
          Tests calling getRoot() after a root node was set using setRootNode() and further child nodes have been added.
 void testInitCopy()
          Tests the copy constructor.
 void testInitCopyNull()
          Tests the copy constructor when a null reference is passed.
 void testInitCopyUpdate()
          Tests whether the nodes of a copied configuration are independent from the source configuration.
 void testInterpolatedConfiguration()
          Tests obtaining a configuration with all variables substituted.
 void testInterpolation()
          Tests interpolation facilities.
 void testInterpolationBasic()
          Basic interpolation tests.
 void testInterpolationConstants()
          Tests interpolation with constant values.
 void testInterpolationEscaped()
          Tests escaping variables.
 void testInterpolationLoop()
          Tests an invalid interpolation that causes an endless loop.
 void testInterpolationMultipleLevels()
          Tests multiple levels of interpolation.
 void testInterpolationSubset()
          Tests interpolation with a subset.
 void testInterpolationSubsetMultipleLayers()
          Tests whether interpolation with a subset configuration works over multiple layers.
 void testInterpolationSysProperties()
          Tests interpolation with system properties.
 void testInterpolationUnknownProperty()
          Tests interpolation of a variable, which cannot be resolved.
 void testInterpolator()
          Tests manipulating the interpolator.
 void testIsEmpty()
           
 void testNodeParentsAfterSetRootNode()
          Tests the parents of nodes when setRootNode() is involved.
 void testNodeRemove()
          Tests removing children from a configuration node.
 void testNodeVisitor()
          Tests the visitor mechanism.
 void testNodeVisitorKeys()
          Tests the visitor mechanism if a ConfigurationKey is passed in.
 void testSetDefaultExpressionEngine()
          Tests setting the default expression engine.
 void testSetDefaultExpressionEngineNull()
          Tests setting the default expression engine to null.
 void testSetExpressionEngine()
          Tests setting a custom expression engine, which uses a slightly different syntax.
 void testSetProperty()
           
 void testSetRoot()
           
 void testSetRootNode()
           
 void testSetRootNodeNull()
           
 void testSetRootNull()
           
 void testSubset()
           
 void testSubsetMultipleNodesWithValues()
          Tests the subset() method when the specified key selects multiple keys.
 void testSubsetNodeWithValue()
          Tests the subset() method when the specified node has a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestHierarchicalConfiguration

public TestHierarchicalConfiguration()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

testSetRoot

public void testSetRoot()

testSetRootNull

public void testSetRootNull()

testSetRootNode

public void testSetRootNode()

testSetRootNodeNull

public void testSetRootNodeNull()

testIsEmpty

public void testIsEmpty()

testGetProperty

public void testGetProperty()

testSetProperty

public void testSetProperty()

testClear

public void testClear()

testClearProperty

public void testClearProperty()

testClearTree

public void testClearTree()

testClearTreeComplex

public void testClearTreeComplex()
Tests removing more complex node structures.


testClearTreeHierarchy

public void testClearTreeHierarchy()
Tests the clearTree() method on a hierarchical structure of nodes. This is a test case for CONFIGURATION-293.


testContainsKey

public void testContainsKey()

testGetKeys

public void testGetKeys()

testGetKeysString

public void testGetKeysString()

testGetKeysWithKeyAsPrefix

public void testGetKeysWithKeyAsPrefix()
Tests getKeys() with a prefix when the prefix matches exactly a key.


testGetKeysWithKeyAsPrefixMultiple

public void testGetKeysWithKeyAsPrefixMultiple()
Tests getKeys() with a prefix when the prefix matches exactly a key, and there are multiple keys starting with this prefix.


testAddProperty

public void testAddProperty()

testAddPropertyInvalidKey

public void testAddPropertyInvalidKey()

testGetMaxIndex

public void testGetMaxIndex()

testSubset

public void testSubset()

testSubsetNodeWithValue

public void testSubsetNodeWithValue()
Tests the subset() method when the specified node has a value. This value must be available in the subset, too. Related to CONFIGURATION-295.


testSubsetMultipleNodesWithValues

public void testSubsetMultipleNodesWithValues()
Tests the subset() method when the specified key selects multiple keys. The resulting root node should have a value only if exactly one of the selected nodes has a value. Related to CONFIGURATION-295.


testConfigurationAt

public void testConfigurationAt()
Tests the configurationAt() method to obtain a configuration for a sub tree.


testConfigurationAtUnknownSubTree

public void testConfigurationAtUnknownSubTree()
Tests the configurationAt() method when the passed in key does not exist.


testConfigurationAtMultipleNodes

public void testConfigurationAtMultipleNodes()
Tests the configurationAt() method when the passed in key selects multiple nodes. This should cause an exception.


testConfigurationAtClear

public void testConfigurationAtClear()
Tests whether a sub configuration obtained by configurationAt() can be cleared.


testConfigurationsAt

public void testConfigurationsAt()
Tests the configurationsAt() method.


testConfigurationsAtEmpty

public void testConfigurationsAtEmpty()
Tests the configurationsAt() method when the passed in key does not select any sub nodes.


testClone

public void testClone()

testCloneWithEventListeners

public void testCloneWithEventListeners()
Tests whether registered event handlers are handled correctly when a configuration is cloned. They should not be registered at the clone.


testAddNodes

public void testAddNodes()

testAddNodesForNonExistingKey

public void testAddNodesForNonExistingKey()
Tests the addNodes() method when the provided key does not exist. In this case, a new node (or even a complete new branch) will be created.


testAddNodesWithAttributeKey

public void testAddNodesWithAttributeKey()
Tests the addNodes() method when the new nodes should be added to an attribute node. This is not allowed.


testAddNodesCopy

public void testAddNodesCopy()
Tests copying nodes from one configuration to another one.


testAddNodesAttributeNode

public void testAddNodesAttributeNode()
Tests adding an attribute node with the addNodes() method.


testNodeRemove

public void testNodeRemove()
Tests removing children from a configuration node.


testNodeVisitor

public void testNodeVisitor()
Tests the visitor mechanism.


testNodeVisitorKeys

public void testNodeVisitorKeys()
Tests the visitor mechanism if a ConfigurationKey is passed in.


testSetExpressionEngine

public void testSetExpressionEngine()
Tests setting a custom expression engine, which uses a slightly different syntax.


testSetDefaultExpressionEngine

public void testSetDefaultExpressionEngine()
Tests setting the default expression engine. This should impact all configuration instances that do not have their own engine.


testSetDefaultExpressionEngineNull

public void testSetDefaultExpressionEngineNull()
Tests setting the default expression engine to null. This should not be allowed.


testInitCopy

public void testInitCopy()
Tests the copy constructor.


testInitCopyUpdate

public void testInitCopyUpdate()
Tests whether the nodes of a copied configuration are independent from the source configuration.


testInterpolation

public void testInterpolation()
Tests interpolation facilities.


testInterpolationBasic

public void testInterpolationBasic()
Basic interpolation tests.


testInterpolationMultipleLevels

public void testInterpolationMultipleLevels()
Tests multiple levels of interpolation.


testInterpolationLoop

public void testInterpolationLoop()
Tests an invalid interpolation that causes an endless loop.


testInterpolationSubset

public void testInterpolationSubset()
Tests interpolation with a subset.


testInterpolationSubsetMultipleLayers

public void testInterpolationSubsetMultipleLayers()
Tests whether interpolation with a subset configuration works over multiple layers.


testInterpolationUnknownProperty

public void testInterpolationUnknownProperty()
Tests interpolation of a variable, which cannot be resolved.


testInterpolationSysProperties

public void testInterpolationSysProperties()
Tests interpolation with system properties.


testInterpolationConstants

public void testInterpolationConstants()
Tests interpolation with constant values.


testInterpolationEscaped

public void testInterpolationEscaped()
Tests escaping variables.


testInterpolator

public void testInterpolator()
Tests manipulating the interpolator.


testInterpolatedConfiguration

public void testInterpolatedConfiguration()
Tests obtaining a configuration with all variables substituted.


testInitCopyNull

public void testInitCopyNull()
Tests the copy constructor when a null reference is passed.


testNodeParentsAfterSetRootNode

public void testNodeParentsAfterSetRootNode()
Tests the parents of nodes when setRootNode() is involved. This is related to CONFIGURATION-334.


testGetRootAfterSetRootNode

public void testGetRootAfterSetRootNode()
Tests calling getRoot() after a root node was set using setRootNode() and further child nodes have been added. The newly add child nodes should be present in the root node returned.


testGetPropertyKeyWithBrackets

public void testGetPropertyKeyWithBrackets()
Tests whether keys that contains brackets can be used.



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