|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.newsml.toolkit.conformance.NewsMLTestManager
Top-level manager for NewsML conformance tests.
This manager handles registration, running, and error reporting for NewsML conformance tests. It can be used with a predefined set of core tests, optionally augmented by user-supplied tests for specific business rules, or exclusively with user-supplied tests. The tests managed by this class are intended to augment the DTD conformance that can be (optionally) performed when the NewsML is loaded from XML.
The user can customize error handling by providing an
ErrorVisitor
through the setErrorVisitor(org.newsml.toolkit.conformance.ErrorVisitor)
method.
Constructor Summary | |
NewsMLTestManager()
Constructor. |
Method Summary | |
void |
addDefaultTests()
Add a set of default conformance tests. |
void |
addTest(String xpath,
TestBase test)
Register a new test for the manager. |
void |
runTests(BaseNode contextNode,
boolean useExternal)
Run all registered tests against a context node. |
void |
setErrorVisitor(ErrorVisitor errorVisitor)
Set the error vistor. |
void |
setVerbose(boolean verbose)
Enable or disable the display of messages during processing. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NewsMLTestManager()
Build a new manager with no tests registered.
Method Detail |
public void setVerbose(boolean verbose)
verbose
- true if the manager should display progress messages
to stdout, false (the default) otherwise.public void setErrorVisitor(ErrorVisitor errorVisitor)
The error visitor allows the application to customize error handling during a conformance.
errorVisitor
- The new error handler.public void addTest(String xpath, TestBase test)
The caller supplies both a test and an XPath -- the XPath expression will be used to find notes against which the test should be run.
xpath
- The XPath for nodes to which the test will
be applied.test
- The test itself.public void addDefaultTests()
The default tests check general problems that can occur but are not caught by DTD conformance.
public void runTests(BaseNode contextNode, boolean useExternal) throws NewsMLException
contextNode
- The context node for matching tests
(usually the root NewsML node).useExternal
- true if the tests may attempt to retrieve
external resources, false otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |