Author: vpakan(a)redhat.com
Date: 2010-01-18 14:29:45 -0500 (Mon, 18 Jan 2010)
New Revision: 19796
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/JobName.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/ImportStrutsProjectTest.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameStrutsConfigXmlFile.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameTldFile.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RunStrutsProjectOnServer.java
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/SWTJBTExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java
Log:
Added new SWTBot Struts Tests together with some SWTBot extensions.
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 2010-01-18
19:26:19 UTC (rev 19795)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -11,9 +11,10 @@
package org.jboss.tools.jsf.ui.bot.test.smoke;
+import static org.jboss.tools.ui.bot.ext.SWTTestExt.eclipse;
+
import java.io.File;
-import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
@@ -34,9 +35,11 @@
*/
public class AddRemoveJSFCapabilitiesTest extends JSFAutoTestCase {
-
- private MenuItem miRunOnServer = null;
+ private SWTJBTExt swtJbtExt = null;
+ public AddRemoveJSFCapabilitiesTest(){
+ swtJbtExt = new SWTJBTExt(bot);
+ }
public void testAddRemoveJSFCapabilities() {
boolean jbdsIsRunning = SWTJBTExt.isJBDSRun(bot);
removeJSFCapabilities(jbdsIsRunning);
@@ -63,8 +66,7 @@
}
if (parts.length > index + 1){
- String webXmlFileLocation = parts[index + 1] + File.separator
- + JBT_TEST_PROJECT_NAME + File.separator
+ String webXmlFileLocation = SWTUtilExt.getTestPluginLocation(JBT_TEST_PROJECT_NAME)
+ File.separator
+ "WebContent" + File.separator
+ "WEB-INF" + File.separator
+ "web.xml";
@@ -78,79 +80,17 @@
bot.shell(IDELabel.Shell.IMPORT_JSF_PROJECT).activate();
bot.textWithLabel("web.xml Location*").setText(webXmlFileLocation);
-
bot.button(WidgetVariables.NEXT_BUTTON).click();
- // Check if there is defined Application Server if not create one
- if (!SWTJBTExt.isServerDefinedInWebWizardPage(bot)){
- // Specify Application Server for Deployment
- bot.button(WidgetVariables.NEW_BUTTON, 1).click();
- bot.shell("New Server").activate();
- bot.tree().expandNode("JBoss Enterprise Middleware")
- .select("JBoss Enterprise Application Platform 4.3");
- bot.button(WidgetVariables.FINISH_BUTTON).click();
- // Server Jobs has different labels now
- }
- delay();
- // Finish Import
- bot.button(WidgetVariables.FINISH_BUTTON).click();
- bot.shell("Warning").activate();
- bot.button(WidgetVariables.CONTINUE_BUTTON).click();
-
- waitForBlockingJobsAcomplished(BUILDING_WS);
+ SWTJBTExt.addServerToServerViewOnWizardPage(bot,
IDELabel.ServerGroup.JBOSS_EAP_4_3, IDELabel.ServerType.JBOSS_EAP_4_3);
+ bot.sleep(1000L);
+ bot.button(IDELabel.Button.FINISH).click();
+ eclipse.closeWarningWindowIfOpened(true);
+ eclipse.closeOpenAssociatedPerspectiveShellIfOpened(false);
// Start Application Server
- SWTJBTExt.startApplicationServer(bot, 0);
- // Run it on server
- openPackageExplorer();
- SWTBot packageExplorer = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
- .bot();
- SWTBotTree packageExplorerTree = packageExplorer.tree();
-
- packageExplorerTree.setFocus();
-
- SWTBotTreeItem packageExplorerTreeItem = packageExplorerTree
- .getTreeItem(JBT_TEST_PROJECT_NAME);
- packageExplorerTreeItem.select();
- packageExplorerTreeItem.click();
- // Search for Menu Item with Run on Server substring within label
- final SWTBotMenu menuRunAs = bot.menu("Run").menu("Run As");
- bot.getDisplay().syncExec(new Runnable() {
- public void run() {
- int menuItemIndex = 0;
- boolean isFound = false;
- final MenuItem[] menuItems = menuRunAs.widget.getMenu().getItems();
- while (!isFound && menuItemIndex < menuItems.length){
- if (menuItems[menuItemIndex].getText().indexOf("Run on Server")
> - 1){
- isFound = true;
- }
- else{
- menuItemIndex++;
- }
- }
- if (isFound){
- setMiRunOnServer(menuItems[menuItemIndex]);
- }
- else{
- setMiRunOnServer(null);
- }
- }
- });
-
- if (getMiRunOnServer() != null){
- new SWTBotMenu(getMiRunOnServer()).click();
- }
- else
- {
- throw new WidgetNotFoundException("Menu item with mnemonic Run on
Server");
- }
-
- bot.shell("Run On Server").activate();
- bot.button(WidgetVariables.FINISH_BUTTON).click();
-
- waitForBlockingJobsAcomplished(10*1000L , BUILDING_WS);
- waitForBlockingJobsAcomplished(10*1000L , UPDATING_INDEXES);
+ swtJbtExt.startApplicationServer(0);
+ swtJbtExt.runProjectOnServer(JBT_TEST_PROJECT_NAME);
// Check Browser Content
String browserText = WidgetFinderHelper.browserInEditorText(bot, "Input User
Name Page",true);
-
assertTrue("Displayed HTML page has wrong content",
browserText.indexOf("<TITLE>Input User Name Page</TITLE>")
> - 1);
// Stop Application Server and remove Application Server from Server View
@@ -328,14 +268,6 @@
delay();
}
-
- private void setMiRunOnServer(MenuItem menuItem){
- miRunOnServer = menuItem;
- }
-
- private MenuItem getMiRunOnServer(){
- return miRunOnServer;
- }
/**
* Remove JSF Test Project from all Servers
*/
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 2010-01-18
19:26:19 UTC (rev 19795)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -408,5 +408,21 @@
// do nothing
}
}
+ /**
+ * Close Warning Window if is opened.
+ * Press Continue or Cancel button dependent on pressContinueButton
+ * @param pressContinueButton
+ */
+ public void closeWarningWindowIfOpened(boolean pressContinueButton){
+ try{
+ bot.shell(IDELabel.Shell.WARNING).activate();
+ bot.button(pressContinueButton ? IDELabel.Button.CONTINUE :
IDELabel.Button.CANCEL).click();
+ } catch (WidgetNotFoundException wnfe){
+ // do nothing
+ }
+ }
+ public static void closeWarningWindowIfOpened(SWTWorkbenchBot bot, boolean
pressContinueButton){
+ closeWarningWindowIfOpened(bot, pressContinueButton);
+ }
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2010-01-18
19:26:19 UTC (rev 19795)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -13,15 +13,21 @@
import static org.jboss.tools.ui.bot.ext.SWTTestExt.eclipse;
+import java.io.IOException;
+
import org.apache.log4j.Logger;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
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.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.JobName;
import org.jboss.tools.ui.bot.ext.types.ViewType;
/**
* Provides JBoss Tools common operations based on SWTBot element operations
@@ -156,6 +162,7 @@
}
/**
* Remove Project from all Servers
+ * @param projectName
*/
public void removeProjectFromServers(String projectName){
@@ -189,5 +196,109 @@
public void delay() {
bot.sleep(500);
}
+ /**
+ * Delete Project from workspace
+ * @param projectName
+ */
+ public void deleteProject(String projectName) {
+
+ removeProjectFromServers(projectName);
+
+ SWTBot packageExplorer = eclipse.showView(ViewType.PACKAGE_EXPLORER);
+ delay();
+ SWTBotTree tree = packageExplorer.tree();
+ delay();
+
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree,
+ tree.getTreeItem(projectName));
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
+ IDELabel.Menu.DELETE, false)).click();
+ bot.shell(IDELabel.Shell.DELETE_RESOURCES).activate();
+ bot.button(IDELabel.Button.OK).click();
+
+ new SWTUtilExt(bot).waitForNonIgnoredJobs();
+
+ }
+ /**
+ * Choose Run On Server menu for specified project
+ * @param bot
+ * @param projectName
+ */
+ public static void runProjectOnServer(SWTWorkbenchBot bot, String projectName){
+
+ SWTBotTree packageExplorerTree = eclipse.showView(ViewType.PACKAGE_EXPLORER).tree();
+
+ packageExplorerTree.setFocus();
+ SWTBotTreeItem packageExplorerTreeItem = packageExplorerTree
+ .getTreeItem(projectName);
+
+ packageExplorerTreeItem.select();
+ packageExplorerTreeItem.click();
+ // Search for Menu Item with Run on Server substring within label
+ final SWTBotMenu menuRunAs = bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.RUN_AS);
+ final MenuItem menuItem = UIThreadRunnable
+ .syncExec(new WidgetResult<MenuItem>() {
+ @SuppressWarnings("unchecked")
+ public MenuItem run() {
+ int menuItemIndex = 0;
+ MenuItem menuItem = null;
+ final MenuItem[] menuItems = menuRunAs.widget.getMenu().getItems();
+ while (menuItem == null && menuItemIndex < menuItems.length){
+ if (menuItems[menuItemIndex].getText().indexOf("Run on Server")
> - 1){
+ menuItem = menuItems[menuItemIndex];
+ }
+ else{
+ menuItemIndex++;
+ }
+ }
+ return menuItem;
+ }
+ });
+ if (menuItem != null){
+ new SWTBotMenu(menuItem).click();
+ bot.shell(IDELabel.Shell.RUN_ON_SERVER).activate();
+ bot.button(IDELabel.Button.FINISH).click();
+ SWTUtilExt swtUtil = new SWTUtilExt(bot);
+ swtUtil.waitForJobs(10*1000L,JobName.BUILDING_WS);
+ swtUtil.waitForJobs(10*1000L,JobName.UPDATING_INDEXES);
+ }
+ else{
+ throw new WidgetNotFoundException("Unable to find Menu Item with Label
'Run on Server'");
+ }
+ }
+ /**
+ * Choose Run On Server menu for specified project
+ * @param projectName
+ */
+ public void runProjectOnServer(String projectName){
+ runProjectOnServer(bot,projectName);
+ }
+ /**
+ * Creates new Server within Server View when Wizard for new Project is called
+ * @param bot
+ * @param serverGroup
+ * @param serverType
+ */
+ public static void addServerToServerViewOnWizardPage (SWTWorkbenchBot bot,String
serverGroup , String serverType){
+ // Check if there is defined Application Server if not create one
+ if (!SWTJBTExt.isServerDefinedInWebWizardPage(bot)){
+ // Specify Application Server for Deployment
+ bot.button(IDELabel.Button.NEW, 1).click();
+ bot.shell(IDELabel.Shell.NEW_SERVER).activate();
+ bot.tree().select(serverGroup);
+ bot.tree().expandNode(serverGroup)
+ .select(serverType);
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+
+ }
+ /**
+ * Creates new Server within Server View when Wizard for new Project is called
+ * @param serverGroup
+ * @param serverType
+ */
+ public void addServerToServerViewOnWizardPage (String serverGroup , String
serverType){
+ addServerToServerViewOnWizardPage (bot,serverGroup , serverType);
+ }
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2010-01-18
19:26:19 UTC (rev 19795)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -352,4 +352,22 @@
});
}
+ /**
+ * Returns Test Plugin Location within file system
+ * @param projectName
+ * @return
+ */
+ public static String getTestPluginLocation(String projectName){
+
+ String[] parts =
System.getProperty("eclipse.commands").split("\n");
+
+ int index = 0;
+
+ for (index = 0;parts.length > index + 1 &&
!parts[index].equals("-data");index++){
+ // do nothing just go through
+ }
+
+ return parts[index + 1] + File.separator + projectName;
+
+ }
}
\ No newline at end of file
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 2010-01-18
19:26:19 UTC (rev 19795)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -60,6 +60,8 @@
public static final String JBT_REMOVE_STRUTS_CAPABILITIES = "Remove Struts
Capabilities";
public static final String ADD_STRUTS_CAPABILITIES = "Add Struts
Capabilities...";
public static final String WEB_PROJECT_JBT_STRUTS = "JBoss Tools Struts";
+ public static final String RUN = "Run";
+ public static final String RUN_ON_SERVER = "Run on Server";
}
@@ -75,6 +77,8 @@
public static final String RUN = "Run";
public static final String APPLY = "Apply";
public static final String ADD = "Add...";
+ public static final String NEW = "New...";
+ public static final String CONTINUE = "Continue";
}
public class Shell {
@@ -97,6 +101,12 @@
public static final String PREFERENCES = "Preferences";
public static final String NEW_SERVER_RUNTIME_ENVIRONMENT = "New Server Runtime
Environment";
public static final String OPEN_ASSOCIATED_PERSPECTIVE = "Open Associated
Perspective?";
+ public static final String DELETE_RESOURCES = "Delete Resources";
+ public static final String IMPORT_STRUTS_PROJECT = "Import Struts Project";
+ public static final String UNSUPPORTED_CONTENT_TYPE = "Unsupported Content
Type";
+ public static final String NEW_SERVER = "New Server";
+ public static final String RUN_ON_SERVER = "Run On Server";
+ public static final String WARNING = "Warning";
}
public class EntityGroup {
@@ -206,6 +216,11 @@
public static final String WEB_XML = "web.xml";
public static final String CONTEXT_PARAMS = "Context Params";
public static final String JAVAX_FACES_CONFIG_FILES =
"javax.faces.CONFIG_FILES";
+ public static final String DEFAULT = "default";
+ public static final String SERVLETS = "Servlets";
+ public static final String ACTION_STRUTS =
"action:org.apache.struts.action.ActionServlet";
+ public static final String CONFIG = "config";
+ public static final String TAG_LIBRARIES = "Tag Libraries";
}
@@ -289,10 +304,14 @@
public static final String JBOSS_EAP_4_3 = "JBoss Enterprise Middleware";
}
- public static final class ServerType {
+ public static final class ServerRuntimeType {
public static final String JBOSS_EAP_4_3 = "JBoss Enterprise Application
Platform 4.3 Runtime";
}
+ public static final class ServerType {
+ public static final String JBOSS_EAP_4_3 = "JBoss Enterprise Application
Platform 4.3";
+
+ }
}
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/JobName.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/JobName.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/JobName.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.types;
+
+/**
+* Define Job Names Constants
+* @author Vladimir Pakan
+*
+*/
+public class JobName {
+ public static final String BUILDING_WS = "Building workspace";
+ public static final String VISUAL_UPDATE = "Visual Editor View Update";
+ public static final String VISUAL_REFRESH = "Visual Editor Refresh";
+ public static final String UPDATING_INDEXES = "Updating indexes";
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/JobName.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java 2010-01-18
19:26:19 UTC (rev 19795)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/StrutsAllBotTests.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -12,6 +12,10 @@
import org.jboss.tools.struts.ui.bot.test.smoke.AddRemoveStrutsCapabilities;
import org.jboss.tools.struts.ui.bot.test.smoke.CreateNewStrutsProjectTest;
+import org.jboss.tools.struts.ui.bot.test.smoke.ImportStrutsProjectTest;
+import org.jboss.tools.struts.ui.bot.test.smoke.RenameStrutsConfigXmlFile;
+import org.jboss.tools.struts.ui.bot.test.smoke.RenameTldFile;
+import org.jboss.tools.struts.ui.bot.test.smoke.RunStrutsProjectOnServer;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.junit.AfterClass;
@@ -28,8 +32,12 @@
*
*/
@RunWith(Suite.class)
-@SuiteClasses( {CreateNewStrutsProjectTest.class,
- AddRemoveStrutsCapabilities.class})
+(a)SuiteClasses({CreateNewStrutsProjectTest.class,
+ RunStrutsProjectOnServer.class,
+ AddRemoveStrutsCapabilities.class,
+ ImportStrutsProjectTest.class,
+ RenameStrutsConfigXmlFile.class,
+ RenameTldFile.class})
public class StrutsAllBotTests extends SWTTestExt {
public static final String STRUTS_PROJECT_NAME = "strutsTest";
@BeforeClass
Modified:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java 2010-01-18
19:26:19 UTC (rev 19795)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/CreateNewStrutsProjectTest.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -14,6 +14,7 @@
import static org.junit.Assert.assertTrue;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -36,13 +37,15 @@
eclipse.showView(ViewType.WEB_PROJECTS);
eclipse.addServerRuntime(IDELabel.ServerRuntimeName.JBOSS_EAP_4_3,
IDELabel.ServerGroup.JBOSS_EAP_4_3,
- IDELabel.ServerType.JBOSS_EAP_4_3,
+ IDELabel.ServerRuntimeType.JBOSS_EAP_4_3,
StrutsAllBotTests.getProperty("JBossEap4.3Home"));
eclipse.createNew(EntityType.STRUTS_PROJECT);
bot.shell(IDELabel.Shell.NEW_STRUTS_PROJECT).activate();
bot.textWithLabel(IDELabel.NewStrutsProjectDialog.NAME).setText(StrutsAllBotTests.STRUTS_PROJECT_NAME);
bot.comboBoxWithLabel(IDELabel.NewStrutsProjectDialog.TEMPLATE).setSelection(IDELabel.NewStrutsProjectDialog.TEMPLATE_KICK_START);
bot.button(IDELabel.Button.NEXT).click();
+ SWTJBTExt.addServerToServerViewOnWizardPage(bot, IDELabel.ServerGroup.JBOSS_EAP_4_3,
IDELabel.ServerType.JBOSS_EAP_4_3);
+ bot.sleep(1000L);
bot.button(IDELabel.Button.NEXT).click();
bot.button(IDELabel.Button.FINISH).click();
eclipse.closeOpenAssociatedPerspectiveShellIfOpened(false);
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/ImportStrutsProjectTest.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/ImportStrutsProjectTest.java
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/ImportStrutsProjectTest.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -0,0 +1,93 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.struts.ui.bot.test.smoke;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+import org.junit.Test;
+import org.jboss.tools.struts.ui.bot.test.StrutsAllBotTests;
+/**
+ * Test importing Struts Project
+ * @author Vladimir Pakan
+ *
+ */
+public class ImportStrutsProjectTest extends SWTTestExt{
+
+ /**
+ * Test importing Struts Project
+ */
+ private SWTJBTExt swtJbtExt = null;
+ public ImportStrutsProjectTest (){
+ swtJbtExt = new SWTJBTExt(bot);
+ }
+ @Test
+ public void testImportStrutsProjectTest() {
+ // Remove Struts Project
+ swtJbtExt.deleteProject(StrutsAllBotTests.STRUTS_PROJECT_NAME);
+ // Import Struts Project
+ String webXmlFileLocation = SWTUtilExt
+ .getTestPluginLocation(StrutsAllBotTests.STRUTS_PROJECT_NAME)
+ + File.separator
+ + "WebContent"
+ + File.separator
+ + "WEB-INF"
+ + File.separator + "web.xml";
+
+ bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.IMPORT).click();
+ bot.shell(IDELabel.Shell.IMPORT).activate();
+ SWTBotTree tree = bot.tree();
+ swtJbtExt.delay();
+ tree.expandNode("Other").select(IDELabel.Menu.STRUTS_PROJECT);
+ bot.button("Next >").click();
+ bot.shell(IDELabel.Shell.IMPORT_STRUTS_PROJECT).activate();
+
+ bot.textWithLabel("web.xml Location*").setText(webXmlFileLocation);
+
+ bot.button(WidgetVariables.NEXT_BUTTON).click();
+ // Check if there is defined Application Server if not create one
+ if (!SWTJBTExt.isServerDefinedInWebWizardPage(bot)) {
+ // Specify Application Server for Deployment
+ bot.button(WidgetVariables.NEW_BUTTON, 1).click();
+ bot.shell("New Server").activate();
+ bot.tree().expandNode("JBoss Enterprise Middleware").select(
+ "JBoss Enterprise Application Platform 4.3");
+ bot.button(WidgetVariables.FINISH_BUTTON).click();
+ // Server Jobs has different labels now
+ }
+ swtJbtExt.delay();
+ // Finish Import
+ bot.button(WidgetVariables.FINISH_BUTTON).click();
+ bot.shell("Warning").activate();
+ bot.button(WidgetVariables.CONTINUE_BUTTON).click();
+
+ eclipse.closeOpenAssociatedPerspectiveShellIfOpened(false);
+
+ eclipse.showView(ViewType.WEB_PROJECTS);
+
+ assertTrue("Project " + StrutsAllBotTests.STRUTS_PROJECT_NAME
+ + " was not created properly.", SWTEclipseExt
+ .treeContainsItemWithLabel(bot.viewByTitle(IDELabel.View.WEB_PROJECTS)
+ .bot().tree(), StrutsAllBotTests.STRUTS_PROJECT_NAME));
+
+ }
+
+}
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/ImportStrutsProjectTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameStrutsConfigXmlFile.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameStrutsConfigXmlFile.java
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameStrutsConfigXmlFile.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -0,0 +1,75 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.struts.ui.bot.test.smoke;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.helper.FileRenameHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.junit.Test;
+import org.jboss.tools.struts.ui.bot.test.StrutsAllBotTests;
+
+/**
+ * Test renaming of struts-config.xml file
+ * @author Vladimir Pakan
+ *
+ */
+public class RenameStrutsConfigXmlFile extends SWTTestExt{
+ private static final String OLD_STRUTS_CONFIG_FILE_NAME =
"struts-config.xml";
+ private static final String NEW_STRUTS_CONFIG_FILE_NAME =
"struts-config-renamed.xml";
+ /**
+ * Test renaming of struts-config.xml file
+ */
+ @Test
+ public void testRenameStrutsConfigXmlFile() {
+
+ String checkResult = FileRenameHelper.checkFileRenamingWithinWebProjects(bot,
+ OLD_STRUTS_CONFIG_FILE_NAME, NEW_STRUTS_CONFIG_FILE_NAME,
+ new String[]{StrutsAllBotTests.STRUTS_PROJECT_NAME,
IDELabel.WebProjectsTree.CONFIGURATION ,IDELabel.WebProjectsTree.DEFAULT});
+ assertNull(checkResult, checkResult);
+ // web.xml file was properly modified
+ SWTBotTree tree = eclipse.showView(ViewType.WEB_PROJECTS).tree();
+ tree.setFocus();
+ SWTBotTreeItem configFilesTreeItem = tree
+ .getTreeItem(StrutsAllBotTests.STRUTS_PROJECT_NAME)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.CONFIGURATION)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.WEB_XML)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.SERVLETS)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.ACTION_STRUTS)
+ .expand()
+ .getNode(IDELabel.WebProjectsTree.CONFIG);
+
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree,configFilesTreeItem);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.PROPERTIES,
true)).click();
+ bot.shell(IDELabel.Shell.PROPERTIES).activate();
+ SWTBotTable propertiesTable = bot.table();
+ String fullConfigFileName =
propertiesTable.cell(propertiesTable.indexOf(IDELabel.PropertiesDialog.PARAM_VALUE, 0),
1);
+ bot.button(IDELabel.Button.CLOSE).click();
+ assertTrue(NEW_STRUTS_CONFIG_FILE_NAME + " Name of "
+ + OLD_STRUTS_CONFIG_FILE_NAME
+ + " file was not changed in web.xml file.",
+ fullConfigFileName.endsWith(NEW_STRUTS_CONFIG_FILE_NAME));
+ }
+
+}
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameStrutsConfigXmlFile.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameTldFile.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameTldFile.java
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameTldFile.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -0,0 +1,41 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.struts.ui.bot.test.smoke;
+
+import static org.junit.Assert.assertNull;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.helper.FileRenameHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+import org.jboss.tools.struts.ui.bot.test.StrutsAllBotTests;
+
+/**
+ * Test renaming of Tld file
+ * @author Vladimir Pakan
+ *
+ */
+public class RenameTldFile extends SWTTestExt{
+ private static final String OLD_TLD_FILE_NAME = "struts-html.tld";
+ private static final String NEW_TLD_FILE_NAME = "struts-html-renamed.tld";
+ /**
+ * Test renaming of struts-config.xml file
+ */
+ @Test
+ public void testRenameStrutsConfigXmlFile() {
+ String checkResult = FileRenameHelper.checkFileRenamingWithinWebProjects(bot,
+ OLD_TLD_FILE_NAME, NEW_TLD_FILE_NAME,
+ new String[]{StrutsAllBotTests.STRUTS_PROJECT_NAME,
IDELabel.WebProjectsTree.TAG_LIBRARIES},
+ " [html]");
+ assertNull(checkResult, checkResult);
+ }
+
+}
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RenameTldFile.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RunStrutsProjectOnServer.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RunStrutsProjectOnServer.java
(rev 0)
+++
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RunStrutsProjectOnServer.java 2010-01-18
19:29:45 UTC (rev 19796)
@@ -0,0 +1,49 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.struts.ui.bot.test.smoke;
+
+import static org.junit.Assert.assertTrue;
+
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.helper.WidgetFinderHelper;
+import org.junit.Test;
+import org.jboss.tools.struts.ui.bot.test.StrutsAllBotTests;
+
+/**
+ * Test running Struts Project on Server
+ * @author Vladimir Pakan
+ *
+ */
+public class RunStrutsProjectOnServer extends SWTTestExt{
+ private SWTJBTExt swtJbtExt = null;
+ public RunStrutsProjectOnServer (){
+ swtJbtExt = new SWTJBTExt(bot);
+ }
+ /**
+ * Test running Struts Project on Server
+ */
+ @Test
+ public void testRunStrutsProjectOnServer() {
+ // Start Application Server
+ swtJbtExt.startApplicationServer(0);
+ swtJbtExt.runProjectOnServer(StrutsAllBotTests.STRUTS_PROJECT_NAME);
+ // Check Browser Content
+ String browserText = WidgetFinderHelper.browserInEditorText(bot, "KickStart:
Input name",true);
+ assertTrue("Displayed HTML page has wrong content",
+ browserText.indexOf("<TITLE>KickStart: Input name</TITLE>")
> - 1);
+ swtJbtExt.stopApplicationServer( 0);
+ swtJbtExt.removeProjectFromServers(StrutsAllBotTests.STRUTS_PROJECT_NAME);
+ SWTJBTExt.deleteApplicationServer(bot, 0);
+ }
+
+}
Property changes on:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/smoke/RunStrutsProjectOnServer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain