org.apache.commons.configuration.tree.xpath
Class AbstractXPathTest

java.lang.Object
  extended by org.apache.commons.configuration.tree.xpath.AbstractXPathTest
Direct Known Subclasses:
TestConfigurationIteratorAttributes, TestConfigurationNodeIteratorChildren, TestConfigurationNodePointer, TestConfigurationNodePointerFactory

public abstract class AbstractXPathTest
extends Object

A base class for testing classes of the XPath package. This base class creates a hierarchy of nodes in its setUp() method that can be used for test cases.

Version:
$Id: AbstractXPathTest.java 1226104 2011-12-31 15:37:16Z oheger $
Author:
Commons Configuration team

Field Summary
protected static String ATTR_NAME
          Constant for the name of the counter attribute.
protected static int CHILD_COUNT
          Constant for the number of sub nodes.
protected static String CHILD_NAME1
          Constant for the name of the first child.
protected static String CHILD_NAME2
          Constant for the name of the second child.
protected static int LEVEL_COUNT
          Constant for the number of levels in the hierarchy.
protected  ConfigurationNode root
          Stores the root node of the hierarchy.
 
Constructor Summary
AbstractXPathTest()
           
 
Method Summary
protected  ConfigurationNode constructHierarchy(int levels)
          Builds up a hierarchy of nodes.
protected  List<ConfigurationNode> iterationElements(org.apache.commons.jxpath.ri.model.NodeIterator iterator)
          Returns a list with all configuration nodes contained in the specified iteration.
protected  int iteratorSize(org.apache.commons.jxpath.ri.model.NodeIterator iterator)
          Determines the number of elements contained in the given iterator.
 void setUp()
           
 void tearDown()
          Clears the test environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_NAME

protected static final String ATTR_NAME
Constant for the name of the counter attribute.

See Also:
Constant Field Values

CHILD_NAME1

protected static final String CHILD_NAME1
Constant for the name of the first child.

See Also:
Constant Field Values

CHILD_NAME2

protected static final String CHILD_NAME2
Constant for the name of the second child.

See Also:
Constant Field Values

CHILD_COUNT

protected static final int CHILD_COUNT
Constant for the number of sub nodes.

See Also:
Constant Field Values

LEVEL_COUNT

protected static final int LEVEL_COUNT
Constant for the number of levels in the hierarchy.

See Also:
Constant Field Values

root

protected ConfigurationNode root
Stores the root node of the hierarchy.

Constructor Detail

AbstractXPathTest

public AbstractXPathTest()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
Clears the test environment.

Throws:
Exception

constructHierarchy

protected ConfigurationNode constructHierarchy(int levels)
Builds up a hierarchy of nodes. Each node has CHILD_COUNT child nodes having the names CHILD_NAME1 or CHILD_NAME2. Their values are named like their parent node with an additional index. Each node has an attribute with a counter value.

Parameters:
levels - the number of levels in the hierarchy
Returns:
the root node of the hierarchy

iteratorSize

protected int iteratorSize(org.apache.commons.jxpath.ri.model.NodeIterator iterator)
Determines the number of elements contained in the given iterator.

Parameters:
iterator - the iterator
Returns:
the number of elements in this iteration

iterationElements

protected List<ConfigurationNode> iterationElements(org.apache.commons.jxpath.ri.model.NodeIterator iterator)
Returns a list with all configuration nodes contained in the specified iteration. It is assumed that the iteration contains only elements of this type.

Parameters:
iterator - the iterator
Returns:
a list with configuration nodes obtained from the iterator


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