Author: vpakan(a)redhat.com
Date: 2010-04-21 06:55:28 -0400 (Wed, 21 Apr 2010)
New Revision: 21577
Added:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
Modified:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.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/SWTTestExt.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/helper/FileRenameHelper.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java
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/PerspectiveType.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
Log:
Added Drools Rule Test
Modified:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -16,9 +16,11 @@
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsRuntime;
import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsProject;
+import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsRules;
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.PerspectiveType;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -34,15 +36,19 @@
*/
@RunWith(Suite.class)
@SuiteClasses({ManageDroolsRuntime.class,
- ManageDroolsProject.class})
+ ManageDroolsProject.class,
+ ManageDroolsRules.class})
public class DroolsAllBotTests extends SWTTestExt {
public static final String DROOLS_PROJECT_NAME = "droolsTest";
public static final String DROOLS_RUNTIME_NAME = "Drools Test Runtime";
public static String DROOLS_RUNTIME_LOCATION = null;
public static String CREATE_DROOLS_RUNTIME_LOCATION = null;
public static String SRC_MAIN_JAVA_TREE_NODE = "src/main/java";
+ public static String SRC_MAIN_RULES_TREE_NODE = "src/main/rules";
public static String COM_SAMPLE_TREE_NODE = "com.sample";
public static String DROOLS_TEST_JAVA_TREE_NODE = "DroolsTest.java";
+ public static final String TEST_DROOLS_RULE_NAME = "TestRule.drl";
+ public static final String SAMPLE_DROOLS_RULE_NAME = "Sample.drl";
private static String testDroolsRuntimeName = null;
public static String getTestDroolsRuntimeName() {
return testDroolsRuntimeName;
@@ -74,7 +80,7 @@
} catch (WidgetNotFoundException wnfe){
// Do nothing ignore this error
}
-
+ eclipse.openPerspective(PerspectiveType.JAVA);
}
@AfterClass
Modified:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -15,14 +15,18 @@
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.helper.FileRenameHelper;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.ViewType;
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
import org.junit.Test;
+import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
/**
* Test managing of Drools Project
@@ -33,10 +37,14 @@
/**
* Test manage Drools project
*/
+ private static final String RENAMED_DROOLS_PROJECT =
DroolsAllBotTests.DROOLS_PROJECT_NAME + "-renamed";
@Test
public void testManageDroolsProject() {
createDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
runNewDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
+ renameDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME,
ManageDroolsProject.RENAMED_DROOLS_PROJECT);
+ deleteDroolsProject (ManageDroolsProject.RENAMED_DROOLS_PROJECT);
+ createDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
}
/**
* Creates new Drools project
@@ -108,5 +116,41 @@
"Expected console text is: " + "Hello World\nGoodbye cruel
world\n",
"Hello World\nGoodbye cruel world\n".equals(consoleText));
}
+ /**
+ * Renames Drools project and check result
+ * @param droolsProjectName
+ * @param renamedProjectName
+ */
+ private void renameDroolsProject(String droolsProjectName, String renamedProjectName){
+ packageExplorer.show();
+
+ bot.sleep(TIME_1S);
+
+ SWTBot webProjects = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
+ SWTBotTree tree = webProjects.tree();
+
+ tree.setFocus();
+ String checkResult = FileRenameHelper.checkProjectRenamingWithinPackageExplorer(bot,
+ DroolsAllBotTests.DROOLS_PROJECT_NAME,
+ ManageDroolsProject.RENAMED_DROOLS_PROJECT,
+ IDELabel.Shell.RENAME_JAVA_PROJECT);
+ assertNull(checkResult,checkResult);
+ }
+ /**
+ * Deletes Drools project and check result
+ * @param droolsProjectName
+ */
+ private void deleteDroolsProject(String droolsProjectName){
+
+ packageExplorer.deleteProject(droolsProjectName, true);
+ boolean notFound = false;
+ try{
+ packageExplorer.selectProject(droolsProjectName);
+ }catch (WidgetNotFoundException wnf){
+ notFound = true;
+ }
+ assertTrue("Drools project: " + droolsProjectName +
+ " was not deleted properly",notFound);
+ }
}
Added:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
(rev 0)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -0,0 +1,117 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2010 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.drools.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+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.SWTTestExt;
+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.EntityType;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
+import org.junit.Test;
+/**
+ * Test managing of Drools Rules
+ * @author Vladimir Pakan
+ *
+ */
+public class ManageDroolsRules extends SWTTestExt{
+ /**
+ * Test manage Drools Rules
+ */
+ @Test
+ public void testManageDroolsProject() {
+ createDroolsRule (DroolsAllBotTests.TEST_DROOLS_RULE_NAME);
+ debugDroolsRule (DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME);
+ }
+ /**
+ * Creates Drools Rule and checks result
+ * @param droolsRuletName
+ */
+ private void createDroolsRule(String droolsRuleName){
+
+ packageExplorer.show();
+ SWTBotTreeItem tiDroolsRules =
packageExplorer.selectTreeItem(DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
+ new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME});
+
+ tiDroolsRules.select();
+ eclipse.createNew(EntityType.DROOLS_RULE);
+
+ bot.textWithLabel(IDELabel.NewDroolsRuleDialog.FILE_NAME).setText(droolsRuleName);
+
bot.textWithLabel(IDELabel.NewDroolsRuleDialog.RULE_PACKAGE_NAME).setText(DroolsAllBotTests.COM_SAMPLE_TREE_NODE);
+ bot.button(IDELabel.Button.FINISH).click();
+ bot.sleep(Timing.time1S());
+ tiDroolsRules.expand();
+ // Test if new Drools Rule is within package tree view
+ boolean isRuleCreated = true;
+ try{
+ tiDroolsRules.getNode(droolsRuleName);
+ } catch (WidgetNotFoundException wnfe){
+ isRuleCreated = false;
+ }
+ assertTrue("New Drools Rule was not created properly. It's not present
within Package Explorer",isRuleCreated);
+ // Test if new Drools Rule is opened in editor
+ isRuleCreated = true;
+ try{
+ bot.editorByTitle(droolsRuleName);
+ } catch (WidgetNotFoundException wnfe){
+ isRuleCreated = false;
+ }
+ assertTrue("New Drools Rule was not created properly. File " +
droolsRuleName + " is not opened in editor",isRuleCreated);
+ }
+ /**
+ * Debug Drools Rule and checks result
+ * @param droolsRuletName
+ */
+ private void debugDroolsRule(String droolsRuleName){
+ packageExplorer.show();
+ SWTBotTreeItem tiDroolsRule =
packageExplorer.selectTreeItem(DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME,
+ new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
+ DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE});
+ SWTBot packageExplorerBot =
bot.viewByTitle(ViewType.PACKAGE_EXPLORER.getViewLabel()).bot();
+ SWTBotTree tree = packageExplorerBot.tree();
+ // Select and Open Rule File
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree , tiDroolsRule);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.OPEN,
true)).click();
+ SWTBotEclipseEditor ruleEditor = bot.editorByTitle(droolsRuleName).toTextEditor();
+ ruleEditor.selectRange(8, 0, 0);
+ bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.TOGGLE_BREAKPOINT).click();
+ SWTBotTreeItem tiDroolsTest =
packageExplorer.selectTreeItem(DroolsAllBotTests.DROOLS_TEST_JAVA_TREE_NODE,
+ new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME,
+ DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
+ DroolsAllBotTests.COM_SAMPLE_TREE_NODE});
+ console.clearConsole();
+ eclipse.debugTreeItemAsDroolsApplication(tiDroolsTest);
+ eclipse.closeConfirmPerspectiveSwitchShellIfOpened(true);
+ String consoleText = console.getConsoleText(3*1000L,3*1000L,true);
+ assertTrue("Drools Rule was not debuged properly.\nConsole content should have
been empty but is:\n" + consoleText,
+ consoleText.length() == 0);
+ SWTBotView debugView = bot.viewByTitle(ViewType.DEBUG.getViewLabel());
+ debugView.toolbarButton(IDELabel.DebugView.BUTTON_STEP_OVER_TOOLTIP).click();
+ consoleText = console.getConsoleText(3*1000L,60*1000L,true);
+ assertTrue("Drools Rule was not debuged properly.\nConsole content should
be:\n'Hello World\n' but is:\n" + consoleText,
+ consoleText.equals("Hello World\n"));
+ debugView.toolbarButton(IDELabel.DebugView.BUTTON_RESUME_TOOLTIP).click();
+ consoleText = console.getConsoleText(3*1000L,60*1000L,true);
+ assertTrue("Drools Rule was not debuged properly.\nConsole content should
be:Hello World\nGoodbye cruel world\n" + consoleText,
+ consoleText.equals("Hello World\nGoodbye cruel world\n"));
+ }
+
+}
+
Property changes on:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRuntime.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -11,10 +11,6 @@
package org.jboss.tools.drools.ui.bot.test.smoke;
-import static org.jboss.tools.ui.bot.ext.SWTTestExt.bot;
-import static org.jboss.tools.ui.bot.ext.SWTTestExt.console;
-import static org.jboss.tools.ui.bot.ext.SWTTestExt.eclipse;
-
import java.io.File;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
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-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -156,6 +156,9 @@
case JPA:
perspectiveLabel = IDELabel.SelectPerspectiveDialog.JPA;
break;
+ case DEBUG:
+ perspectiveLabel = IDELabel.SelectPerspectiveDialog.DEBUG;
+ break;
default:
fail("Unknown perspective to open");
}
@@ -664,6 +667,24 @@
closeWarningWindowIfOpened(bot, pressContinueButton);
}
+ /**
+ * if Confirm Perspective Switch Shell is opened close it and depend on
+ * switchPerspective parameter change current perspective
+ *
+ * @param switchPerspective
+ */
+ public void closeConfirmPerspectiveSwitchShellIfOpened(
+ boolean switchPerspective) {
+ try {
+ bot.shell(IDELabel.Shell.CONFIRM_PERSPECTIVE_SWITCH).activate();
+ bot.button(
+ switchPerspective ? IDELabel.Button.YES
+ : IDELabel.Button.NO).click();
+ } catch (WidgetNotFoundException wnfe) {
+ // do nothing
+ }
+ }
+
/**
* Returns true if table column specified by column parameter contains item
*
@@ -941,5 +962,16 @@
return stringBuilder.toString();
}
-
+ /**
+ * Choose Debug As Drools Application menu for specified Tree Item
+ *
+ * @param treeItem
+ */
+ public void debugTreeItemAsDroolsApplication(SWTBotTreeItem treeItem) {
+ treeItem.select();
+ treeItem.click();
+ SWTEclipseExt.getMenuFromSubmenu(
+ bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.DEBUG_AS),
+ IDELabel.Menu.DEBUG_AS_DROOLS_APPLICATION).click();
+ }
}
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.ui.bot.ext;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import java.util.Properties;
import java.util.Vector;
@@ -19,9 +17,7 @@
import org.apache.log4j.Logger;
import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
import org.jboss.tools.ui.bot.ext.config.ConfiguredState;
-import org.jboss.tools.ui.bot.ext.config.requirement.AddServer;
import org.jboss.tools.ui.bot.ext.config.requirement.RequirementBase;
-import org.jboss.tools.ui.bot.ext.config.requirement.StartServer;
import org.jboss.tools.ui.bot.ext.gen.IView;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.ConsoleView;
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-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -17,6 +17,7 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -26,17 +27,22 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Widget;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+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.utils.SWTUtils;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.jboss.tools.ui.bot.ext.parts.SWTBotBrowserExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.JobLists;
import org.jboss.tools.ui.bot.ext.types.JobState;
import org.osgi.framework.Bundle;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
/**
* Base class for all classes using SWTBot
@@ -48,7 +54,20 @@
private Logger log = Logger.getLogger(SWTUtilExt.class);
protected SWTWorkbenchBot bot;
+
+ private static class AlwaysMatchMatcher<T extends Widget> extends
BaseMatcher<T> {
+ public boolean matches(Object item) {
+ // Always returns true
+ return true;
+ }
+
+ public void describeTo(Description description) {
+ description.appendText("AlwaysMatchMatcher");
+ }
+
+ }
+
public SWTUtilExt(SWTWorkbenchBot bot) {
this.bot = bot;
}
@@ -586,4 +605,50 @@
}
}
}
+ /**
+ * Display all active widgets
+ * @param bot
+ */
+ public static void displayAllBotWidgets (SWTBot bot){
+ List<?> widgets = bot.widgets(new
SWTUtilExt.AlwaysMatchMatcher<Widget>());
+ for (Object object : widgets){
+ System.out.println(object +
+ " Text: " + SWTUtilExt.invokeMethod(object, "getText") +
+ " Tooltip: " + SWTUtilExt.invokeMethod(object,
"getToolTipText"));
+ }
+ }
+ /**
+ * Display all Toolbar Buttons of view
+ * @param view
+ */
+ public static void displayAllToolbarButtons (SWTBotView view){
+ List<SWTBotToolbarButton> buttons = view.getToolbarButtons();
+ for (SWTBotToolbarButton button : buttons){
+ System.out.println("Button Tooltip: " + button.getToolTipText() +
+ " Text: " + button.getText());
+ }
+ }
+ /**
+ * Invoke method on object and returns result as String
+ * @param object
+ * @param method
+ * @return
+ */
+ public static String invokeMethod (Object object, String method){
+
+ String result = "<null>";
+
+ try {
+ result = SWTUtils.invokeMethod(object, "getText").toString();
+ } catch (NoSuchMethodException e) {
+ result = "<null>";
+ } catch (IllegalAccessException e) {
+ result = "<null>";
+ } catch (InvocationTargetException e) {
+ result = "<null>";
+ }
+
+ return result;
+ }
+
}
\ No newline at end of file
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/FileRenameHelper.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/FileRenameHelper.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/FileRenameHelper.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -19,8 +19,8 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.Timing;
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;
/**
@@ -119,4 +119,51 @@
String[] treePathItems){
return checkFileRenamingWithinWebProjects(bot, oldFileName, newFileName,
treePathItems, "");
}
+ /**
+ * Check Project Renaming within Package Explorer
+ * @param bot
+ * @param oldProjectName
+ * @param newProjectName
+ * @return
+ */
+ public static String checkProjectRenamingWithinPackageExplorer(SWTWorkbenchBot bot ,
+ String oldProjectName,
+ String newProjectName,
+ String renameShellTitle){
+
+ bot.sleep(sleepTime);
+ SWTBotTree tree = eclipse.showView(ViewType.PACKAGE_EXPLORER).tree();
+
+ tree.setFocus();
+ tree.getTreeItem(oldProjectName).select();
+ bot.sleep(Timing.time1S());
+ // Rename project
+ bot.menu(IDELabel.Menu.FILE).
+ menu("Rename...")
+ .click();
+ bot.sleep(Timing.time1S());
+ bot.shell(renameShellTitle).activate();
+ bot.textWithLabel(IDELabel.RenameResourceDialog.NEW_NAME)
+ .setText(newProjectName);
+ bot.button(IDELabel.Button.OK).click();
+ new SWTUtilExt(bot).waitForAll(Timing.time10S());
+ // Check Results
+ // Project with Old Name doesn't exists within Package explorer
+ try{
+ tree.getTreeItem(oldProjectName);
+ return "Project " + oldProjectName + " was not renamed to " +
newProjectName + ".";
+ }catch (WidgetNotFoundException wnfe) {
+ // do nothing
+ }
+ // Project with New Name exists within Package Explorer
+ try{
+ tree.getTreeItem(newProjectName);
+ }catch (WidgetNotFoundException wnfe) {
+ return "Renamed Project " + newProjectName + " was not
found.";
+ }
+
+ return null;
+
+ }
+
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -21,7 +21,7 @@
*/
public enum EntityType {
HIBERNATE_MAPPING_FILE, JAVA_PROJECT, JAVA_CLASS, HIBERNATE_REVERSE_FILE,
HIBERNATE_CONSOLE,
- HIBERNATE_CONFIGURATION_FILE, STRUTS_PROJECT, JPA_PROJECT, DROOLS_PROJECT;
+ HIBERNATE_CONFIGURATION_FILE, STRUTS_PROJECT, JPA_PROJECT, DROOLS_PROJECT, DROOLS_RULE;
public List<String> getGroupsLabels() {
List<String> groupLabel = new LinkedList<String>();
@@ -36,6 +36,7 @@
case STRUTS_PROJECT: groupLabel.add(IDELabel.EntityGroup.JBOSS_TOOLS_WEB);
groupLabel.add(IDELabel.EntityGroup.STRUTS);break;
case JPA_PROJECT: groupLabel.add(IDELabel.EntityGroup.JPA);break;
case DROOLS_PROJECT: groupLabel.add(IDELabel.EntityGroup.DROOLS);break;
+ case DROOLS_RULE: groupLabel.add(IDELabel.EntityGroup.DROOLS);break;
default: fail("Unknown Entity Type");
}
@@ -43,7 +44,7 @@
}
/**
- * Return entity label acc
+ * Return entity label
* @return
*/
public String getEntityLabel() {
@@ -59,6 +60,7 @@
case STRUTS_PROJECT: entityLabel = IDELabel.EntityLabel.STRUTS_PROJECT; break;
case JPA_PROJECT: entityLabel = IDELabel.EntityLabel.JPA_PROJECT; break;
case DROOLS_PROJECT: entityLabel = IDELabel.EntityLabel.DROOLS_PROJECT; break;
+ case DROOLS_RULE: entityLabel = IDELabel.EntityLabel.DROOLS_RULE; break;
default: fail("Unknown Entity Type");
}
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-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -62,6 +62,9 @@
public static final String RUN_ON_SERVER = "Run on Server";
public static final String ADD_AND_REMOVE="Add and Remove...";
public static final String RUN_AS_JAVA_APPLICATION="Java Application";
+ public static final String TOGGLE_BREAKPOINT="Toggle Breakpoint";
+ public static final String DEBUG_AS = "Debug As";
+ public static final String DEBUG_AS_DROOLS_APPLICATION = "Drools
Application";
}
public class Button {
@@ -110,6 +113,9 @@
public static final String WARNING = "Warning";
public static final String DROOLS_RUNTIME = "Drools Runtime";
public static final String NEW_DROOLS_PROJECT = "";
+ public static final String RENAME_COMPILATION_UNIT = "Rename Compilation
Unit";
+ public static final String RENAME_JAVA_PROJECT = "Rename Java Project";
+ public static final String CONFIRM_PERSPECTIVE_SWITCH = "Confirm Perspective
Switch";
public static final String NEW_SEAM_RUNTIME = "New Seam Runtime";
}
@@ -134,6 +140,7 @@
public static final String STRUTS_PROJECT = "Struts Project";
public static final String JPA_PROJECT = "JPA Project";
public static final String DROOLS_PROJECT = "Drools Project";
+ public static final String DROOLS_RULE = "Rule Resource";
}
public class JavaProjectWizard {
@@ -159,6 +166,7 @@
public static final String SERVERS = "Servers";
public static final String WEB_PROJECTS = "Web Projects";
public static final String PROBLEMS = "Problems";
+ public static final String DEBUG = "Debug";
}
public class ViewGroup {
@@ -167,6 +175,7 @@
public static final String DATA_MANAGEMENT = "Data Management";
public static final String SERVER = "Server";
public static final String JBOSS_TOOLS_WEB = "JBoss Tools Web";
+ public static final String DEBUG = "Debug";
}
public class SelectPerspectiveDialog {
@@ -176,6 +185,7 @@
public static final String WEB_DEVELOPMENT = "Web Development";
public static final String DB_DEVELOPMENT = "Database Development";
public static final String JPA = "JPA";
+ public static final String DEBUG = "Debug";
}
/**
* Hibernate Console Wizard (ConsoleConfigurationCreationWizard) Labels (
@@ -344,6 +354,13 @@
}
+ public static final class NewDroolsRuleDialog {
+
+ public static final String FILE_NAME = "File name:";
+ public static final String RULE_PACKAGE_NAME = "Rule package name:";
+
+ }
+
public static class ProblemsTree {
public static final String WARNINGS = "Warnings";
@@ -356,4 +373,11 @@
public static final String BUTTON_CLEAR_CONSOLE_TOOLTIP = "Clear
Console";
}
+
+ public static class DebugView {
+
+ public static final String BUTTON_STEP_OVER_TOOLTIP = "Step Over (F6)";
+ public static final String BUTTON_RESUME_TOOLTIP = "Resume (F8)";
+
+ }
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/PerspectiveType.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -16,6 +16,6 @@
*
*/
public enum PerspectiveType {
- SEAM, JAVA, WEB_DEVELOPMENT, HIBERNATE, DB_DEVELOPMENT, JPA;
+ SEAM, JAVA, WEB_DEVELOPMENT, HIBERNATE, DB_DEVELOPMENT, JPA, DEBUG;
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/ViewType.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -18,7 +18,7 @@
*
*/
public enum ViewType {
- PACKAGE_EXPLORER, PROJECT_EXPLORER, WELCOME,
DATA_SOURCE_EXPLORER,SERVERS,WEB_PROJECTS,PROBLEMS;
+ PACKAGE_EXPLORER, PROJECT_EXPLORER, WELCOME,
DATA_SOURCE_EXPLORER,SERVERS,WEB_PROJECTS,PROBLEMS,DEBUG;
public String getGroupLabel() {
@@ -30,6 +30,7 @@
case SERVERS: viewLabel = IDELabel.ViewGroup.SERVER; break;
case WEB_PROJECTS: viewLabel = IDELabel.ViewGroup.JBOSS_TOOLS_WEB; break;
case PROBLEMS: viewLabel = IDELabel.ViewGroup.GENERAL; break;
+ case DEBUG: viewLabel = IDELabel.ViewGroup.DEBUG; break;
default: fail("Unknown View Type");
}
return viewLabel;
@@ -44,6 +45,7 @@
case SERVERS: viewLabel = IDELabel.View.SERVERS; break;
case WEB_PROJECTS: viewLabel = IDELabel.View.WEB_PROJECTS; break;
case PROBLEMS: viewLabel = IDELabel.View.PROBLEMS; break;
+ case DEBUG: viewLabel = IDELabel.View.DEBUG; break;
default: fail("Unknown View Type");
}
return viewLabel;
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2010-04-21
10:52:22 UTC (rev 21576)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2010-04-21
10:55:28 UTC (rev 21577)
@@ -84,8 +84,9 @@
String prevConsoleText = getConsoleText();
String consoleText = prevConsoleText;
log.info("Waiting for console text with TimeOut: " + timeOut);
- while ((estimatedTime <= timeOut)
+ while ((estimatedTime < timeOut)
&& (!quitWhenNoChange
+ || estimatedTime == 0
|| prevConsoleText == null
|| prevConsoleText.length() == 0
|| !prevConsoleText.equals(consoleText))){