本文整理了Java中org.custommonkey.xmlunit.Difference.getId()
方法的一些代码示例,展示了Difference.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Difference.getId()
方法的具体详情如下:
包路径:org.custommonkey.xmlunit.Difference
类名称:Difference
方法名:getId
暂无
代码示例来源:origin: stackoverflow.com
public class IgnoreNamedElementsDifferenceListener implements DifferenceListener {
private Set<String> blackList = new HashSet<String>();
public IgnoreNamedElementsDifferenceListener(String ... elementNames) {
for (String name : elementNames) {
blackList.add(name);
}
}
public int differenceFound(Difference difference) {
if (difference.getId() == DifferenceConstants.TEXT_VALUE_ID) {
if (blackList.contains(difference.getControlNodeDetail().getNode().getParentNode().getNodeName())) {
return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
}
return DifferenceListener.RETURN_ACCEPT_DIFFERENCE;
}
public void skippedComparison(Node node, Node node1) {
}
}
代码示例来源:origin: kiegroup/jbpm
public int differenceFound(Difference diff) {
String nodeName = diff.getTestNodeDetail().getNode().getNodeName();
if( sequenceDoesNotMatter.contains(nodeName)
&& diff.getId() == DifferenceConstants.CHILD_NODELIST_SEQUENCE_ID ) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
logger.info( "! {}", diff.getTestNodeDetail().getNode().getNodeName());
return RETURN_ACCEPT_DIFFERENCE;
}
代码示例来源:origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit
private boolean isIgnoredDifference(Difference difference) {
int differenceId = difference.getId();
for (int i=0; i < IGNORE_VALUES.length; ++i) {
if (differenceId == IGNORE_VALUES[i]) {
return true;
}
}
return false;
}
代码示例来源:origin: stackoverflow.com
public class DifferenceListenerImpl implements DifferenceListener {
@Override
public int differenceFound(Difference d) {
if (d.getId() == DifferenceConstants.ELEMENT_NUM_ATTRIBUTES_ID) {
return RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
}
// handle other difference types here
}
@Override
public void skippedComparison(Node control, Node test) {
// not needed
}
}
代码示例来源:origin: org.xmlunit/xmlunit-legacy
private boolean isIgnoredDifference(Difference difference) {
int differenceId = difference.getId();
for (int i=0; i < IGNORE_VALUES.length; ++i) {
if (differenceId == IGNORE_VALUES[i]) {
return true;
}
}
return false;
}
代码示例来源:origin: stackoverflow.com
public int differenceFound(Difference difference) {
return difference.getId() == DifferenceConstants.CHILD_NODELIST_SEQUENCE_ID
? RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL
: RETURN_ACCEPT_DIFFERENCE;
}
代码示例来源:origin: stackoverflow.com
detDiff.overrideDifferenceListener(new DifferenceListener() {
@Override
public int differenceFound(Difference difference) {
return difference.getId() == DifferenceConstants.CHILD_NODELIST_LENGTH_ID
? RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL
: RETURN_ACCEPT_DIFFERENCE;
}
@Override
public void skippedComparison(Node control, Node test) { }
});
代码示例来源:origin: org.xmlunit/xmlunit-legacy
/**
* Now that Differences can be constructed from prototypes
* we need to be able to compare them to those in DifferenceConstants
*/
public boolean equals(Object other) {
if (other == null) {
return false;
} else if (other instanceof Difference) {
Difference otherDifference = (Difference) other;
return id == otherDifference.getId();
} else {
return false;
}
}
代码示例来源:origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit
/**
* Now that Differences can be constructed from prototypes
* we need to be able to compare them to those in DifferenceConstants
*/
public boolean equals(Object other) {
if (other == null) {
return false;
} else if (other instanceof Difference) {
Difference otherDifference = (Difference) other;
return id == otherDifference.getId();
} else {
return false;
}
}
代码示例来源:origin: highsource/hyperjaxb3
@Override
public int differenceFound(Difference difference) {
if (difference.getId() == DifferenceConstants.NAMESPACE_PREFIX_ID) {
return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
} else {
return super.differenceFound(difference);
}
}
};
代码示例来源:origin: stackoverflow.com
Diff xmlDiff = new Diff(s1, s2);
xmlDiff.overrideElementQualifier(new ElementNameQualifier() {
@Override
protected boolean equalsNamespace(Node control, Node test) {
return true;
}
});
xmlDiff.overrideDifferenceListener(new DifferenceListener() {
@Override
public int differenceFound(Difference diff) {
if (diff.getId() == DifferenceConstants.NAMESPACE_URI_ID) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
return RETURN_ACCEPT_DIFFERENCE;
}
@Override
public void skippedComparison(Node arg0, Node arg1) { }
});
代码示例来源:origin: com.github.albfernandez.richfaces/richfaces-build-resources
public int differenceFound(Difference difference) {
if (DifferenceConstants.TEXT_VALUE_ID == difference.getId()
&& !"script".equalsIgnoreCase(difference.getTestNodeDetail().getNode().getLocalName())) {
return RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
}
return RETURN_ACCEPT_DIFFERENCE;
}
代码示例来源:origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit
/**
* Copy constructor using prototype Difference and
* encountered NodeDetails
*/
protected Difference(Difference prototype, NodeDetail controlNodeDetail,
NodeDetail testNodeDetail) {
this(prototype.getId(), prototype.getDescription(), prototype.isRecoverable());
this.controlNodeDetail = controlNodeDetail;
this.testNodeDetail = testNodeDetail;
}
代码示例来源:origin: org.xmlunit/xmlunit-legacy
/**
* Copy constructor using prototype Difference and
* encountered NodeDetails
*/
protected Difference(Difference prototype, NodeDetail controlNodeDetail,
NodeDetail testNodeDetail) {
this(prototype.getId(), prototype.getDescription(), prototype.isRecoverable());
this.controlNodeDetail = controlNodeDetail;
this.testNodeDetail = testNodeDetail;
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public int differenceFound(Difference diff) {
if (diff.getId() == DifferenceConstants.SCHEMA_LOCATION_ID
|| diff.getId() == DifferenceConstants.NAMESPACE_PREFIX_ID) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
if (diff.getId() == DifferenceConstants.TEXT_VALUE_ID) {
for (NodeDetail detail : ImmutableSet.of(diff.getControlNodeDetail(), diff.getTestNodeDetail())) {
if (detail.getNode().getParentNode().getChildNodes().getLength() < 2
|| !detail.getValue().trim().isEmpty()) {
return RETURN_ACCEPT_DIFFERENCE;
}
}
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
return RETURN_ACCEPT_DIFFERENCE;
}
代码示例来源:origin: apache/jclouds
@Override
public int differenceFound(Difference diff) {
if (diff.getId() == DifferenceConstants.SCHEMA_LOCATION_ID
|| diff.getId() == DifferenceConstants.NAMESPACE_PREFIX_ID) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
if (diff.getId() == DifferenceConstants.TEXT_VALUE_ID) {
for (NodeDetail detail : ImmutableSet.of(diff.getControlNodeDetail(), diff.getTestNodeDetail())) {
if (detail.getNode().getParentNode().getChildNodes().getLength() < 2
|| !detail.getValue().trim().isEmpty()) {
return RETURN_ACCEPT_DIFFERENCE;
}
}
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
return RETURN_ACCEPT_DIFFERENCE;
}
代码示例来源:origin: org.jbpm/jbpm-bpmn2
public int differenceFound(Difference diff) {
String nodeName = diff.getTestNodeDetail().getNode().getNodeName();
if( sequenceDoesNotMatter.contains(nodeName)
&& diff.getId() == DifferenceConstants.CHILD_NODELIST_SEQUENCE_ID ) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
logger.info( "! {}", diff.getTestNodeDetail().getNode().getNodeName());
return RETURN_ACCEPT_DIFFERENCE;
}
代码示例来源:origin: googleads/googleads-java-lib
@Override
public int differenceFound(Difference difference) {
switch (difference.getId()) {
case DifferenceConstants.NAMESPACE_URI_ID:
return namespaceDifferenceFound(difference);
case DifferenceConstants.ELEMENT_NUM_ATTRIBUTES_ID:
case DifferenceConstants.ATTR_NAME_NOT_FOUND_ID:
return attributeDifferenceFound(difference);
default:
return DifferenceListener.RETURN_ACCEPT_DIFFERENCE;
}
}
代码示例来源:origin: org.xmlunit/xmlunit-legacy
/**
* Delegates to the nested DifferenceListener unless the
* Difference is of type {@link DifferenceConstants#ATTR_VALUE_ID
* ATTR_VALUE_ID}, {@link DifferenceConstants#CDATA_VALUE_ID
* CDATA_VALUE_ID}, {@link DifferenceConstants#COMMENT_VALUE_ID
* COMMENT_VALUE_ID} or {@link DifferenceConstants#TEXT_VALUE_ID
* TEXT_VALUE_ID} - for those special differences {@link
* #attributeDifference attributeDifference}, {@link
* #cdataDifference cdataDifference}, {@link #commentDifference
* commentDifference} or {@link #textDifference textDifference}
* are invoked respectively.
*/
public int differenceFound(Difference difference) {
switch (difference.getId()) {
case DifferenceConstants.ATTR_VALUE_ID:
return attributeDifference(difference);
case DifferenceConstants.CDATA_VALUE_ID:
return cdataDifference(difference);
case DifferenceConstants.COMMENT_VALUE_ID:
return commentDifference(difference);
case DifferenceConstants.TEXT_VALUE_ID:
return textDifference(difference);
}
return delegateTo.differenceFound(difference);
}
代码示例来源:origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit
/**
* Delegates to the nested DifferenceListener unless the
* Difference is of type {@link DifferenceConstants#ATTR_VALUE_ID
* ATTR_VALUE_ID}, {@link DifferenceConstants#CDATA_VALUE_ID
* CDATA_VALUE_ID}, {@link DifferenceConstants#COMMENT_VALUE_ID
* COMMENT_VALUE_ID} or {@link DifferenceConstants#TEXT_VALUE_ID
* TEXT_VALUE_ID} - for those special differences {@link
* #attributeDifference attributeDifference}, {@link
* #cdataDifference cdataDifference}, {@link #commentDifference
* commentDifference} or {@link #textDifference textDifference}
* are invoked respectively.
*/
public int differenceFound(Difference difference) {
switch (difference.getId()) {
case DifferenceConstants.ATTR_VALUE_ID:
return attributeDifference(difference);
case DifferenceConstants.CDATA_VALUE_ID:
return cdataDifference(difference);
case DifferenceConstants.COMMENT_VALUE_ID:
return commentDifference(difference);
case DifferenceConstants.TEXT_VALUE_ID:
return textDifference(difference);
}
return delegateTo.differenceFound(difference);
}
内容来源于网络,如有侵权,请联系作者删除!