Author: ljelinko
Date: 2011-11-22 04:53:40 -0500 (Tue, 22 Nov 2011)
New Revision: 36522
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/WorkspaceFile.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.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:
changed generics and constructor of Matcher
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java 2011-11-22
09:39:01 UTC (rev 36521)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortlet.java 2011-11-22
09:53:40 UTC (rev 36522)
@@ -2,9 +2,10 @@
import static
org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortletProject.PROJECT_NAME;
import static
org.jboss.tools.portlet.ui.bot.test.matcher.problems.ProblemViewMatchersFactory.isNumberOfErrors;
-import static
org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.areInFile;
+import static
org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.containsNodes;
import static
org.jboss.tools.portlet.ui.bot.test.matcher.workspace.WorkspaceMatchersFactory.existsInProject;
+import org.jboss.tools.portlet.ui.bot.test.entity.WorkspaceFile;
import org.jboss.tools.portlet.ui.bot.test.entity.XMLNode;
import org.jboss.tools.portlet.ui.bot.test.task.SWTTask;
import org.jboss.tools.portlet.ui.bot.test.task.wizard.web.jboss.PortletCreationTask;
@@ -37,7 +38,7 @@
doAssertThat(CLASS_FILE, existsInProject(PROJECT_NAME));
doAssertThat("WebContent/WEB-INF/default-object.xml",
existsInProject(PROJECT_NAME));
doAssertThat("WebContent/WEB-INF/portlet-instances.xml",
existsInProject(PROJECT_NAME));
- doAssertThat(nodes(new XMLNode("portlet-app/portlet/portlet-class",
FULL_CLASS_NAME)), areInFile(PROJECT_NAME, "WebContent/WEB-INF/portlet.xml"));
+ doAssertThat(new WorkspaceFile(PROJECT_NAME,
"WebContent/WEB-INF/portlet.xml"), containsNodes(new
XMLNode("portlet-app/portlet/portlet-class", FULL_CLASS_NAME)));
System.out.println("");
}
@@ -48,8 +49,4 @@
task.setClassName(CLASS_NAME);
return task;
}
-
- private XMLNode[] nodes(XMLNode... nodes){
- return nodes;
- }
}
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/WorkspaceFile.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/WorkspaceFile.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/entity/WorkspaceFile.java 2011-11-22
09:53:40 UTC (rev 36522)
@@ -0,0 +1,35 @@
+package org.jboss.tools.portlet.ui.bot.test.entity;
+
+public class WorkspaceFile {
+
+ private String project;
+
+ private String file;
+
+ public WorkspaceFile(String project, String file) {
+ super();
+ this.project = project;
+ this.file = file;
+ }
+
+ public String getProject() {
+ return project;
+ }
+
+ public void setProject(String project) {
+ this.project = project;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ @Override
+ public String toString() {
+ return "Workspace file: " + getProject() + "/" + getFile();
+ }
+}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java 2011-11-22
09:39:01 UTC (rev 36521)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/workspace/WorkspaceMatchersFactory.java 2011-11-22
09:53:40 UTC (rev 36522)
@@ -1,6 +1,9 @@
package org.jboss.tools.portlet.ui.bot.test.matcher.workspace;
+import java.util.Arrays;
+
import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
+import org.jboss.tools.portlet.ui.bot.test.entity.WorkspaceFile;
import org.jboss.tools.portlet.ui.bot.test.entity.XMLNode;
import org.jboss.tools.portlet.ui.bot.test.matcher.SWTMatcher;
import org.jboss.tools.portlet.ui.bot.test.matcher.workspace.file.ExistingFileMatcher;
@@ -30,7 +33,7 @@
return new ProjectFacetsMatcher(facets);
}
- public static SWTMatcher<XMLNode[]> areInFile(String project, String file){
- return new XMLFileNodeContentMatcher(project, file);
+ public static SWTMatcher<WorkspaceFile> containsNodes(XMLNode... nodes){
+ return new XMLFileNodeContentMatcher(Arrays.asList(nodes));
}
}
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
09:39:01 UTC (rev 36521)
+++
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
09:53:40 UTC (rev 36522)
@@ -1,11 +1,13 @@
package org.jboss.tools.portlet.ui.bot.test.matcher.workspace.file.xml;
import java.util.Arrays;
+import java.util.List;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.hamcrest.Description;
+import org.jboss.tools.portlet.ui.bot.test.entity.WorkspaceFile;
import org.jboss.tools.portlet.ui.bot.test.entity.XMLNode;
import org.jboss.tools.portlet.ui.bot.test.matcher.AbstractSWTMatcher;
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
@@ -18,22 +20,19 @@
* @author Lucia Jelinkova
*
*/
-public class XMLFileNodeContentMatcher extends AbstractSWTMatcher<XMLNode[]> {
+public class XMLFileNodeContentMatcher extends AbstractSWTMatcher<WorkspaceFile> {
- private String project;
+ private List<XMLNode> nodes;
- private String file;
-
- public XMLFileNodeContentMatcher(String project, String file) {
+ public XMLFileNodeContentMatcher(List<XMLNode> nodes) {
super();
- this.project = project;
- this.file = file;
+ this.nodes = nodes;
}
@Override
- public boolean matchesSafely(XMLNode[] nodes) {
- String[] filePath = file.split("/");
- SWTBotFactory.getPackageexplorer().openFile(project, filePath);
+ public boolean matchesSafely(WorkspaceFile file) {
+ String[] filePath = file.getFile().split("/");
+ SWTBotFactory.getPackageexplorer().openFile(file.getProject(), filePath);
SWTBotEditorExt editor =
SWTBotFactory.getBot().swtBotEditorExtByTitle(filePath[filePath.length - 1]);
SWTBotTree tree = editor.bot().tree();
@@ -46,10 +45,6 @@
}
private boolean containsNode(SWTBot bot, SWTBotTree tree, XMLNode node) {
- for (String s : getNodePath(node)){
- System.out.println("Path element: " + s);
- }
- System.out.println("Name: " + getNodeName(node));
SWTBotTreeItem item = SWTEclipseExt.getTreeItemOnPathStartsWith(bot, tree, 0,
getNodeName(node), getNodePath(node));
return item.cell(1).contains(node.getContent());
}
@@ -69,7 +64,7 @@
@Override
public void describeTo(Description description) {
- description.appendText("file " + project + "/" + file + "
contains the node(s)");
+ description.appendText("file containing nodes: " + nodes);
}
}
Show replies by date