Author: ljelinko
Date: 2012-01-02 10:32:40 -0500 (Mon, 02 Jan 2012)
New Revision: 37605
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/RunningFileOnServerTask.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
Log:
added the possibility to run a single fine on server
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/RunningFileOnServerTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/RunningFileOnServerTask.java 2012-01-02
10:31:33 UTC (rev 37604)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/server/RunningFileOnServerTask.java 2012-01-02
15:32:40 UTC (rev 37605)
@@ -4,21 +4,9 @@
import java.util.Arrays;
import java.util.List;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-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.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.portlet.ui.bot.entity.WorkspaceFile;
import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
/**
* Runs the file on server.
@@ -37,39 +25,8 @@
@Override
public void perform() {
performInnerTask(new MarkFileAsDeployableTask(workspaceFile));
- SWTBot viewBot = SWTBotFactory.getPackageexplorer().show().bot();
- SWTBotView view = SWTBotFactory.getPackageexplorer().show();
-
- SWTBotTreeItem item = SWTBotFactory.getEclipse().getTreeItemOnPath(viewBot,
viewBot.tree(), 0, workspaceFile.getFileName(), getFilePath());
- item.select();
- ContextMenuHelper.prepareTreeItemForContextMenu(viewBot.tree(), item);
- final SWTBotMenu menuRunAs =
viewBot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.RUN_AS);
- final MenuItem menuItem = UIThreadRunnable
- .syncExec(new WidgetResult<MenuItem>() {
- 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();
- SWTBotShell shell = getBot().shell(IDELabel.Shell.RUN_ON_SERVER).activate();
- SWTBotFactory.getOpen().finish(shell.bot());
- SWTBotFactory.getUtil().waitForAll(Timing.time3S());
- }
- else{
- throw new WidgetNotFoundException("Unable to find Menu Item with Label 'Run
on Server'");
- }
+ SWTBotFactory.getPackageexplorer().show();
+ SWTBotFactory.getPackageexplorer().runOnServer(workspaceFile.getProject(),
workspaceFile.getFileName(), getFilePath());
}
/**
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2012-01-02
10:31:33 UTC (rev 37604)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2012-01-02
15:32:40 UTC (rev 37605)
@@ -139,8 +139,23 @@
* @param projectName
*/
public void runOnServer(String projectName) {
+ runOnServer(projectName, null);
+ }
+
+ /**
+ * runs given file on Server (uses default server, the first one) server MUST be
running
+ * @param projectName
+ */
+ public void runOnServer(String projectName, String fileName, String... path) {
SWTBot viewBot = show().bot();
- SWTBotTreeItem item = viewBot.tree().expandNode(projectName);
+ SWTBotTreeItem item;
+
+ if (fileName == null){
+ item = viewBot.tree().expandNode(projectName);
+ } else {
+ item = SWTEclipseExt.getTreeItemOnPath(viewBot, viewBot.tree(), 0, fileName, path);
+ }
+
item.select();
ContextMenuHelper.prepareTreeItemForContextMenu(viewBot.tree(), item);
final SWTBotMenu menuRunAs =
viewBot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.RUN_AS);
Show replies by date