[jbosstools-commits] JBoss Tools SVN: r43425 - in trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test: explorer and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 5 13:40:53 EDT 2012


Author: jjankovi
Date: 2012-09-05 13:40:53 -0400 (Wed, 05 Sep 2012)
New Revision: 43425

Modified:
   trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java
   trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java
   trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java
Log:
fixing archive bot tests - should be stable now

Modified: trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java
===================================================================
--- trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java	2012-09-05 17:20:50 UTC (rev 43424)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java	2012-09-05 17:40:53 UTC (rev 43425)
@@ -35,7 +35,6 @@
 
 	protected ProjectArchivesView openProjectArchivesView() {
 		ProjectArchivesView view = new ProjectArchivesView();
-		view.show();
 		return view;
 	}
 	

Modified: trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java
===================================================================
--- trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java	2012-09-05 17:20:50 UTC (rev 43424)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java	2012-09-05 17:40:53 UTC (rev 43425)
@@ -12,7 +12,6 @@
 
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.jboss.tools.archives.ui.bot.test.context.ArchiveContextMenu;
 import org.jboss.tools.archives.ui.bot.test.dialog.ArchivePublishSettingsDialog;
@@ -22,6 +21,7 @@
 import org.jboss.tools.archives.ui.bot.test.dialog.NewJarDialog;
 import org.jboss.tools.archives.ui.bot.test.dialog.UserLibrariesFilesetDialog;
 import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.ui.bot.ext.condition.TreeItemContainsNode;
 import org.jboss.tools.ui.bot.ext.helper.TreeHelper;
 import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
 
@@ -43,62 +43,54 @@
 	}
 	
 	public NewJarDialog createNewJarArchive() {
-		SWTBotTree tree = this.bot().tree();
-		return contextTool.createNewJarArchive(tree, explorer);
+		return contextTool.createNewJarArchive(
+				this.bot().tree(), explorer);
 	}
 	
 	public void buildProjectFull() {
-		SWTBotTree tree = this.bot().tree();
-		contextTool.buildProjectFull(tree, explorer);
+		contextTool.buildProjectFull(
+				this.bot().tree(), explorer);
 	}
 	
 	public void buildArchiveFull(String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		contextTool.buildArchiveFull(tree, treeItem);
+		contextTool.buildArchiveFull(
+				this.bot().tree(), getArchive(archive));
 	}
 	
 	public FolderCreatingDialog createFolder(String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		return contextTool.createFolder(tree, treeItem);
+		return contextTool.createFolder(
+				this.bot().tree(), getArchive(archive));
 	}
 	
 	public FilesetDialog createFileset(String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		return contextTool.createFileset(tree, treeItem);
+		return contextTool.createFileset(
+				this.bot().tree(), getArchive(archive));
 	}
 	
 	public UserLibrariesFilesetDialog createUserLibraryFileset(String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		return contextTool.createUserLibraryFileset(tree, treeItem);
+		return contextTool.createUserLibraryFileset(
+				this.bot().tree(), getArchive(archive));
 	}
 	
 	public EditArchiveDialog editArchive(String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		return contextTool.editArchive(tree, treeItem);
+		return contextTool.editArchive(
+				this.bot().tree(), getArchive(archive));
 	}
 	
 	public void deleteArchive(boolean withContextMenu, String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		contextTool.deleteArchive(tree, treeItem, withContextMenu);
+		contextTool.deleteArchive(
+				this.bot().tree(), getArchive(archive), withContextMenu);
 	}
 	
 	public ArchivePublishSettingsDialog publishToServer(
 			boolean returnDialog, String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		return contextTool.publishToServer(tree, treeItem, returnDialog);
+		return contextTool.publishToServer(
+				this.bot().tree(), getArchive(archive), returnDialog);
 	}
 	
 	public ArchivePublishSettingsDialog editPublishSettings(String archive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = explorer.getNode(archive);
-		return contextTool.editPublishSettings(tree, treeItem);
+		return contextTool.editPublishSettings(
+				this.bot().tree(), getArchive(archive));
 	}
 	
 	public boolean itemExists(String... path) {
@@ -115,6 +107,11 @@
 		}
 	}
 	
+	private SWTBotTreeItem getArchive(String archive) {
+		bot.waitUntil(new TreeItemContainsNode(explorer, archive));
+		return explorer.getNode(archive);
+	}
+	
 	private SWTBot bot() {
 		return bot;
 	}

