public final class FieldDiffHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FACET_ELEMENT |
static String |
NAME_ATTRIBUTE |
static String |
SCHEMA_ELEMENT |
static String |
TYPE_ATTRIBUTE |
| Constructor and Description |
|---|
FieldDiffHelper() |
| Modifier and Type | Method and Description |
|---|---|
static PropertyDiff |
applyPropertyHierarchyToDiff(PropertyDiff firstPropertyDiff,
List<PropertyHierarchyNode> propertyHierarchy)
Sets the property diff hierarchy.
|
static boolean |
computeFieldDiff(DocumentDiff docDiff,
org.custommonkey.xmlunit.NodeDetail controlNodeDetail,
org.custommonkey.xmlunit.NodeDetail testNodeDetail,
int fieldDifferenceCount,
org.custommonkey.xmlunit.Difference difference)
Computes a field diff.
|
static String |
getPropertyType(Node node)
Gets the node property type.
|
protected static void |
setContentSubPropertyDiff(ContentPropertyDiff fieldDiff,
String subPropertyName,
String leftSubPropertyValue,
String rightSubPropertyValue) |
public static final String FACET_ELEMENT
public static final String SCHEMA_ELEMENT
public static final String NAME_ATTRIBUTE
public static final String TYPE_ATTRIBUTE
public FieldDiffHelper()
public static boolean computeFieldDiff(DocumentDiff docDiff, org.custommonkey.xmlunit.NodeDetail controlNodeDetail, org.custommonkey.xmlunit.NodeDetail testNodeDetail, int fieldDifferenceCount, org.custommonkey.xmlunit.Difference difference)
First gets all needed elements to compute the field diff:
Every time we encounter a list, a complex or a content node going up in the DOM tree
from the property node to the prefixed field node, we add it to the property
hierarchy.
If it is a list item node, we set its index in the hierarchy.
If it is a complex item node, we set its name in the hierarchy.
If it is a content item node (ie. "encoding", "mime-type", "filename" or "digest"),
we set its name in the hierarchy.
Example: complex list
The "true" property's hierarchy is:
[{list,"0"},{complex, "complexBoolean"}]
The "jack" property's hierarchy is:
[{list,"1"},{complex, "complexString"}]
The "UTF-8" property's hierarchy is:
[{list,"0"},{complex, "complexString"},{content, "encoding"}]
joe
true
UTF-8
text/plain
My_file.txt
5dafdabf966043c8c8cef20011e939a2
jack
false
docDiff - the doc diffcontrolNodeDetail - the control node detailtestNodeDetail - the test node detailfieldDifferenceCount - the field difference countadddifference - the differencepublic static String getPropertyType(Node node)
node - the nodepublic static PropertyDiff applyPropertyHierarchyToDiff(PropertyDiff firstPropertyDiff, List<PropertyHierarchyNode> propertyHierarchy)
firstPropertyDiff - the first property diffpropertyHierarchy - the property hierarchyprotected static void setContentSubPropertyDiff(ContentPropertyDiff fieldDiff, String subPropertyName, String leftSubPropertyValue, String rightSubPropertyValue)
Copyright © 2019 Nuxeo. All rights reserved.