JBoss Tools SVN: r37772 - trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-11 12:01:44 -0500 (Wed, 11 Jan 2012)
New Revision: 37772
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java
Log:
JBIDE-10572
NullPointerException in ClassHyperlink
Issue is fixed.
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java 2012-01-11 15:11:22 UTC (rev 37771)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java 2012-01-11 17:01:44 UTC (rev 37772)
@@ -95,6 +95,38 @@
if (propStart > offset || propStart + propLength < offset) return null;
+ // Check that text is a 'class name'
+ text = document.get(bStart + start, bEnd - bStart);
+ int positionInText = offset - start - bStart;
+ int classNameStart = positionInText;
+ while (classNameStart > 0 && !Character.isWhitespace(text.charAt(classNameStart))) {
+ classNameStart--;
+ }
+ boolean firstOrAfterDot = true;
+ int classNameEnd = classNameStart;
+ for (; classNameEnd < text.length(); classNameEnd++) {
+ if (Character.isWhitespace(text.charAt(classNameEnd)))
+ break; // End of class name
+ if ('.' == text.charAt(classNameEnd)) {
+ if (firstOrAfterDot) return null; // Double DOT or first char is DOT
+ firstOrAfterDot = true;
+ continue;
+ }
+
+ if (firstOrAfterDot) {
+ if (!Character.isJavaIdentifierStart(text.charAt(classNameEnd))) return null; // Not Java Id-r start
+ firstOrAfterDot = false;
+ } else {
+ if (!Character.isJavaIdentifierPart(text.charAt(classNameEnd))) return null; // Not Java Id-r part
+ }
+ }
+
+ String className = text.substring(classNameStart, classNameEnd).trim();
+ if (className.length() == 0 ||
+ className.startsWith(".") || //$NON-NLS-1$
+ className.endsWith(".")) { //$NON-NLS-1$
+ return null;
+ }
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
} catch (BadLocationException x) {
12 years, 12 months
JBoss Tools SVN: r37771 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: gen and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-01-11 10:11:22 -0500 (Wed, 11 Jan 2012)
New Revision: 37771
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java
Log:
Added static class for JBoss AS 7.0 and 7.1 runtimes and servers in SWTBotExt ActionItem class
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2012-01-11 15:07:23 UTC (rev 37770)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2012-01-11 15:11:22 UTC (rev 37771)
@@ -4,22 +4,24 @@
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS7x;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss7xRuntime;
-import org.jboss.tools.ui.bot.ext.gen.IServer;
-import org.jboss.tools.ui.bot.ext.gen.IServerRuntime;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS42;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS50;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS51;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS6x;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS70;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS71;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform43;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform5x;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss42Runtime;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss50Runtime;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss51Runtime;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss6xRuntime;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss70Runtime;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss71Runtime;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform43Runtime;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform5xRuntime;
+import org.jboss.tools.ui.bot.ext.gen.IServer;
+import org.jboss.tools.ui.bot.ext.gen.IServerRuntime;
/**
* adds server (version and type depends on {@link TestConfigurator#server})
* @author lzoubek
@@ -150,9 +152,12 @@
if (version!=null && version.startsWith("6")) {
return new ServerInfo(JBossCommunityJBoss6xRuntime.LABEL,JBossCommunityJBossAS6x.LABEL);
}
- if (version!=null && version.startsWith("7")) {
- return new ServerInfo(JBossCommunityJBoss7xRuntime.LABEL,JBossCommunityJBossAS7x.LABEL);
+ if ("7.0".equals(version)) {
+ return new ServerInfo(JBossCommunityJBoss70Runtime.LABEL,JBossCommunityJBossAS70.LABEL);
}
+ if ("7.1".equals(version)) {
+ return new ServerInfo(JBossCommunityJBoss71Runtime.LABEL,JBossCommunityJBossAS71.LABEL);
+ }
}
failParsing();
return null;
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java 2012-01-11 15:07:23 UTC (rev 37770)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java 2012-01-11 15:11:22 UTC (rev 37771)
@@ -1581,12 +1581,12 @@
*/
public static final String TEXT_DIRECTORY = "Directory:";
}
- public static class JBossCommunityJBossAS7x {
+ public static class JBossCommunityJBossAS70 {
/**
- * represents item : JBoss Community->JBoss AS 7.x
+ * represents item : JBoss Community->JBoss AS 7.0
*/
public static final IServer LABEL = new IServer() {
- public String getName() { return "JBoss AS 7.x";}
+ public String getName() { return "JBoss AS 7.0";}
public List<String> getGroupPath() {
List<String> l = new Vector<String>();
l.add("JBoss Community");
@@ -1598,6 +1598,23 @@
*/
public static final String TEXT_DIRECTORY = "Directory:";
}
+ public static class JBossCommunityJBossAS71 {
+ /**
+ * represents item : JBoss Community->JBoss AS 7.1
+ */
+ public static final IServer LABEL = new IServer() {
+ public String getName() { return "JBoss AS 7.1";}
+ public List<String> getGroupPath() {
+ List<String> l = new Vector<String>();
+ l.add("JBoss Community");
+ return l;
+ }
+ };
+ /**
+ * text field labeled 'Directory:'
+ */
+ public static final String TEXT_DIRECTORY = "Directory:";
+ }
public static class ApacheTomcatv32Server {
/**
* represents item : Apache->Tomcat v3.2 Server
@@ -10625,12 +10642,12 @@
*/
public static final String TEXT_DIRECTORY = "Directory:";
}
- public static class JBossCommunityJBoss7xRuntime {
+ public static class JBossCommunityJBoss70Runtime {
/**
- * represents item : JBoss Community->JBoss 7.x Runtime
+ * represents item : JBoss Community->JBoss 7.0 Runtime
*/
public static final IServerRuntime LABEL = new IServerRuntime() {
- public String getName() { return "JBoss 7.x Runtime";}
+ public String getName() { return "JBoss 7.0 Runtime";}
public List<String> getGroupPath() {
List<String> l = new Vector<String>();
l.add("JBoss Community");
@@ -10642,6 +10659,23 @@
*/
public static final String TEXT_DIRECTORY = "Directory:";
}
+ public static class JBossCommunityJBoss71Runtime {
+ /**
+ * represents item : JBoss Community->JBoss 7.1 Runtime
+ */
+ public static final IServerRuntime LABEL = new IServerRuntime() {
+ public String getName() { return "JBoss 7.1 Runtime";}
+ public List<String> getGroupPath() {
+ List<String> l = new Vector<String>();
+ l.add("JBoss Community");
+ return l;
+ }
+ };
+ /**
+ * text field labeled 'Directory:'
+ */
+ public static final String TEXT_DIRECTORY = "Directory:";
+ }
public static class ApacheApacheTomcatv32 {
/**
* represents item : Apache->Apache Tomcat v3.2
12 years, 12 months
JBoss Tools SVN: r37770 - trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 10:07:23 -0500 (Wed, 11 Jan 2012)
New Revision: 37770
Modified:
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF
Log:
Changed version of drools eclipse bundle.
Modified: trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF 2012-01-11 14:46:24 UTC (rev 37769)
+++ trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/META-INF/MANIFEST.MF 2012-01-11 15:07:23 UTC (rev 37770)
@@ -12,7 +12,7 @@
org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
org.junit4;bundle-version="4.5.0",
org.jboss.tools.ui.bot.ext,
- org.drools.eclipse;bundle-version="5.1.0",
+ org.drools.eclipse;bundle-version="5.3.0",
org.eclipse.swtbot.eclipse.gef.finder,
org.apache.log4j;bundle-version="1.2.13"
Bundle-ActivationPolicy: lazy
12 years, 12 months
JBoss Tools SVN: r37769 - trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:46:24 -0500 (Wed, 11 Jan 2012)
New Revision: 37769
Modified:
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
Log:
Fixed problem with second run.
Modified: trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
===================================================================
--- trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2012-01-11 14:43:35 UTC (rev 37768)
+++ trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2012-01-11 14:46:24 UTC (rev 37769)
@@ -12,16 +12,17 @@
import java.io.File;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
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.DecisionTableTest;
import org.jboss.tools.drools.ui.bot.test.smoke.DomainSpecificLanguageEditorTest;
-//import org.jboss.tools.drools.ui.bot.test.smoke.GuidedDroolsRulesEditorTest;
+import org.jboss.tools.drools.ui.bot.test.smoke.DroolsRulesEditorTest;
+import org.jboss.tools.drools.ui.bot.test.smoke.DroolsViewsTest;
import org.jboss.tools.drools.ui.bot.test.smoke.GuvnorRepositoriesTest;
-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.drools.ui.bot.test.smoke.DroolsRulesEditorTest;
+import org.jboss.tools.drools.ui.bot.test.smoke.ManageDroolsRuntime;
import org.jboss.tools.drools.ui.bot.test.smoke.OpenDroolsPerspective;
import org.jboss.tools.drools.ui.bot.test.smoke.RuleFlowTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
@@ -52,7 +53,8 @@
DomainSpecificLanguageEditorTest.class,
RuleFlowTest.class,
DecisionTableTest.class,
- GuvnorRepositoriesTest.class})
+ GuvnorRepositoriesTest.class,
+ DroolsViewsTest.class})
public class DroolsAllBotTests extends SWTTestExt {
public static final String DROOLS_PROJECT_NAME = "droolsTest";
public static final String DROOLS_RUNTIME_NAME = "Drools Test Runtime";
@@ -67,12 +69,13 @@
public static final String GUIDED_DROOLS_RULE_NAME = "GuidedRule.brl";
public static final String DOMAIN_SPECIFIC_LANGUAGE_FILE_NAME = "DslTest.dsl";
public static final String RULE_FLOW_JAVA_TEST_FILE_NAME = "ProcessTest.java";
- public static final String RULE_FLOW_RF_FILE_NAME = "ruleflow.rf";
+ public static final String RULE_FLOW_RF_FILE_NAME = "ruleflow.rf";//"sample.bpmn";
public static final String DECISION_TABLE_JAVA_TEST_FILE_NAME = "DecisionTableTest.java";
public static final String USE_EXTERNAL_DROOLS_RUNTIME_PROPERTY_NAME = "use-external-drools-runtime";
public static final String EXTERNAL_DROOLS_RUTIME_HOME_PROPERTY_NAME = "external-drools-runtime-home";
public static final String GUVNOR_REPOSITORY_URL_PROPERTY_NAME = "guvnor-repository-url";
private static boolean USE_EXTERNAL_DROOLS_RUNTIME;
+ private static boolean isFirstRun = true;
private static String testDroolsRuntimeName = null;
private static String testDroolsRuntimeLocation = null;
@@ -114,6 +117,11 @@
@BeforeClass
public static void setUpTest() {
+ if (isFirstRun) {
+ isFirstRun = false;
+ } else {
+ return;
+ }
props = util.loadProperties(Activator.PLUGIN_ID);
String guvnorRepositoryUrl = props.getProperty(DroolsAllBotTests.GUVNOR_REPOSITORY_URL_PROPERTY_NAME);
if (guvnorRepositoryUrl != null){
@@ -124,7 +132,7 @@
DroolsAllBotTests.USE_EXTERNAL_DROOLS_RUNTIME = useExternalDroolRuntime != null && useExternalDroolRuntime.equalsIgnoreCase("true");
String droolsRuntimeLocation = props.getProperty(DroolsAllBotTests.EXTERNAL_DROOLS_RUTIME_HOME_PROPERTY_NAME);
String tmpDir = System.getProperty("java.io.tmpdir");
- if (droolsRuntimeLocation == null || droolsRuntimeLocation.length() ==0){
+ if (droolsRuntimeLocation == null || droolsRuntimeLocation.length() == 0) {
DroolsAllBotTests.DROOLS_RUNTIME_LOCATION = tmpDir;
}
else{
@@ -134,11 +142,19 @@
// Create directory for Drools Runtime which will be created as a part of test
new File(DroolsAllBotTests.CREATE_DROOLS_RUNTIME_LOCATION).mkdir();
try{
+ bot.button(IDELabel.Button.NO).click();
SWTBotView welcomeView = eclipse.getBot().viewByTitle(IDELabel.View.WELCOME);
welcomeView.close();
} catch (WidgetNotFoundException wnfe){
// Do nothing ignore this error
}
+ // Close JBoss Central editor
+ for (SWTBotEditor editor : bot.editors()) {
+ if (IDELabel.View.JBOSS_CENTRAL.equals(editor.getTitle())) {
+ editor.close();
+ break;
+ }
+ }
eclipse.openPerspective(PerspectiveType.JAVA);
eclipse.maximizeActiveShell();
}
12 years, 12 months
JBoss Tools SVN: r37768 - trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:43:35 -0500 (Wed, 11 Jan 2012)
New Revision: 37768
Modified:
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/pom.xml
Log:
Added information about test suite.
Modified: trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/pom.xml
===================================================================
--- trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/pom.xml 2012-01-11 14:40:14 UTC (rev 37767)
+++ trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/pom.xml 2012-01-11 14:43:35 UTC (rev 37768)
@@ -9,7 +9,7 @@
<groupId>org.jboss.tools.drools</groupId>
<artifactId>org.jboss.tools.drools.ui.bot.test</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
+ <packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
@@ -18,6 +18,8 @@
<version>${tychoVersion}</version>
<configuration>
<useUIThread>false</useUIThread>
+ <testSuite>org.jboss.tools.drools.ui.bot.test</testSuite>
+ <testClass>org.jboss.tools.drools.ui.bot.test.DroolsAllBotTests</testClass>
</configuration>
</plugin>
</plugins>
12 years, 12 months
JBoss Tools SVN: r37767 - trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:40:14 -0500 (Wed, 11 Jan 2012)
New Revision: 37767
Modified:
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
Log:
Made some changes for improving tests stability.
Modified: trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java
===================================================================
--- trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java 2012-01-11 14:29:20 UTC (rev 37766)
+++ trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/GuvnorRepositoriesTest.java 2012-01-11 14:40:14 UTC (rev 37767)
@@ -143,8 +143,8 @@
IDELabel.Menu.OPEN_GUVNOR_CONSOLE, false)).click();
bot.sleep(Timing.time5S());
SWTBotBrowserExt browser = bot.browserByTitle(IDELabel.GuvnorConsole.GUVNOR_CONSOLE_TITLE);
- browser.setInputTextViaJavaScript(GuvnorRepositoriesTest.GUVNOR_USER_NAME, 0, bot);
- browser.setInputTextViaJavaScript(GuvnorRepositoriesTest.GUVNOR_PASSWORD, 1, bot);
+ browser.setInputTextViaJavaScript(GuvnorRepositoriesTest.GUVNOR_USER_NAME, 1, bot);
+ browser.setInputTextViaJavaScript(GuvnorRepositoriesTest.GUVNOR_PASSWORD, 2, bot);
browser.clickOnButtonViaJavaScript(0, bot);
browser.clickOnButtonViaJavaScript(IDELabel.GuvnorConsole.BUTTON_YES_INSTALL_SAMPLES, bot);
bot.sleep(Timing.time1S());
@@ -213,8 +213,7 @@
SWTBotTreeItem tiDroolRuleDir = packageExplorer.selectTreeItem(DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE,
new String[] {DroolsAllBotTests.DROOLS_PROJECT_NAME});
DragAndDropHelper.dragAndDropOnTo(tiGuvnorFile.widget,tiDroolRuleDir.widget);
- bot.sleep(Timing.time5S());
- bot.shell(IDELabel.Shell.COPY_FILE_FROM_GUVNOR_TO_PACKAGE_EXPLORER).activate();
+ bot.waitForShell(IDELabel.Shell.COPY_FILE_FROM_GUVNOR_TO_PACKAGE_EXPLORER).activate();
bot.button(IDELabel.Button.OK).click();
SWTBotTree packageExplorerTree = packageExplorerBot.tree();
// File is renamed because there is appended Guvnor info to Tree Item Label
Modified: trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java
===================================================================
--- trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java 2012-01-11 14:29:20 UTC (rev 37766)
+++ trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsProject.java 2012-01-11 14:40:14 UTC (rev 37767)
@@ -41,41 +41,46 @@
private static final String RENAMED_DROOLS_PROJECT = DroolsAllBotTests.DROOLS_PROJECT_NAME + "-renamed";
@Test
public void testManageDroolsProject() {
- createDroolsProject (DroolsAllBotTests.DROOLS_PROJECT_NAME);
+ createDroolsProjectTest (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);
+ createDroolsProjectTest (DroolsAllBotTests.DROOLS_PROJECT_NAME);
}
+
+ public static void createDroolsProject(String droolsProjectName) {
+ eclipse.showView(ViewType.PACKAGE_EXPLORER);
+ eclipse.createNew(EntityType.DROOLS_PROJECT);
+ bot.textWithLabel(IDELabel.NewDroolsProjectDialog.NAME).setText(droolsProjectName);
+ bot.button(IDELabel.Button.NEXT).click();
+ // check all buttons
+ int index = 0;
+ boolean checkBoxExists = true;
+ while (checkBoxExists){
+ try{
+ SWTBotCheckBox checkBox = bot.checkBox(index);
+ if (!checkBox.isChecked()){
+ checkBox.click();
+ }
+ index++;
+ }catch (WidgetNotFoundException wnfe){
+ checkBoxExists = false;
+ }catch (IndexOutOfBoundsException ioobe){
+ checkBoxExists = false;
+ }
+ }
+ bot.button(IDELabel.Button.NEXT).click();
+ bot.comboBoxWithLabel(IDELabel.NewDroolsProjectDialog.GENERATE_CODE_COMPATIBLE_WITH_COMBO_BOX_LABEL)
+ .setSelection(IDELabel.NewDroolsProjectDialog.CODE_COMPATIBLE_WITH_50_DROOLS);
+ bot.button(IDELabel.Button.FINISH).click();
+ }
+
/**
* Creates new Drools project
* @param droolsProjectName
*/
- private void createDroolsProject(String droolsProjectName){
- eclipse.showView(ViewType.PACKAGE_EXPLORER);
- eclipse.createNew(EntityType.DROOLS_PROJECT);
- bot.textWithLabel(IDELabel.NewDroolsProjectDialog.NAME).setText(droolsProjectName);
- bot.button(IDELabel.Button.NEXT).click();
- // check all buttons
- int index = 0;
- boolean checkBoxExists = true;
- while (checkBoxExists){
- try{
- SWTBotCheckBox checkBox = bot.checkBox(index);
- if (!checkBox.isChecked()){
- checkBox.click();
- }
- index++;
- }catch (WidgetNotFoundException wnfe){
- checkBoxExists = false;
- }catch (IndexOutOfBoundsException ioobe){
- checkBoxExists = false;
- }
- }
- bot.button(IDELabel.Button.NEXT).click();
- bot.comboBoxWithLabel(IDELabel.NewDroolsProjectDialog.GENERATE_CODE_COMPATIBLE_WITH_COMBO_BOX_LABEL)
- .setSelection(IDELabel.NewDroolsProjectDialog.CODE_COMPATIBLE_WITH_50_DROOLS);
- bot.button(IDELabel.Button.FINISH).click();
+ private void createDroolsProjectTest(String droolsProjectName){
+ createDroolsProject(droolsProjectName);
SWTTestExt.util.waitForAll(30*1000L);
bot.sleep(Timing.time10S());
assertTrue("Project "
@@ -138,12 +143,13 @@
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{
Modified: trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java
===================================================================
--- trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java 2012-01-11 14:29:20 UTC (rev 37766)
+++ trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/ManageDroolsRules.java 2012-01-11 14:40:14 UTC (rev 37767)
@@ -99,7 +99,6 @@
DroolsAllBotTests.COM_SAMPLE_TREE_NODE});
console.clearConsole();
eclipse.debugTreeItemAsDroolsApplication(tiDroolsTest);
- bot.sleep(Timing.time10S());
eclipse.closeConfirmPerspectiveSwitchShellIfOpened(false);
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,
12 years, 12 months
JBoss Tools SVN: r37766 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:29:20 -0500 (Wed, 11 Jan 2012)
New Revision: 37766
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
Log:
Added delay.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2012-01-11 14:28:07 UTC (rev 37765)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2012-01-11 14:29:20 UTC (rev 37766)
@@ -514,6 +514,7 @@
SWTWorkbenchBot bot = new SWTWorkbenchBot();
SWTBotShell shJbtUsage = null;
SWTBotShell shSubclipseUsage = null;
+ bot.sleep(Timing.time1S());
new SWTUtilExt(bot).waitForNonIgnoredJobs();
SWTBotShell[] shells = bot.shells();
int index = 0;
12 years, 12 months
JBoss Tools SVN: r37765 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:28:07 -0500 (Wed, 11 Jan 2012)
New Revision: 37765
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
Added some static strings.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-01-11 14:27:16 UTC (rev 37764)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-01-11 14:28:07 UTC (rev 37765)
@@ -60,9 +60,12 @@
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";
+ public static final String RESUME = "Resume";
+ public static final String TERMINATE = "Terminate";
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 REMOVE_ALL_BREAKPOINTS = "Remove All Breakpoints";
public static final String DEBUG_AS = "Debug As";
public static final String DEBUG_AS_DROOLS_APPLICATION = "Drools Application";
public static final String OPEN_GUVNOR_CONSOLE = "Open Guvnor Console";
@@ -88,6 +91,9 @@
public static final String CDI_REFACTOR = "CDI Refactor";
public static final String CLEAN = "Clean...";
public static final String CREATE_JSF2_COMPOSITE = "Create JSF2 composite...";
+ public static final String MENU_STEP_OVER = "Step Over";
+ public static final String MENU_RESUME = "Resume";
+ public static final String MENU_TERMINATE = "Terminate";
}
public class Button {
@@ -198,6 +204,8 @@
public static final String JBOSS_DEVELOPER_STUDIO_USAGE = "JBoss Developer Studio Usage";
public static final String JBOSS_TOOLS_USAGE = "JBoss Tools Usage";
public static final String SUBCLIPSE_USAGE = "Subclipse Usage";
+ public static final String PROGRESS_INFORMATION = "Progress Information";
+ public static final String REMEMBER_MY_DECISION = "Remember my decision";
}
public class EntityGroup {
@@ -263,6 +271,13 @@
public static final String JBOSS_TOOLS_PALETTE = "JBoss Tools Palette";
public static final String PALETTE = "Palette";
public static final String JBOSS_CENTRAL = "JBoss Central";
+ public static final String AGENDA = "Agenda";
+ public static final String AUDIT = "Audit";
+ public static final String GLOBAL_DATA = "Global Data";
+ public static final String PROCESS_INSTANCE = "Process Instance";
+ public static final String PROCESS_INSTANCES = "Process Instances";
+ public static final String RULES = "Rules";
+ public static final String WORKING_MEMORY = "Working Memory";
}
public class ViewGroup {
12 years, 12 months
JBoss Tools SVN: r37764 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:27:16 -0500 (Wed, 11 Jan 2012)
New Revision: 37764
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java
Log:
Added methods that wait for displaying a shell and then return it.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java 2012-01-11 14:25:31 UTC (rev 37763)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java 2012-01-11 14:27:16 UTC (rev 37764)
@@ -27,6 +27,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.ui.forms.widgets.Hyperlink;
@@ -189,4 +190,55 @@
}
}
+ /**
+ * Waits for shell with given title.
+ * Maximum waiting time is 30 seconds.
+ *
+ * @param shellTitle Title of shell which it should wait for.
+ * @return Shell which it was waiting for or <code>null</code>
+ * if the shell was not displayed during waiting time.
+ * @see #waitForShell(String, int)
+ */
+ public SWTBotShell waitForShell(final String shellTitle) {
+ return waitForShell(shellTitle, -1);
+ }
+
+ /**
+ * Waits for desired shell with given timeout
+ * and return this shell when it is displayed.
+ *
+ * @param shellTitle Title of desired shell.
+ * @param maxTimeout Maximum waiting time in seconds (actual timeout can be one second more).
+ * Negative value means default timeout (30 seconds).
+ * @return Shell which it was waiting for or <code>null</code>
+ * if the shell was not displayed during waiting time.
+ */
+ public SWTBotShell waitForShell(final String shellTitle, final int maxTimeout) {
+ if (shellTitle == null) {
+ throw new IllegalArgumentException("shellTitle cannot be null");
+ }
+
+ final int SLEEP_TIME = Timing.time2S();
+ final int ATTEMPTS_TIMEOUT;
+
+ if (maxTimeout < 0) {
+ ATTEMPTS_TIMEOUT = 15;
+ } else {
+ final int result = (int)Math.ceil((double)(maxTimeout * 1000) / (double)SLEEP_TIME);
+ ATTEMPTS_TIMEOUT = result < 1 ? 1 : result;
+ }
+
+ for (int i = 0; i < ATTEMPTS_TIMEOUT; i++) {
+ if (maxTimeout != 0) {
+ sleep(SLEEP_TIME);
+ }
+ for (SWTBotShell shell : shells()) {
+ if (shellTitle.equals(shell.getText())) {
+ return shell;
+ }
+ }
+ }
+
+ return null;
+ }
}
12 years, 12 months
JBoss Tools SVN: r37763 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:25:31 -0500 (Wed, 11 Jan 2012)
New Revision: 37763
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
Log:
Some methods optimalization and added new methods for debugging.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-01-11 14:15:05 UTC (rev 37762)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-01-11 14:25:31 UTC (rev 37763)
@@ -33,6 +33,7 @@
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
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.finders.UIThreadRunnable;
@@ -44,7 +45,6 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.hamcrest.Matcher;
import org.jboss.tools.ui.bot.ext.condition.ButtonIsDisabled;
import org.jboss.tools.ui.bot.ext.entity.JavaClassEntity;
@@ -109,33 +109,45 @@
// ------------------------------------------------------------
// Check methods
// ------------------------------------------------------------
- /**
- * Check if view is opened
- */
- public boolean isViewOpened(String view) {
- try {
- bot.viewByTitle(view);
- log.info("View \"" + view + "\" is opened");
- return true;
- }
- catch (WidgetNotFoundException ex) {
- log.info("View \"" + view + "\" is NOT opened");
- return false;
- }
- }
+
+ /**
+ * Checks if view is opened.
+ *
+ * @return <code>true</code> if view with given <code>viewTitle</code>
+ * is opened, <code>false</code> otherwise.
+ */
+ public boolean isViewOpened(final String viewTitle) {
+ if (viewTitle == null) {
+ throw new IllegalArgumentException("viewTitle cannot be null");
+ }
+ for (SWTBotView view : bot.views()) {
+ if (viewTitle.equals(view.getTitle())) {
+ return true;
+ }
+ }
+ return false;
+ }
// ------------------------------------------------------------
// View related methods
// ------------------------------------------------------------
- /**
- * Close view by text
- */
- public void closeView(String view) {
- try {
- bot.viewByTitle(view).close();
- } catch (WidgetNotFoundException ex) {
- log.info("WARN - Can't close the view \"" + view + "\"");
- }
+
+ /**
+ * Close view with given title.
+ * If view is closed nothing happens.
+ *
+ * @param viewTitle Title of view which should be closed.
+ */
+ public void closeView(final String viewTitle) {
+ if (viewTitle == null) {
+ throw new IllegalArgumentException("viewTitle cannot be null");
+ }
+ for (SWTBotView view : bot.views()) {
+ if (viewTitle.equals(view.getTitle())) {
+ view.close();
+ break;
+ }
+ }
}
/**
@@ -972,24 +984,46 @@
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
+ /**
+ * if Confirm Perspective Switch Shell is opened close it and depend on
+ * switchPerspective parameter change current perspective
+ *
+ * @param switchPerspective
+ */
+ public void closeConfirmPerspectiveSwitchShellIfOpened(final boolean switchPerspective) {
+ closeConfirmPerspectiveSwitchShellIfOpened(switchPerspective, false);
}
- }
-
+
+ /**
+ * This method closes Confirm Perspective Switch dialog if it is opened.
+ * Otherwise nothing happens.
+ *
+ * @param switchPerspective If <code>true</code> perspective switches,
+ * if <code>false</code> perspective does not switch.
+ * @param rememberMyDecision If <code>true</code> it checks "Remember my decision" option.
+ */
+ public void closeConfirmPerspectiveSwitchShellIfOpened(
+ final boolean switchPerspective, final boolean rememberMyDecision) {
+ while (bot.waitForShell(IDELabel.Shell.PROGRESS_INFORMATION, 1) != null) {
+ // nothing to do, waiting time is included in waitForShell method
+ }
+
+ // Finds confirmation shell and waits for it
+ SWTBotShell confirmationShell = bot.waitForShell(IDELabel.Shell.CONFIRM_PERSPECTIVE_SWITCH);
+
+ // confirmation dialog is not shown, let it be
+ if (confirmationShell == null) {
+ return;
+ }
+
+ // close confirmation dialog
+ confirmationShell.activate();
+ if (rememberMyDecision) {
+ bot.checkBox(IDELabel.Shell.REMEMBER_MY_DECISION).click();
+ }
+ bot.button(switchPerspective ? IDELabel.Button.YES : IDELabel.Button.NO).click();
+ }
+
/**
* Returns true if table column specified by column parameter contains item
*
@@ -1374,7 +1408,9 @@
SWTEclipseExt.getMenuFromSubmenu(
bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.DEBUG_AS),
IDELabel.Menu.DEBUG_AS_DROOLS_APPLICATION).click();
- }
+ }
+
+
/**
* Returns true if parentNode containss Tree Item with nodeLabel
* @param parentNode
@@ -1415,31 +1451,43 @@
return false;
}
}
- /**
- * 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;
+
+ /**
+ * Returns <code>true</code> if editor with <code>editorLabel</code> exists within bot.
+ * static version
+ *
+ * @param bot Bot for finding editor.
+ * @param editorLabel Title of tested editor.
+ * @return <code>true</code> if editor with <code>editorLabel</code> exists,
+ * <code>false</code> otherwise.
+ */
+ public static boolean existEditorWithLabel(final SWTBotExt bot, final String editorLabel) {
+ if (bot == null) {
+ throw new NullPointerException("bot cannot be null");
+ }
+ if (editorLabel == null) {
+ throw new NullPointerException("editorLabel cannot be null");
+ }
+ for (SWTBotEditor editor : bot.editors()) {
+ if (editorLabel.equals(editor.getTitle())) {
+ return true;
+ }
+ }
+ return false;
}
- return editorExists;
- }
+
+ /**
+ * Returns <code>true</code> if editor with <code>editorLabel</code> exists.
+ *
+ * @param editorLabel Title of tested editor.
+ * @return <code>true</code> if editor with <code>editorLabel</code> exists,
+ * <code>false</code> otherwise.
+ */
+ public boolean existEditorWithLabel(final String editorLabel) {
+ return SWTEclipseExt.existEditorWithLabel(bot, editorLabel);
+ }
+
/**
- * Returns true if editor with editorLabel exists
- * @param editorLabel
- * @return
- */
- public boolean existEditorWithLabel(String editorLabel){
- return SWTEclipseExt.existEditorWithLabel(bot, editorLabel);
- }
- /**
* Maximizes active shell
*/
public void maximizeActiveShell() {
@@ -1473,19 +1521,20 @@
return null;
}
}
- /**
- * Closes all opened Editors
- */
- public void closeAllEditors(){
- try{
- bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.CLOSE_ALL).click();
- log.info("All Editors closed");
- } catch (WidgetNotFoundException wnfe){
- log.info("No Editors to close");
- } catch (TimeoutException te){
- log.info("No Editors to close");
+
+ /**
+ * Closes all opened editors.
+ */
+ public void closeAllEditors() {
+ SWTBotMenu closeAllMenu = bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.CLOSE_ALL);
+ if (closeAllMenu.isEnabled()) {
+ closeAllMenu.click();
+ log.info("All editors were closed");
+ } else {
+ log.info("No editors to close");
+ }
}
- }
+
/**
* Opens properties dialog of project with projectName
* @param projectName
@@ -1546,4 +1595,95 @@
log.info("File Deleted: " + builder.toString());
}
+
+ // ------------------------------------------------------------
+ // Debugging related methods
+ // ------------------------------------------------------------
+
+ /**
+ * @return <code>true</code> if debug is running, <code>false</code> otherwise
+ */
+ public boolean isDebugging() {
+ return bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.TERMINATE).isEnabled();
+ }
+
+ /**
+ * Goes through all breakpoints while debug is finished.
+ */
+ public void finishDebug() {
+ SWTBotMenu runMenu = bot.menu(IDELabel.Menu.RUN);
+ while (isDebugging()) {
+ if (runMenu.menu(IDELabel.Menu.RESUME).isEnabled()) {
+ runMenu.menu(IDELabel.Menu.RESUME).click();
+ }
+ bot.sleep(Timing.time2S());
+ }
+ }
+
+ /**
+ * Does one step in debugging after stopping at breakpoint.
+ */
+ public void stepOver() {
+ SWTBotMenu stepOverMenu = bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.MENU_STEP_OVER);
+ if (stepOverMenu.isEnabled()) {
+ stepOverMenu.click();
+ } else {
+ log.info("It is not possible to step over. (Step Over menu is disabled)");
+ }
+ }
+
+ /**
+ * Resumes debug (F8).
+ */
+ public void resumeDebug() {
+ SWTBotMenu resumeMenu = bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.MENU_RESUME);
+ if (resumeMenu.isEnabled()) {
+ resumeMenu.click();
+ } else {
+ log.info("It is not possible to resume debugging. (Resume menu is disabled)");
+ }
+ }
+
+ /**
+ * Sets breakpoints at desired lines.
+ * Before settings new breakpoints all old ones are removed.
+ *
+ * @param breakpointsLineNumbers Line numbers of desired breakpoints
+ */
+ public void setNewBreakpoints(final SWTBotEclipseEditor editor, final int... breakpointsLineNumbers) {
+ removeBreakpoints(editor);
+ setBreakpoints(editor, breakpointsLineNumbers);
+ }
+
+ /**
+ * Remove all breakpoints in active editor.
+ */
+ public void removeBreakpoints(final SWTBotEclipseEditor editor) {
+ if (editor == null) {
+ throw new NullPointerException("editor cannot be null");
+ }
+ editor.show();
+ SWTBotMenu removeBreakpointMenu = bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.REMOVE_ALL_BREAKPOINTS);
+ if (removeBreakpointMenu.isEnabled()) {
+ removeBreakpointMenu.click();
+ bot.button(IDELabel.Button.YES).click();
+ }
+ }
+
+ /**
+ * This methods sets breakpoints at given lines.
+ *
+ * @param breakpointsLineNumbers Line numbers of wanted breakpoints.
+ */
+ public void setBreakpoints(final SWTBotEclipseEditor editor, final int... breakpointsLineNumbers) {
+ if (editor == null) {
+ throw new NullPointerException("editor cannot be null");
+ }
+ editor.show();
+ for (int i = 0; i < breakpointsLineNumbers.length; i++) {
+ editor.selectRange(breakpointsLineNumbers[i], 0, 0);
+ bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.TOGGLE_BREAKPOINT).click();
+ }
+ }
+
}
\ No newline at end of file
12 years, 12 months