Modified: trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java
===================================================================
--- trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java	2012-09-05 17:20:50 UTC (rev 43424)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java	2012-09-05 17:40:53 UTC (rev 43425)
@@ -24,6 +24,7 @@
 import org.jboss.tools.archives.ui.bot.test.dialog.FolderCreatingDialog;
 import org.jboss.tools.archives.ui.bot.test.dialog.NewJarDialog;
 import org.jboss.tools.archives.ui.bot.test.dialog.UserLibrariesFilesetDialog;
+import org.jboss.tools.ui.bot.ext.condition.TreeContainsNode;
 import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.JBossToolsProjectarchives;
 import org.jboss.tools.ui.bot.ext.helper.TreeHelper;
 import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -38,77 +39,71 @@
 
 	private ArchiveContextMenu contextTool = null;
 	
+	private SWTBotTree viewTree = null;
+	
 	public ProjectArchivesView() {
 		super();
 		viewObject = JBossToolsProjectarchives.LABEL;
+		show();
 		contextTool = new ArchiveContextMenu();
+		viewTree = this.bot().tree();
 	}
 	
 	public void buildArchiveNode(String... path) {
+		show();
 		open.selectTreeNode(this.bot(), path);
-		show();
 		toolbarButton(IDELabel.ArchivesView.BUTTON_BUILD_ARCHIVE_NODE).click();
 	}
 	
 	public NewJarDialog createNewJarArchive(String project) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = tree.getTreeItem(project);
-		return contextTool.createNewJarArchive(tree, treeItem);
+		return contextTool.createNewJarArchive(
+				viewTree, getArchive(project));
 	}
 	
 	public void buildProjectFull(String project) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = tree.getTreeItem(project);
-		contextTool.buildProjectFull(tree, treeItem);
+		contextTool.buildProjectFull(
+				viewTree, getArchive(project));
 	}
 	
 	public void buildArchiveFull(String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		contextTool.buildArchiveFull(tree, treeItem);
+		contextTool.buildArchiveFull(
+				viewTree, getArchive(pathToArchive));
 	}
 	
 	public FolderCreatingDialog createFolder(String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		return contextTool.createFolder(tree, treeItem);
+		return contextTool.createFolder(
+				viewTree, getArchive(pathToArchive));
 	}
 	
 	public FilesetDialog createFileset(String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		return contextTool.createFileset(tree, treeItem);
+		return contextTool.createFileset(
+				viewTree, getArchive(pathToArchive));
 	}
 	
 	public UserLibrariesFilesetDialog createUserLibraryFileset(String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		return contextTool.createUserLibraryFileset(tree, treeItem);
+		return contextTool.createUserLibraryFileset(
+				viewTree, getArchive(pathToArchive));
 	}
 	
 	public EditArchiveDialog editArchive(String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		return contextTool.editArchive(tree, treeItem);
+		return contextTool.editArchive(
+				viewTree, getArchive(pathToArchive));
 	}
 	
 	public void deleteArchive(boolean withContextMenu, String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		contextTool.deleteArchive(tree, treeItem, withContextMenu);
+		contextTool.deleteArchive(
+				viewTree, getArchive(pathToArchive), withContextMenu);
 	}
 	
 	public ArchivePublishSettingsDialog publishToServer(boolean returnDialog,
 			String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		return contextTool.publishToServer(tree, treeItem, returnDialog);
+		return contextTool.publishToServer(
+				viewTree, getArchive(pathToArchive), returnDialog);
 	}
 	
 	public ArchivePublishSettingsDialog editPublishSettings(String... pathToArchive) {
-		SWTBotTree tree = this.bot().tree();
-		SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
-		return contextTool.editPublishSettings(tree, treeItem);
+		return contextTool.editPublishSettings(
+				viewTree, getArchive(pathToArchive));
 	}
 	
 	public boolean itemExists(String... path) {
@@ -121,6 +116,11 @@
 		}
 	}
 	
+	private SWTBotTreeItem getArchive(String... pathToArchive) {
+		bot.waitUntil(new TreeContainsNode(viewTree, pathToArchive));
+		return TreeHelper.expandNode(this.bot(), pathToArchive);
+	}
+	
 	private SWTBotToolbarButton toolbarButton(String toolbarToolTip) {
 		List<SWTBotToolbarButton> toolbarButtons = getToolbarButtons();
 		for (SWTBotToolbarButton button : toolbarButtons) {



More information about the jbosstools-commits mailing list