Author: vpakan(a)redhat.com
Date: 2010-03-18 07:32:31 -0400 (Thu, 18 Mar 2010)
New Revision: 20903
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
Log:
Added displaynsIDOMNode() method for debug purposes
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-03-18
11:30:41 UTC (rev 20902)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2010-03-18
11:32:31 UTC (rev 20903)
@@ -24,7 +24,9 @@
import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -310,7 +312,44 @@
Node testBodyNode = xmlTestDocument.getElementsByTagName("BODY").item(0);
//$NON-NLS-1$
TestDomUtil.compareNodes(visualBodyNode, testBodyNode);
}
-
+ /**
+ * For debug purposes. Displays formatted node
+ * @param node
+ */
+ private void displaynsIDOMNode(nsIDOMNode node) {
+ System.out.println("");
+ System.out.print("<" + node.getNodeName() + " ");
+
+ // compare node's attributes
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ nsIDOMNamedNodeMap modelAttributes = node.getAttributes();
+ for (int i = 0; i < modelAttributes.getLength(); i++) {
+ nsIDOMNode modelAttr = modelAttributes.item(i);
+ System.out.print(modelAttr.getNodeName() + "=" +
modelAttr.getNodeValue() + " ");
+ }
+ }
+ System.out.println(">");
+ if (node.getNodeValue() != null){
+ System.out.println(node.getNodeValue());
+ }
+ // compare children
+ nsIDOMNodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+
+ nsIDOMNode child = children.item(i);
+
+ // leave out empty text nodes in test dom model
+ if ((child.getNodeType() == Node.TEXT_NODE)
+ && ((child.getNodeValue() == null) || (child.getNodeValue().trim()
+ .length() == 0)))
+ continue;
+
+ displaynsIDOMNode(child);
+
+ }
+ System.out.println("<" + node.getNodeName() + "/>");
+ }
+
/**
* Try to close all unnecessary dialogs, that could prevent next tests fails
*/
Show replies by date