[jbosstools-commits] JBoss Tools SVN: r43955 - in trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test: explorer and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Sep 24 05:56:10 EDT 2012
Author: jjankovi
Date: 2012-09-24 05:56:10 -0400 (Mon, 24 Sep 2012)
New Revision: 43955
Added:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesSupportTest.java
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java
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
Log:
new archive swtbot test (JBQA-6991) implemented
Modified: trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java
===================================================================
--- trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java 2012-09-24 09:38:55 UTC (rev 43954)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java 2012-09-24 09:56:10 UTC (rev 43955)
@@ -26,6 +26,7 @@
FolderTest.class,
FilesetTest.class,
UserLibrariesFilesetTest.class,
+ ArchivesSupportTest.class,
BuildingArchiveNode.class,
BuildingProjectTest.class,
BuildingArchiveTest.class,
Added: trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesSupportTest.java
===================================================================
--- trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesSupportTest.java (rev 0)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesSupportTest.java 2012-09-24 09:56:10 UTC (rev 43955)
@@ -0,0 +1,60 @@
+package org.jboss.tools.archives.ui.bot.test;
+
+import org.jboss.tools.archives.ui.bot.test.explorer.ProjectArchivesExplorer;
+import org.jboss.tools.ui.bot.ext.entity.JavaProjectEntity;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class ArchivesSupportTest extends ArchivesTestBase {
+
+ private static final String project = "prj";
+
+ @BeforeClass
+ public static void setup() {
+ JavaProjectEntity jpe = new JavaProjectEntity();
+ jpe.setProjectName(project);
+ eclipse.createJavaProject(jpe);
+ }
+
+ @Test
+ public void testAddArchiveSupport() {
+
+ addArchivesSupport(project);
+
+ assertTrue("Project archives support was not set on project '" + project + "'",
+ archiveExplorerExists(project));
+ }
+
+ @Test
+ public void testRemoveArchiveSupport() {
+
+ removeArchivesSupport(project);
+
+ assertFalse("Project archives support is still set on project '" + project + "'",
+ archiveExplorerExists(project));
+
+ }
+
+ @Test
+ public void testReAddingArchiveSupport() {
+
+ String project = "pr2";
+
+ /* prepare project with existing archive in it */
+ importProjectWithoutRuntime(project);
+ ProjectArchivesExplorer explorer = explorerForProject(project);
+ assertItemExistsInExplorer(explorer, project + ".jar" + " [/" + project + "]");
+
+ /* re-add archive support into project */
+ removeArchivesSupport(project);
+ addArchivesSupport(project);
+
+ assertItemExistsInExplorer(explorer, project + ".jar" + " [/" + project + "]");
+ }
+
+}
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-24 09:38:55 UTC (rev 43954)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java 2012-09-24 09:56:10 UTC (rev 43955)
@@ -10,14 +10,22 @@
******************************************************************************/
package org.jboss.tools.archives.ui.bot.test;
+import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.archives.ui.bot.test.explorer.ProjectArchivesExplorer;
import org.jboss.tools.archives.ui.bot.test.view.ProjectArchivesView;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.condition.ProgressInformationShellIsActiveCondition;
+import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.helper.ImportHelper;
+import org.jboss.tools.ui.bot.ext.helper.TreeHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.ErrorLogView;
import org.jboss.tools.ui.bot.ext.view.ServersView;
import org.junit.runner.RunWith;
@@ -148,6 +156,41 @@
ImportHelper.importProject(projectLocation, dir, Activator.PLUGIN_ID);
}
+ protected void addArchivesSupport(String projectName) {
+ addRemoveArchivesSupport(projectName, true);
+ }
+
+ protected void removeArchivesSupport(String projectName) {
+ addRemoveArchivesSupport(projectName, false);
+ }
+
+ protected boolean archiveExplorerExists(String projectName) {
+ SWTBot bot = projectExplorer.bot();
+ try {
+ TreeHelper.expandNode(bot, projectName, "Project Archives");
+ return true;
+ } catch (WidgetNotFoundException exc) {
+ return false;
+ }
+ }
+
+ private void addRemoveArchivesSupport(String projectName, boolean add) {
+ projectExplorer.selectProject(projectName);
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem item = tree.getTreeItem(projectName);
+ item.expand();
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
+ SWTBotMenu menu = new SWTBotMenu(
+ ContextMenuHelper.getContextMenu(
+ tree, IDELabel.Menu.PACKAGE_EXPLORER_CONFIGURE, false));
+ if (add) {
+ menu.menu(IDELabel.Menu.ADD_ARCHIVE_SUPPORT).click();
+ } else {
+ menu.menu(IDELabel.Menu.REMOVE_ARCHIVE_SUPPORT).click();
+ }
+ bot.waitWhile(new ProgressInformationShellIsActiveCondition(), TaskDuration.LONG.getTimeout());
+ }
+
private int countOfArchivesErrors() {
ErrorLogView errorLog = new ErrorLogView();
int archivesErrorsCount = 0;
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-24 09:38:55 UTC (rev 43954)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java 2012-09-24 09:56:10 UTC (rev 43955)
@@ -11,7 +11,6 @@
package org.jboss.tools.archives.ui.bot.test.explorer;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
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;
@@ -103,7 +102,7 @@
ti = ti.getNode(pathItem);
}
return true;
- } catch (WidgetNotFoundException exc) {
+ } catch (Exception exc) {
return false;
}
}
More information about the jbosstools-commits
mailing list