org.apache.commons.configuration
Class TestHierarchicalConfiguration

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

public class TestHierarchicalConfiguration
extends junit.framework.TestCase

Test class for HierarchicalConfiguration.

Version:
$Id: TestHierarchicalConfiguration.java 589136 2007-10-27 15:38:15Z oheger $

Constructor Summary
TestHierarchicalConfiguration()
           
 
Method Summary
protected  void setUp()
           
 void testAddNodes()
           
 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 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 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 testGetMaxIndex()
           
 void testGetProperty()
           
 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 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 testNodeRemove()
          Tests removing children from a configuration node.
 void testNodeVisitor()
          Tests the visitor mechanism.
 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 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 junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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

TestHierarchicalConfiguration

public TestHierarchicalConfiguration()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

testSetRoot

public void testSetRoot()

testSetRootNode

public void testSetRootNode()

testSetRootNodeNull

public void testSetRootNodeNull()

testIsEmpty

public void testIsEmpty()

testGetProperty

public void testGetProperty()

testSetProperty

public void testSetProperty()

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()

testAddProperty

public void testAddProperty()

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.


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.


testNodeRemove

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


testNodeVisitor

public void testNodeVisitor()
Tests the visitor mechanism.


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.


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.



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