public class Comparator extends Object implements XMLDogConstants
APP_NAME, DEBUG, EVENT_NODE_IDENTICAL, EVENT_NODE_MISMATCH, EVENT_NODE_SIMILAR
Constructor and Description |
---|
Comparator()
Default Contructor.
|
Comparator(Node controlNode,
Node testNode,
Config config)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDifferenceListener(DifferenceListener listener)
Adds DifferenceListener.
|
Differences |
compare()
Compares Control and Test nodes.
|
Differences |
compare(Node controlNode,
Node testNode)
Compares nodes and its children recursively.
|
protected NodeResult |
compareAttributes(XNode xControl,
XNode xTest)
FIXME FIXME FIXME!!
Refactor above function to reduce the complexity and put compare attributes here
Compares Attribute Nodes
|
protected NodeResult |
compareCDATA(XNode xControl,
XNode xTest)
Compares CDATASECTION Nodes.
|
protected Differences |
compareChildNodes(XNode xControl,
XNode xTest)
Compares all the Child Nodes for given Control and Test Nodes recursively.
|
protected NodeResult |
compareComments(XNode xControl,
XNode xTest)
Compares Comment Nodes.
|
protected NodeResult |
compareDocumentType(XNode xControl,
XNode xTest)
Compares DocumentType Node.
|
protected NodeResult |
compareElements(XNode xControl,
XNode xTest)
Compares Control and Test Element nodes.
|
protected NodeResult |
compareEntityRefs(XNode xControl,
XNode xTest)
Compares Entity Reference Nodes.
|
protected NodeResult |
compareSimilarNodes(XNode xControl,
XNode xTest,
OrderedMap nodeTracker)
Compares Nodes similar to the ones which are input and returns the one.
|
protected NodeResult |
compareText(XNode xControl,
XNode xTest)
Compares Text Nodes.
|
Node |
getControlNode()
Gets Control Node.
|
Node |
getTestNode()
Gets Test Node.
|
protected boolean |
isIgnoringWhitespace()
Convenience method to check if the whitespace is being ignored.
|
static void |
log(String msg)
Prints msg to System.out.
|
static void |
log(String msg,
Throwable t)
Prints msg and Exception to System.out.
|
void |
overrideDifferenceListener(DifferenceListener listener)
Overrides DifferenceListener.
Method will clear all the DifferenceListeners and put only one DifferenceListener passed as an argument |
void |
setControlNode(Node controlNode)
Sets Control Node.
|
void |
setTestNode(Node testNode)
Sets Test Node.
|
public void addDifferenceListener(DifferenceListener listener)
public void overrideDifferenceListener(DifferenceListener listener)
public void setControlNode(Node controlNode)
public Node getControlNode()
public void setTestNode(Node testNode)
public Node getTestNode()
protected boolean isIgnoringWhitespace()
public Differences compare()
public Differences compare(Node controlNode, Node testNode)
control
- the control Nodetest
- the test NodeDifferences
protected NodeResult compareSimilarNodes(XNode xControl, XNode xTest, OrderedMap nodeTracker)
control
- the control Nodetest
- the test NodenodeTracker
- the OrderedMap which contains control Nodes already visited as keys and
all the matching test Nodes as the valuesNodeResult
protected NodeResult compareDocumentType(XNode xControl, XNode xTest)
control
- the control DOCTYPE Nodetest
- the test DOCTYPE NodeNodeResult
protected NodeResult compareComments(XNode xControl, XNode xTest)
control
- the control Comment Nodetest
- the test Comment NodeNodeResult
protected NodeResult compareCDATA(XNode xControl, XNode xTest)
control
- the control CDATA Nodetest
- the test CDATA NodeNodeResult
protected NodeResult compareEntityRefs(XNode xControl, XNode xTest)
control
- the control EntityRef Nodetest
- the test EntityRef NodeNodeResult
protected NodeResult compareText(XNode xControl, XNode xTest)
control
- the control Text Nodetest
- the test Text NodeNodeResult
protected NodeResult compareElements(XNode xControl, XNode xTest)
control
- the control Element Nodetest
- the test Element NodeNodeResult
protected NodeResult compareAttributes(XNode xControl, XNode xTest)
protected Differences compareChildNodes(XNode xControl, XNode xTest)
controlNode
- the control NodetestNode
- the test NodeDifferences
public static void log(String msg)
Copyright © 2015. All rights reserved.