Author: vpakan(a)redhat.com
Date: 2010-04-26 13:59:12 -0400 (Mon, 26 Apr 2010)
New Revision: 21697
Added:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImageHyperlinkHelper.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotImageHyperlink.java
Modified:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
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/helper/KeyboardHelper.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
Log:
Added Guided Drools Rule Editor test.
Modified: trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF 2010-04-26
17:57:28 UTC (rev 21696)
+++ trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF 2010-04-26
17:59:12 UTC (rev 21697)
@@ -18,3 +18,4 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: JBoss by Red Hat
+Import-Package: org.eclipse.ui.forms.widgets
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-26
17:57:28 UTC (rev 21696)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -14,6 +14,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.jboss.tools.drools.ui.bot.test.smoke.GuidedDroolsRulesEditorTest;
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;
@@ -39,7 +40,8 @@
@SuiteClasses({ManageDroolsRuntime.class,
ManageDroolsProject.class,
ManageDroolsRules.class,
- DroolsRulesEditorTest.class})
+ DroolsRulesEditorTest.class,
+ GuidedDroolsRulesEditorTest.class})
public class DroolsAllBotTests extends SWTTestExt {
public static final String DROOLS_PROJECT_NAME = "droolsTest";
public static final String DROOLS_RUNTIME_NAME = "Drools Test Runtime";
@@ -51,6 +53,7 @@
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";
+ public static final String GUIDED_DROOLS_RULE_NAME = "GuidedRule.brl";
private static String testDroolsRuntimeName = null;
public static String getTestDroolsRuntimeName() {
return testDroolsRuntimeName;
Added:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java
===================================================================
---
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java
(rev 0)
+++
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -0,0 +1,175 @@
+ /*******************************************************************************
+ * 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 java.awt.event.KeyEvent;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.helper.ImageHyperlinkHelper;
+import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.ui.bot.ext.types.EntityType;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests;
+import org.junit.Test;
+/**
+ * Tests Guided Drools Rule Editor
+ * @author Vladimir Pakan
+ *
+ */
+public class GuidedDroolsRulesEditorTest extends SWTTestExt{
+ private static final String DROOLS_PACKAGE_FILE = "drools.package";
+ /**
+ * Tests Guided Drools Rule Editor
+ */
+ @Test
+ public void testGuidedDroolsRulesEditorTest() {
+ createGuidedDroolsRule(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
+ editDroolsPackageFile();
+ addGuidedDroolsRuleCondition(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
+ removeGuidedDroolsRuleCondition(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
+ }
+ /**
+ * Creates Guided Drools Rule
+ * @param guidedDroolsRuleName
+ */
+ private void createGuidedDroolsRule(String guidedDroolsRuleName){
+ packageExplorer.show();
+ SWTBotTreeItem tiRules =
packageExplorer.selectTreeItem(DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
+ new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME});
+
+ tiRules.select();
+ eclipse.createNew(EntityType.GUIDED_DROOLS_RULE);
+
bot.textWithLabel(IDELabel.NewGuidedDroolsRuleDialog.FILE_NAME).setText(guidedDroolsRuleName);
+ eclipse.selectTreeLocation(DroolsAllBotTests.DROOLS_PROJECT_NAME,
+ "src",
+ "main",
+ "rules");
+ bot.button(IDELabel.Button.FINISH).click();
+ bot.sleep(Timing.time1S());
+ tiRules.expand();
+ // Test if new Drools Rule is within package tree view
+ assertTrue("New Guided Drools Rule was not created properly. It's not
present within Package Explorer",
+ SWTEclipseExt.containsTreeItemWithLabel(tiRules, guidedDroolsRuleName));
+ // Test if new Drools Rule is opened in editor
+ assertTrue("New Guided Drools Rule was not created properly. File " +
guidedDroolsRuleName + " is not opened in editor",
+ SWTEclipseExt.existEditorWithLabel(bot,guidedDroolsRuleName));
+ // Test if drools.package file is within package tree view
+ assertTrue("New Guided Drools Rule was not created properly. It's not
present within Package Explorer",
+ SWTEclipseExt.containsTreeItemWithLabel(tiRules,
+ GuidedDroolsRulesEditorTest.DROOLS_PACKAGE_FILE));
+ }
+ /**
+ * Edits drools.package file.
+ * Actually only adds import java.util.List to file
+ */
+ private void editDroolsPackageFile(){
+ packageExplorer.show();
+ SWTBotEclipseEditor droolsPackageEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
+ DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
+ GuidedDroolsRulesEditorTest.DROOLS_PACKAGE_FILE).toTextEditor();
+ droolsPackageEditor.setText(droolsPackageEditor.getText() +
+ "\nimport java.util.List;");
+ droolsPackageEditor.save();
+ droolsPackageEditor.close();
+ }
+
+ private void addGuidedDroolsRuleCondition(String guidedDroolsRuleName){
+ packageExplorer.show();
+ SWTBotEclipseEditor droolsEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
+ DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
+ DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
+ SWTBot droolsEditorBot = droolsEditor.bot();
+ droolsEditorBot.toolbarButton().click();
+ SWTBotShell dialogShell =
droolsEditorBot.shell(IDELabel.GuidedDroolsRuleEditor.WHEN_ADD_DIALOG_TITLE);
+ dialogShell.activate();
+
dialogShell.bot().comboBoxWithLabel(IDELabel.GuidedDroolsRuleEditor.WHEN_ADD_FACT_COMBO)
+ .setSelection("List");
+ ImageHyperlinkHelper
+ .imageHyperlinkWithTooltip(droolsEditorBot,
+ IDELabel.GuidedDroolsRuleEditor.ADD_FIELD_TO_THIS_CONDITION_TOOLTIP)
+ .click();
+ dialogShell =
droolsEditorBot.shell(IDELabel.GuidedDroolsRuleEditor.UPDATE_CONSTRAINTS_DIALOG_TITLE);
+ dialogShell.activate();
+ dialogShell.bot().comboBox()
+
.setSelection(IDELabel.GuidedDroolsRuleEditor.ADD_RESTRICTION_ON_A_FIELD_COMBO_VALUE);
+ droolsEditorBot.comboBox()
+ .setSelection(IDELabel.GuidedDroolsRuleEditor.WHEN_COMBO_CONSTRAINTS_VALUE);
+ ImageHyperlinkHelper
+ .imageHyperlinkWithTooltip(droolsEditorBot,
+ IDELabel.GuidedDroolsRuleEditor.CHOOSE_VALUE_EDITOR_TYPE_TOOLTIP)
+ .click();
+ dialogShell =
droolsEditorBot.shell(IDELabel.GuidedDroolsRuleEditor.SELECT_VALUE_EDITOR_TYPE_DIALOG_TITLE);
+ dialogShell.activate();
+
dialogShell.bot().comboBoxWithLabel(IDELabel.GuidedDroolsRuleEditor.SELECT_VALUE_EDITOR_TYPE_COMBO_LABEL)
+
.setSelection(IDELabel.GuidedDroolsRuleEditor.SELECT_VALUE_EDITOR_TYPE_COMBO_VALUE);
+
droolsEditorBot.comboBox(1).setSelection(IDELabel.GuidedDroolsRuleEditor.FIELD_VALUE_COMBO_VALUE);
+ droolsEditor.save();
+ droolsEditor.close();
+ droolsEditor = packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
+ DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
+ DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
+ SWTBotEditorExt ruleEditor =
bot.swtBotEditorExtByTitle(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
+ ruleEditor.selectPage(2);
+ String editorContent = droolsEditor.getText();
+ assertTrue(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME +
+ " has to contain text: List( empty == \"true\" )\n" +
+ "but it doesn't.\n" +
+ "It contains this text: " + editorContent,
+ editorContent.replaceAll("
","").indexOf("List(empty==\"true\")") > 0);
+ }
+ /**
+ * Removes Drools Rule Condition from Guided Drools Rule
+ * @param guidedDroolsRuleName
+ */
+ private void removeGuidedDroolsRuleCondition(String guidedDroolsRuleName){
+ packageExplorer.show();
+ SWTBotEclipseEditor droolsEditor =
packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
+ DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
+ DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
+ SWTBot droolsEditorBot = droolsEditor.bot();
+ SWTBotEditorExt ruleEditor =
bot.swtBotEditorExtByTitle(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
+ ruleEditor.selectPage(0);
+ ImageHyperlinkHelper
+ .imageHyperlinkWithTooltip(droolsEditorBot,
+ IDELabel.GuidedDroolsRuleEditor.REMOVE_THIS_CONDITION_TOOLTIP)
+ .click();
+ bot.sleep(Timing.time1S());
+ KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
+ KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_RIGHT);
+ bot.sleep(Timing.time1S());
+ KeyboardHelper.pressKeyCodeUsingAWT(KeyEvent.VK_ENTER);
+ KeyboardHelper.releaseKeyCodeUsingAWT(KeyEvent.VK_ENTER);
+ bot.sleep(Timing.time1S());
+ droolsEditor.save();
+ droolsEditor.close();
+ droolsEditor = packageExplorer.openFile(DroolsAllBotTests.DROOLS_PROJECT_NAME ,
+ DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
+ DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME).toTextEditor();
+ ruleEditor = bot.swtBotEditorExtByTitle(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME);
+ ruleEditor.selectPage(2);
+ String editorContent = droolsEditor.getText();
+ assertTrue(DroolsAllBotTests.GUIDED_DROOLS_RULE_NAME +
+ " has to contain textjak e:\nwhen\nthen\n" +
+ "but it doesn't.\n" +
+ "It contains this text: " + editorContent,
+ ruleEditor.getTextOnLine(2).trim().equals("when") &&
+ ruleEditor.getTextOnLine(3).trim().equals("then"));
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/drools/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuidedDroolsRulesEditorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-04-26 17:57:28
UTC (rev 21696)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-04-26 17:59:12
UTC (rev 21697)
@@ -31,6 +31,7 @@
org.jboss.tools.ui.bot.ext.helper,
org.jboss.tools.ui.bot.ext.parts,
org.jboss.tools.ui.bot.ext.types,
- org.jboss.tools.ui.bot.ext.view
+ org.jboss.tools.ui.bot.ext.view,
+ org.jboss.tools.ui.bot.ext.widgets
Bundle-Vendor: JBoss by Red Hat
Bundle-ClassPath: .
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-26
17:57:28 UTC (rev 21696)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -974,4 +974,44 @@
bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.DEBUG_AS),
IDELabel.Menu.DEBUG_AS_DROOLS_APPLICATION).click();
}
+ /**
+ * Returns true if parentNode contains Tree Item with nodeLabel
+ * @param parentNode
+ * @param nodeLabel
+ * @return
+ */
+ public static boolean containsTreeItemWithLabel(SWTBotTreeItem parentNode, String
nodeLabel){
+ boolean containsItem = true;
+ parentNode.expand();
+ try{
+ parentNode.getNode(nodeLabel);
+ } catch (WidgetNotFoundException wnfe){
+ containsItem = false;
+ }
+ return containsItem;
+ }
+ /**
+ * Returns true if editor with editorLabel exists within bot
+ * static version
+ * @param bot
+ * @param editorLabel
+ * @return
+ */
+ public static boolean existEditorWithLabel(SWTBotExt bot, String editorLabel){
+ boolean editorExists = true;
+ try{
+ bot.editorByTitle(editorLabel);
+ } catch (WidgetNotFoundException wnfe){
+ editorExists = false;
+ }
+ return editorExists;
+ }
+ /**
+ * Returns true if editor with editorLabel exists
+ * @param editorLabel
+ * @return
+ */
+ public boolean existEditorWithLabel(String editorLabel){
+ return SWTEclipseExt.existEditorWithLabel(bot, editorLabel);
+ }
}
\ No newline at end of file
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImageHyperlinkHelper.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImageHyperlinkHelper.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImageHyperlinkHelper.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.helper;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withTooltip;
+
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+import org.jboss.tools.ui.bot.ext.widgets.SWTBotImageHyperlink;
+/**
+ * Helper to find widgets
+ * @author Vladimir Pakan
+ *
+ */
+public class ImageHyperlinkHelper {
+ /**
+ * Returns {@link SWTBotImageHyperlink} with specified tooltip
+ * @param bot
+ * @param tooltiptext
+ * @return
+ * @throws WidgetNotFoundException
+ */
+ @SuppressWarnings("unchecked")
+ public static SWTBotImageHyperlink imageHyperlinkWithTooltip(SWTBot bot, String
tooltipText) throws WidgetNotFoundException{
+ List<?> imageHyperlinks = bot.widgets(allOf(
+ widgetOfType(ImageHyperlink.class),
+ withTooltip(tooltipText)));
+ if (imageHyperlinks != null && imageHyperlinks.size() > 0){
+ return new SWTBotImageHyperlink((ImageHyperlink)imageHyperlinks.get(0));
+ }
+ else{
+ throw new WidgetNotFoundException("Unable to find ImageHyperlink widget "
+
+ "with tooltip: " + tooltipText);
+ }
+ }
+ /**
+ * Displays all ImageHyperlinks to console contained in specified bot
+ * @param bot
+ * @throws WidgetNotFoundException
+ */
+ public static void displayAllImageHyperlinks(SWTBot bot)
+ throws WidgetNotFoundException {
+ List<?> imageHyperlinks = bot.widgets(widgetOfType(ImageHyperlink.class));
+ for (Object o : imageHyperlinks) {
+ ImageHyperlink imageHyperlink = (ImageHyperlink) o;
+ SWTBotImageHyperlink link = new SWTBotImageHyperlink(imageHyperlink);
+ System.out.println(link.toString());
+ }
+ }
+
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImageHyperlinkHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java 2010-04-26
17:57:28 UTC (rev 21696)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -1,10 +1,20 @@
package org.jboss.tools.ui.bot.ext.helper;
+import java.awt.AWTException;
+import java.awt.Robot;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
public class KeyboardHelper {
+ private static Robot robot = null;
+ /**
+ * Simulate pressing of key with keyCode via SWT
+ * @param display
+ * @param keyCode
+ */
public static void pressKeyCode (Display display , int keyCode){
Event keyPressed = new Event();
@@ -17,4 +27,34 @@
display.post(keyReleased);
}
+ /**
+ * Simulate pressing of key with keyCode via AWT
+ * @param awtKeyCode
+ */
+ public static void pressKeyCodeUsingAWT (int awtKeyCode){
+ try {
+ if (KeyboardHelper.robot == null){
+ SWTBotPreferences.KEYBOARD_STRATEGY =
"org.eclipse.swtbot.swt.finder.keyboard.AWTKeyboardStrategy";
+ KeyboardHelper.robot = new Robot();
+ }
+ KeyboardHelper.robot.keyPress(awtKeyCode);
+ } catch (AWTException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ /**
+ * Simulate releasing of key with keyCode via AWT
+ * @param awtKeyCode
+ */
+ public static void releaseKeyCodeUsingAWT (int awtKeyCode){
+ try {
+ if (KeyboardHelper.robot == null){
+ SWTBotPreferences.KEYBOARD_STRATEGY =
"org.eclipse.swtbot.swt.finder.keyboard.AWTKeyboardStrategy";
+ KeyboardHelper.robot = new Robot();
+ }
+ KeyboardHelper.robot.keyRelease(awtKeyCode);
+ } catch (AWTException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
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-26
17:57:28 UTC (rev 21696)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/EntityType.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -21,7 +21,8 @@
*/
public enum EntityType {
HIBERNATE_MAPPING_FILE, JAVA_PROJECT, JAVA_CLASS, HIBERNATE_REVERSE_FILE,
HIBERNATE_CONSOLE,
- HIBERNATE_CONFIGURATION_FILE, STRUTS_PROJECT, JPA_PROJECT, DROOLS_PROJECT, DROOLS_RULE;
+ HIBERNATE_CONFIGURATION_FILE, STRUTS_PROJECT, JPA_PROJECT, DROOLS_PROJECT, DROOLS_RULE,
+ GUIDED_DROOLS_RULE;
public List<String> getGroupsLabels() {
List<String> groupLabel = new LinkedList<String>();
@@ -37,6 +38,7 @@
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;
+ case GUIDED_DROOLS_RULE: groupLabel.add(IDELabel.EntityGroup.DROOLS);break;
default: fail("Unknown Entity Type");
}
@@ -61,6 +63,7 @@
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;
+ case GUIDED_DROOLS_RULE: entityLabel = IDELabel.EntityLabel.GUIDED_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-26
17:57:28 UTC (rev 21696)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -141,6 +141,7 @@
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 static final String GUIDED_DROOLS_RULE = "Guided Rule";
}
public class JavaProjectWizard {
@@ -387,4 +388,27 @@
public static final String RETE_TREE_TAB = "Rete Tree";
}
+
+ public static final class NewGuidedDroolsRuleDialog {
+
+ public static final String FILE_NAME = "File name:";
+
+ }
+
+ public static final class GuidedDroolsRuleEditor {
+
+ public static final String WHEN_ADD_DIALOG_TITLE = "Add new condition to the
rule";
+ public static final String WHEN_ADD_FACT_COMBO = "Fact";
+ public static final String ADD_FIELD_TO_THIS_CONDITION_TOOLTIP = "Add a field
to this condition, or bind a varible to this fact.";
+ public static final String REMOVE_THIS_CONDITION_TOOLTIP = "Remove this
condition.";
+ public static final String UPDATE_CONSTRAINTS_DIALOG_TITLE = "Update
constraints";
+ public static final String ADD_RESTRICTION_ON_A_FIELD_COMBO_VALUE =
"empty";
+ public static final String WHEN_COMBO_CONSTRAINTS_VALUE = "is equal to";
+ public static final String CHOOSE_VALUE_EDITOR_TYPE_TOOLTIP = "Choose value
editor type";
+ public static final String SELECT_VALUE_EDITOR_TYPE_DIALOG_TITLE = "Select
value editor type";
+ public static final String SELECT_VALUE_EDITOR_TYPE_COMBO_LABEL = "Field
value:";
+ public static final String SELECT_VALUE_EDITOR_TYPE_COMBO_VALUE = "Literal
value";
+ public static final String FIELD_VALUE_COMBO_VALUE = "true";
+
+ }
}
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotImageHyperlink.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotImageHyperlink.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotImageHyperlink.java 2010-04-26
17:59:12 UTC (rev 21697)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.widgets;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
+
+/**
+ * SWTBot for ImageHyperlink widget
+ * @author Vladimir Pakan
+ *
+ */
+public class SWTBotImageHyperlink extends SWTBotHyperlinkExt{
+ /**
+ * Constructs a new instance with the given ImageHyperlink.
+ *
+ * @param imageHyperlink the ImageHyperlink.
+ * @throws WidgetNotFoundException if the imageHyperlink is
<code>null</code> or widget has been disposed.
+ */
+ public SWTBotImageHyperlink(ImageHyperlink w) throws WidgetNotFoundException {
+ super(w);
+ }
+ /**
+ * Display ImageHyperlink
+ */
+ public String toString(){
+ String text = getText();
+ String tooltip = getToolTipText();
+ return "ImageHyperlink Text: " + (text != null ? text :
"<null>")
+ + " Tooltip: " + (tooltip != null ? tooltip : "<null>");
+ }
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotImageHyperlink.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain