Author: ljelinko
Date: 2011-11-22 07:06:59 -0500 (Tue, 22 Nov 2011)
New Revision: 36529
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/XMLNode.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/file/xml/XMLFileNodeContentMatcher.java
Log:
added method for splitting sml node path
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/XMLNode.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/XMLNode.java 2011-11-22
12:06:33 UTC (rev 36528)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/XMLNode.java 2011-11-22
12:06:59 UTC (rev 36529)
@@ -3,6 +3,8 @@
public class XMLNode {
+ public static final String NODES_SEPARATOR = "/";
+
private String path;
private String content;
@@ -13,10 +15,18 @@
this.content = content;
}
+ public String getNodeName(){
+ return getPathAsArray()[getPathAsArray().length - 1];
+ }
+
+ public String[] getPathAsArray(){
+ return path.split(NODES_SEPARATOR);
+ }
+
public String getPath() {
return path;
}
-
+
public void setPath(String path) {
this.path = path;
}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/file/xml/XMLFileNodeContentMatcher.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/file/xml/XMLFileNodeContentMatcher.java 2011-11-22
12:06:33 UTC (rev 36528)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/file/xml/XMLFileNodeContentMatcher.java 2011-11-22
12:06:59 UTC (rev 36529)
@@ -44,23 +44,18 @@
}
private boolean containsNode(SWTBot bot, SWTBotTree tree, XMLNode node) {
- SWTBotTreeItem item = SWTEclipseExt.getTreeItemOnPathStartsWith(bot, tree, 0,
getNodeName(node), getNodePath(node));
+ SWTBotTreeItem item = SWTEclipseExt.getTreeItemOnPathStartsWith(bot, tree, 0,
node.getNodeName(), getNodePath(node));
return item.cell(1).contains(node.getContent());
}
private String[] getNodePath(XMLNode node) {
- String[] path = node.getPath().split("/");
+ String[] path = node.getPathAsArray();
if (path.length <= 1){
return new String[0];
}
return Arrays.copyOfRange(path, 0, path.length - 1);
}
- private String getNodeName(XMLNode node) {
- String[] path = node.getPath().split("/");
- return path[path.length - 1];
- }
-
@Override
public void describeTo(Description description) {
description.appendText("file containing nodes: " + nodes);
Show replies by date