当前位置: 首页>>代码示例>>Java>>正文


Java Difference.getControlNodeDetail方法代码示例

本文整理汇总了Java中org.custommonkey.xmlunit.Difference.getControlNodeDetail方法的典型用法代码示例。如果您正苦于以下问题:Java Difference.getControlNodeDetail方法的具体用法?Java Difference.getControlNodeDetail怎么用?Java Difference.getControlNodeDetail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.custommonkey.xmlunit.Difference的用法示例。


在下文中一共展示了Difference.getControlNodeDetail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: differenceFound

import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
@Override
public int differenceFound(Difference difference) {
	if (difference.getControlNodeDetail() == null
	        || difference.getControlNodeDetail().getNode() == null
	        || difference.getTestNodeDetail() == null
	        || difference.getTestNodeDetail().getNode() == null) {
		return RETURN_ACCEPT_DIFFERENCE;
	}
	if (ignoreAttributes.contains(difference.getTestNodeDetail().getNode()
	        .getNodeName())
	        || ignoreAttributes.contains(difference.getControlNodeDetail()
	                .getNode().getNodeName())) {
		return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
	}
	return RETURN_ACCEPT_DIFFERENCE;
}
 
开发者ID:aminmf,项目名称:crawljax,代码行数:17,代码来源:DomDifferenceListener.java

示例2: differentTextNotInScript

import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
/**
 * Checks this heuristic: if a modified text is not in a script, consider it a false difference.
 * This difference was introduced after finding an injection on the content of an existing script.
 * Most of "modified text" differences are harmless and occur on span elements
 */
static boolean differentTextNotInScript(Difference difference) {
  if (difference.getId() == 14) {
    NodeDetail controlNode = difference.getControlNodeDetail();
    NodeDetail testNode = difference.getTestNodeDetail();
    String parentName = "script";

    return checkNodeNotInParent(controlNode, parentName)
        || checkNodeNotInParent(testNode, parentName);
  }

  return false;
}
 
开发者ID:google,项目名称:zarathustra,代码行数:18,代码来源:Heuristics.java

示例3: onBlacklistedElement

import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
/**
 * Checks this heuristic: if a keyword that usually appears alongside a false difference is found
 * as the name (value) of an added element or as the last element in the xpath, the difference is
 * handled as false. This happens in particular with formatting elements.
 */
static boolean onBlacklistedElement(Difference difference) {
  NodeDetail controlNode = difference.getControlNodeDetail();
  NodeDetail testNode = difference.getTestNodeDetail();

  String[] blacklistedKeywords =
      {"style", "class", "width", "height", "sizset", "sizcache", "alt"};

  return checkBlacklistedElement(controlNode, blacklistedKeywords)
      || checkBlacklistedElement(testNode, blacklistedKeywords);
}
 
开发者ID:google,项目名称:zarathustra,代码行数:16,代码来源:Heuristics.java

示例4: dump

import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
@Override
public void dump (int id,
                  Difference difference)
{
    print(String.format("%4d ", id));
    print(difference.isRecoverable() ? "REC " : "    ");
    println(difference.toString());

    NodeDetail controlDetail = difference.getControlNodeDetail();
    Node controlNode = controlDetail.getNode();
    String controlValue = stringOf(controlNode);

    if (controlValue != null) {
        println("             ctrl"
                + PositionalXMLReader.getRef(controlNode)
                + " " + controlValue);
    }

    NodeDetail testDetail = difference.getTestNodeDetail();
    Node testNode = testDetail.getNode();
    String testValue = stringOf(testNode);

    if (testValue != null) {
        println("             test"
                + PositionalXMLReader.getRef(testNode)
                + " " + testValue);
    }
}
 
开发者ID:jlpoolen,项目名称:libreveris,代码行数:29,代码来源:MusicPrinter.java

示例5: isCausedByIgnorableAttributeValue

import org.custommonkey.xmlunit.Difference; //导入方法依赖的package包/类
/**
 * Server renderer removes all attributes with no values, client renderer doesn't always do this -> 
 * ignore missing attributes if they don't have a value.
 * Also ignores missing transform attributes, when editor generates a "transform='translate(0)'"
 * @param difference
 * @return
 */
protected boolean isCausedByIgnorableAttributeValue(Difference difference) {
	if (difference.getId() == DifferenceConstants.ATTR_NAME_NOT_FOUND_ID) {
		//name is the same for both
		NodeDetail detail = difference.getControlNodeDetail();
		XmlDiffDocumentType type;
		if (detail.getValue() == null || detail.getValue().equals(ATTR_NULL)) {
			type = XmlDiffDocumentType.TEST;
			detail = difference.getTestNodeDetail();
		} else {
			type = XmlDiffDocumentType.CONTROL;
			detail = difference.getControlNodeDetail();
		}
		
		String attrName = detail.getValue();
		if (attrName != null) {
			attrName = helper.addNamespacePrefixToAttribute(attrName, detail.getNode());
			Node attrNode = detail.getNode().getAttributes().getNamedItem(attrName);
			String attrValue = (attrNode == null)? null : attrNode.getNodeValue();
			if (canAttributeBeIgnored(attrName, attrValue)) {
				Node node = helper.getDocumentNode(difference, type, false);
                   getAttributeSetForNode(node, ignoredAttributesMap).add(
                           attrName);
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:bpmn-miwg,项目名称:bpmn-miwg-tools,代码行数:36,代码来源:AbstractXmlDifferenceListener.java


注:本文中的org.custommonkey.xmlunit.Difference.getControlNodeDetail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。