Author: vpakan(a)redhat.com
Date: 2009-12-16 13:32:41 -0500 (Wed, 16 Dec 2009)
New Revision: 19367
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
Some logic moved to common org.jboss.tools.iu.bot.ext plugin
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java 2009-12-16
17:56:27 UTC (rev 19366)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java 2009-12-16
18:32:41 UTC (rev 19367)
@@ -19,6 +19,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.helper.WidgetFinderHelper;
@@ -33,27 +34,10 @@
public class AddRemoveJSFCapabilitiesTest extends JSFAutoTestCase {
- private static final String WEB_PROJECT_JBT_JSF_POPUP_MENU = "JBoss Tools
JSF";
- private static final String PACKAGE_EXPLORER_JBT_POPUP_MENU = "JBoss Tools";
- private static final String PACKAGE_EXPLORER_CONFIGURE_POPUP_MENU =
"Configure";
- private static final String ADD_JSF_CAPABILITIES_POPUP_MENU = "Add JSF
Capabilities...";
- private static final String CLOSE_PROJECT_POPUP_MENU = "Clo&se Project";
- private static final String OPEN_PROJECT_POPUP_MENU = "Op&en Project";
- private static final String DELETE_PROJECT_POPUP_MENU = "Delete";
- private static final String JBDS_REMOVE_JSF_CAPABILITIES_POPUP_MENU = "Remove Red
Hat Capabilities";
- private static final String JBT_REMOVE_JSF_CAPABILITIES_POPUP_MENU = "Remove JSF
Capabilities";
-
private MenuItem miRunOnServer = null;
public void testAddRemoveJSFCapabilities() {
- boolean jbdsIsRunning = false;
- // Check out if JBoss Developer Studio Is Running
- try{
- bot.menu(IDELabel.Menu.HELP).menu(IDELabel.Menu.ABOUT_JBOSS_DEVELOPER_STUDIO);
- jbdsIsRunning = true;
- }catch (WidgetNotFoundException wnfe){
- // do nothing
- }
+ boolean jbdsIsRunning = SWTEclipseExt.isJBDSRun(bot);
removeJSFCapabilities(jbdsIsRunning);
addJSFCapabilities();
// Test add/remove JSF capabilities after project is closed and reopened
@@ -229,7 +213,7 @@
ContextMenuHelper.prepareTreeItemForContextMenu(tree,
tree.getTreeItem(JBT_TEST_PROJECT_NAME));
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
- DELETE_PROJECT_POPUP_MENU, false)).click();
+ IDELabel.Menu.DELETE, false)).click();
bot.shell("Delete Resources").activate();
bot.button(WidgetVariables.OK_BUTTON).click();
@@ -256,12 +240,12 @@
if (jbdsIsRunning){
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
- JBDS_REMOVE_JSF_CAPABILITIES_POPUP_MENU, true)).click();
+ IDELabel.Menu.JBDS_REMOVE_JSF_CAPABILITIES, true)).click();
}
else{
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
- WEB_PROJECT_JBT_JSF_POPUP_MENU, false)).menu(
- JBT_REMOVE_JSF_CAPABILITIES_POPUP_MENU).click();
+ IDELabel.Menu.WEB_PROJECT_JBT_JSF, false)).menu(
+ IDELabel.Menu.JBT_REMOVE_JSF_CAPABILITIES).click();
}
@@ -305,13 +289,13 @@
try{
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
- PACKAGE_EXPLORER_JBT_POPUP_MENU, false)).menu(
- ADD_JSF_CAPABILITIES_POPUP_MENU).click();
+ IDELabel.Menu.PACKAGE_EXPLORER_JBT, false)).menu(
+ IDELabel.Menu.ADD_JSF_CAPABILITIES).click();
} catch (WidgetNotFoundException wnfe){
// From 3.1.0.RC1 version this menu is moved to Configure submenu
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
- PACKAGE_EXPLORER_CONFIGURE_POPUP_MENU, false)).menu(
- ADD_JSF_CAPABILITIES_POPUP_MENU).click();
+ IDELabel.Menu.PACKAGE_EXPLORER_CONFIGURE, false)).menu(
+ IDELabel.Menu.ADD_JSF_CAPABILITIES).click();
}
bot.shell("Add JSF Capabilities").activate();
@@ -366,12 +350,12 @@
tree.getTreeItem(JBT_TEST_PROJECT_NAME));
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
- CLOSE_PROJECT_POPUP_MENU, false)).click();
+ IDELabel.Menu.CLOSE_PROJECT, false)).click();
delay();
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
- OPEN_PROJECT_POPUP_MENU, false)).click();
+ IDELabel.Menu.OPEN_PROJECT, false)).click();
delay();
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-16
17:56:27 UTC (rev 19366)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2009-12-16
18:32:41 UTC (rev 19367)
@@ -18,10 +18,12 @@
import org.apache.log4j.Logger;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.hamcrest.Matcher;
@@ -39,11 +41,11 @@
*/
public class SWTEclipseExt {
- SWTBotExt bot;
+ SWTWorkbenchBot bot;
SWTUtilExt util;
Logger log = Logger.getLogger(SWTEclipseExt.class);
- public SWTEclipseExt(SWTBotExt bot) {
+ public SWTEclipseExt(SWTWorkbenchBot bot) {
this.bot = bot;
util = new SWTUtilExt(bot);
}
@@ -311,4 +313,30 @@
if (save)
editor.save();
}
+ /**
+ * Check if JBoss Developer Studio Is Running
+ * Dynamic version of isJBDSRun Method
+ * @return
+ */
+ public boolean isJBDSRun (){
+ return SWTEclipseExt.isJBDSRun(bot);
+ }
+ /**
+ * Check if JBoss Developer Studio Is Running
+ * @param bot
+ * @return
+ */
+ public static boolean isJBDSRun (SWTWorkbenchBot bot){
+ boolean jbdsIsRunning = false;
+ try{
+ bot.menu(IDELabel.Menu.HELP).menu(IDELabel.Menu.ABOUT_JBOSS_DEVELOPER_STUDIO);
+ jbdsIsRunning = true;
+ }catch (WidgetNotFoundException wnfe){
+ // do nothing
+ }
+
+ return jbdsIsRunning;
+
+ }
+
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-16
17:56:27 UTC (rev 19366)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-16
18:32:41 UTC (rev 19367)
@@ -43,6 +43,16 @@
public static final String REMOVE = "Remove";
public static final String IMPORT = "Import...";
public static final String RUN_AS = "Run As";
+ public static final String WEB_PROJECT_JBT_JSF = "JBoss Tools JSF";
+ public static final String PACKAGE_EXPLORER_JBT = "JBoss Tools";
+ public static final String PACKAGE_EXPLORER_CONFIGURE = "Configure";
+ public static final String ADD_JSF_CAPABILITIES = "Add JSF Capabilities...";
+ public static final String CLOSE_PROJECT = "Close Project";
+ public static final String OPEN_PROJECT = "Open Project";
+ public static final String DELETE = "Delete";
+ public static final String JBDS_REMOVE_JSF_CAPABILITIES = "Remove Red Hat
Capabilities";
+ public static final String JBT_REMOVE_JSF_CAPABILITIES = "Remove JSF
Capabilities";
+
}
public class Button {