|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.extensions.xml.elements.AbstractTagHandler
Sub-classes of this class will handle the processing of elements. It provides common access methods to the test case or test suite. It also provides methods for reading attributes.
Field Summary | |
private org.w3c.dom.Element |
m_element
The Element to be processed. |
private IXMLTestCase |
m_testCase
The IXMLTestCase that uses this element. |
private IXMLTestSuite |
m_testSuite
The IXMLTestSuite that uses this element. |
Fields inherited from interface junit.extensions.xml.XMLConstants |
ACTION, ACTUALOBJ, ACTUALREFID, ADD, ASSERTENABLED, ASSERTEQUALS, ASSERTNOTEQUALS, ASSERTNOTNULL, ASSERTNOTSAME, ASSERTNULL, ASSERTSAME, CALL, CASE, CHOOSE, CLASSNAME, COLUMN, CONFIRM, DEBUG, DEFAULT, DELIMITER, DIALOG, DUMP, ECHO, ENABLED, ENCODING, EVALUATE, EXPECTEDOBJ, EXPECTEDREFID, FAIL, FILE, FOCUS, FOREACH, ID, INDEX, JFCFILELOC, LESSTHAN, LISTITEM, LOG, MARK, MESSAGE, METHOD, MODE, NAME, OTHERWISE, PATHREFID, PROCEDURE, PROPERTY, RECURSIVE, REFID, RELATIVE, REMOVE, ROW, SAVE, STDERR, STDOUT, STOPWATCH, SUITE, SWITCH, TABLECELL, TAGHANDLERS, TAGNAME, TEST, TYPE, USERE, VALUE, WHEN, WHILE |
Constructor Summary | |
AbstractTagHandler(org.w3c.dom.Element element,
IXMLTestCase testCase)
Constructor for AbstractTagHandler. |
|
AbstractTagHandler(org.w3c.dom.Element element,
IXMLTestSuite testSuite)
Constructor for AbstractTagHandler. |
Method Summary | |
protected void |
checkAtLeastOneRequiredAttribute(org.w3c.dom.Element root,
java.lang.String[] attrName)
Since all sub-classes might check for a required attribute, this method can be used for consistent messages. |
protected void |
checkAtLeastOneRequiredAttribute(java.lang.String[] attrName)
Since all sub-classes might check for a required attribute, this method can be used for consistent messages. |
protected void |
checkElementTagName(java.lang.String expectedName)
Since all sub-classes will check for the element tag name, this method can be used for consistent messages. |
protected void |
checkOneRequiredAttribute(org.w3c.dom.Element root,
java.lang.String[] attrName)
Since all sub-classes might check for a required attribute, this method can be used for consistent messages. |
protected void |
checkOneRequiredAttribute(java.lang.String[] attrName)
Since all sub-classes might check for a required attribute, this method can be used for consistent messages. |
protected void |
checkRequiredAttribute(org.w3c.dom.Element e,
java.lang.String attrName)
Since all sub-classes might check for a required attribute, this method can be used for consistent messages. |
protected void |
checkRequiredAttribute(java.lang.String attrName)
Since all sub-classes might check for a required attribute, this method can be used for consistent messages. |
protected boolean |
getBoolean(org.w3c.dom.Element e,
java.lang.String attributeName)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive boolean, if not, then returns false. |
protected boolean |
getBoolean(org.w3c.dom.Element e,
java.lang.String attributeName,
boolean defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive boolean, if not, then returns false. |
protected boolean |
getBoolean(java.lang.String attributeName)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive boolean, if not, then returns false. |
protected boolean |
getBoolean(java.lang.String attributeName,
boolean defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive boolean, if not, then returns false. |
org.w3c.dom.Element |
getElement()
Returns the element. |
protected int |
getInt(org.w3c.dom.Element e,
java.lang.String attributeName,
int defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive int, if not, then returns the default value specified. |
protected int |
getInt(java.lang.String attributeName,
int defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive int, if not, then returns the default value specified. |
protected long |
getLong(org.w3c.dom.Element e,
java.lang.String attributeName,
long defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive long, if not, then returns the default value specified. |
protected long |
getLong(java.lang.String attributeName,
long defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a primitive long, if not, then returns the default value specified. |
protected java.awt.Point |
getPoint(org.w3c.dom.Element e,
java.lang.String attributeName,
java.awt.Point defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a Point , if not, then returns the default value specified. |
protected java.awt.Point |
getPoint(java.lang.String attributeName,
java.awt.Point defaultValue)
This method checks whether the specified attribute is present, and if so, returns the value parsed as a Point , if not, then returns the default value specified. |
protected java.lang.String |
getString(org.w3c.dom.Element e,
java.lang.String attributeName)
This method returns the value of the specified attribute. |
protected java.lang.String |
getString(org.w3c.dom.Element e,
java.lang.String attributeName,
java.lang.String defaultValue)
Get the string assigned to the attributeName from the element. |
protected java.lang.String |
getString(java.lang.String attributeName)
This method returns the value of the specified attribute. |
protected java.lang.String |
getString(java.lang.String attributeName,
java.lang.String defaultValue)
Get a the string assigned to a attribute from the current element. |
protected java.lang.String |
getTagName()
Return the tag name of this element. |
protected IXMLTest |
getTest()
Get the test. |
junit.framework.TestCase |
getTestCase()
The JUnit framework test case. |
IXMLTestCase |
getXMLTestCase()
Returns the testCase. |
IXMLTestSuite |
getXMLTestSuite()
Returns the testSuite. |
abstract void |
processElement()
This method is used to process the xml Element (i.e. |
protected java.lang.String |
resolveVariables(java.lang.String s)
Replace variable names with the string of the variable values. |
protected void |
validateElement()
Sub-classes should implement this method to provide validation of the element attributes, etc. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.w3c.dom.Element m_element
private IXMLTestCase m_testCase
private IXMLTestSuite m_testSuite
Constructor Detail |
public AbstractTagHandler(org.w3c.dom.Element element, IXMLTestCase testCase)
element
- The element to be processed.testCase
- The testCase to be associated with the test.public AbstractTagHandler(org.w3c.dom.Element element, IXMLTestSuite testSuite)
element
- The element to be processed.testSuite
- The testSuite to be associated with the test.Method Detail |
public final org.w3c.dom.Element getElement()
public final junit.framework.TestCase getTestCase()
public final IXMLTestCase getXMLTestCase()
public final IXMLTestSuite getXMLTestSuite()
public abstract void processElement() throws XMLException
XMLException
- Some kind of Exception might be thrown.protected final java.lang.String getTagName()
protected final void checkAtLeastOneRequiredAttribute(java.lang.String[] attrName) throws XMLException
attrName
- The names of the attributes being checked.
XMLException
- A validation exception is thrown.protected final void checkAtLeastOneRequiredAttribute(org.w3c.dom.Element root, java.lang.String[] attrName) throws XMLException
root
- The root Element whose attributes are being checkedattrName
- The names of the attributes being checked.
XMLException
- A validation exception is thrown.protected final void checkElementTagName(java.lang.String expectedName) throws XMLException
expectedName
- The non-null expected string name.
XMLException
- A validation exception is thrown.protected final void checkRequiredAttribute(org.w3c.dom.Element e, java.lang.String attrName) throws XMLException
e
- Element to be checked for the attribute.attrName
- The name of the attribute being checked.
XMLException
- A validation exception is thrown.protected final void checkRequiredAttribute(java.lang.String attrName) throws XMLException
attrName
- The name of the attribute being checked.
XMLException
- A validation exception is thrown.protected boolean getBoolean(java.lang.String attributeName)
attributeName
- The name of the attribute whose value is needed.
protected boolean getBoolean(java.lang.String attributeName, boolean defaultValue)
attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value
protected final boolean getBoolean(org.w3c.dom.Element e, java.lang.String attributeName)
e
- Element to be searched.attributeName
- The name of the attribute whose value is needed.
protected final boolean getBoolean(org.w3c.dom.Element e, java.lang.String attributeName, boolean defaultValue)
e
- Element to be searched.attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value.
protected int getInt(java.lang.String attributeName, int defaultValue)
attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value to use if such an attribute is not present.
protected int getInt(org.w3c.dom.Element e, java.lang.String attributeName, int defaultValue)
e
- Element to be processed.attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value to use if such an attribute is not present.
protected long getLong(java.lang.String attributeName, long defaultValue)
attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value to use if such an attribute is not present.
protected long getLong(org.w3c.dom.Element e, java.lang.String attributeName, long defaultValue)
e
- Element to be searched.attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value to use if such an attribute is not present.
protected final java.awt.Point getPoint(java.lang.String attributeName, java.awt.Point defaultValue) throws XMLException
Point
, if not, then returns the default value specified.
attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value to use if such an attribute is not present.
XMLException
- if the parse did not work.protected final java.awt.Point getPoint(org.w3c.dom.Element e, java.lang.String attributeName, java.awt.Point defaultValue) throws XMLException
Point
, if not, then returns the default value specified.
e
- Element to be searched.attributeName
- The name of the attribute whose value is needed.defaultValue
- The default value to use if such an attribute is not present.
XMLException
- is thrown if the element cannot be understood.protected final java.lang.String getString(java.lang.String attributeName)
attributeName
- The name of the attribute whose value is needed.
protected final java.lang.String getString(java.lang.String attributeName, java.lang.String defaultValue)
attributeName
- Name of the attribute to find.defaultValue
- Default value to return if the attribute is not
present.
protected final java.lang.String getString(org.w3c.dom.Element e, java.lang.String attributeName)
e
- Element to be searched;attributeName
- The name of the attribute whose value is needed.
protected final java.lang.String getString(org.w3c.dom.Element e, java.lang.String attributeName, java.lang.String defaultValue)
e
- Element to be checked.attributeName
- Name of the attribute to be returned.defaultValue
- Default value to be returned.
protected void checkOneRequiredAttribute(java.lang.String[] attrName) throws XMLException
attrName
- The names of the attributes being checked.
XMLException
- A validation exception is thrown.protected void checkOneRequiredAttribute(org.w3c.dom.Element root, java.lang.String[] attrName) throws XMLException
root
- The root Element whose attributes are being checkedattrName
- The names of the attributes being checked.
XMLException
- A validation exception is thrown.protected final java.lang.String resolveVariables(java.lang.String s)
s
- String to be substituted.
protected IXMLTest getTest()
protected void validateElement() throws XMLException
XMLException
- A validation exception is thrown.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |