JBoss Tools SVN: r42887 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2012-08-07 11:36:51 -0400 (Tue, 07 Aug 2012)
New Revision: 42887
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
Log:
Fix error message.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java 2012-08-07 14:41:42 UTC (rev 42886)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java 2012-08-07 15:36:51 UTC (rev 42887)
@@ -160,8 +160,9 @@
ContentAssistBot contentAssist = editor.contentAssist();
contentAssist.invokeContentAssist();
String editorLineAfterInsert = editor.getTextOnCurrentLine();
- assertTrue("Text on current line should be:\n" +
- "but is :\n" + editorLineAfterInsert
+ assertTrue("Text on current line should be:\n" +
+ expectedEditorLineAfterInsert +
+ "\nbut is:\n" + editorLineAfterInsert
, editorLineAfterInsert.equals(expectedEditorLineAfterInsert));
return editor;
12 years, 5 months
JBoss Tools SVN: r42886 - branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: mmalina
Date: 2012-08-07 10:41:42 -0400 (Tue, 07 Aug 2012)
New Revision: 42886
Modified:
branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/pom.xml
Log:
Added missing config for maven-download-plugin
Modified: branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/pom.xml
===================================================================
--- branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/pom.xml 2012-08-07 14:34:05 UTC (rev 42885)
+++ branches/jbosstools-3.3.x/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/pom.xml 2012-08-07 14:41:42 UTC (rev 42886)
@@ -13,6 +13,7 @@
<packaging>eclipse-test-plugin</packaging>
<properties>
+ <requirementsDirectory>${project.build.directory}/requirements</requirementsDirectory>
<jbosstools.test.jboss-as-7.1.home>${requirementsDirectory}/jboss-as-7.1.1.Final</jbosstools.test.jboss-as-7.1.home>
<jbosstools.test.jboss-as-7.1.url>http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1...</jbosstools.test.jboss-as-7.1.url>
<jbosstools.test.jboss-as-7.1.md5>175c92545454f4e7270821f4b8326c4e</jbosstools.test.jboss-as-7.1.md5>
@@ -50,6 +51,11 @@
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>maven-download-plugin</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ <configuration>
+ <skip>${skipRequirements}</skip>
+ <outputDirectory>${requirementsDirectory}</outputDirectory>
+ </configuration>
<executions>
<execution>
<id>install-as-7.1.1</id>
12 years, 5 months
JBoss Tools SVN: r42885 - in trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-07 10:34:05 -0400 (Tue, 07 Aug 2012)
New Revision: 42885
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/META-INF/MANIFEST.MF
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
Log:
dummy ui bot test logging issues fixed
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/META-INF/MANIFEST.MF 2012-08-07 14:16:02 UTC (rev 42884)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/META-INF/MANIFEST.MF 2012-08-07 14:34:05 UTC (rev 42885)
@@ -6,6 +6,8 @@
Bundle-Activator: org.jboss.tools.dummy.ui.bot.test.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.swtbot.go;bundle-version="2.0.5"
+ org.eclipse.swtbot.go;bundle-version="2.0.5",
+ org.apache.log4j
+Eclipse-RegisterBuddy: org.apache.log4j
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties 2012-08-07 14:16:02 UTC (rev 42884)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties 2012-08-07 14:34:05 UTC (rev 42885)
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ src/log4j.xml
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 14:16:02 UTC (rev 42884)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 14:34:05 UTC (rev 42885)
@@ -4,11 +4,7 @@
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
import static org.junit.Assert.assertEquals;
-import java.io.OutputStreamWriter;
-
-import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
@@ -25,24 +21,14 @@
@RunWith(SWTBotJunit4ClassRunner.class)
public class DummyTest {
- static Logger log = Logger.getLogger(DummyTest.class);
+ static Logger log = Logger.getLogger("");
@BeforeClass
public static void before() {
- ConsoleAppender ca = new ConsoleAppender();
- ca.setWriter(new OutputStreamWriter(System.out));
- ca.setLayout(new PatternLayout("[%-5p] %t: %m%n"));
- log.addAppender(ca);
}
@Test
public void dummyTest() {
- Logger log = Logger.getLogger(this.getClass());
- ConsoleAppender ca = new ConsoleAppender();
- ca.setWriter(new OutputStreamWriter(System.out));
- ca.setLayout(new PatternLayout("[%-5p] %t: %m%n"));
- log.addAppender(ca);
-
String pref = "Preferences";
SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.menu("Window").menu(pref).click();
@@ -54,8 +40,12 @@
@Test
public void hundredTimes() {
- for (int i = 0 ; i < 100; i++)
+ final int cycles = 100;
+ for (int i = 0 ; i < cycles ; i++)
+ {
dummyTest();
+ log.info(i+1 + "/" + cycles + " try passed");
+ }
}
@AfterClass
12 years, 5 months
JBoss Tools SVN: r42884 - trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-08-07 10:16:02 -0400 (Tue, 07 Aug 2012)
New Revision: 42884
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-10738 As-you-type EL validation
Infinite loop possibility is fixed
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-07 14:01:52 UTC (rev 42883)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-07 14:16:02 UTC (rev 42884)
@@ -478,8 +478,10 @@
}
element = unit.getElementAt(position);
- if (element == null)
+ if (element == null) {
+ position++;
continue;
+ }
atLeastOneElementIsProcessed = true;
boolean doSkipThisElement = false;
12 years, 5 months
JBoss Tools SVN: r42883 - in branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext: META-INF and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: mmalina
Date: 2012-08-07 10:01:52 -0400 (Tue, 07 Aug 2012)
New Revision: 42883
Added:
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ViewIsActive.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/entity/XMLConfiguration.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/SubversiveHelper.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java
Modified:
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/logging/LogWidgetsVisitor.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/matcher/console/ConsoleOutputMatcher.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/wizards/SWTBotWizard.java
Log:
Updated bot ext with updates from trunk.
Property changes on: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk/tests/plugins/org.jboss.tools.ui.bot.ext:41456-42878
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,60 +1,60 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Ext
-Bundle-SymbolicName: org.jboss.tools.ui.bot.ext
-Bundle-Version: 3.2.0.qualifier
-Bundle-ClassPath: .,
- resources/drv/hsqldb.jar
-Bundle-Activator: org.jboss.tools.ui.bot.ext.Activator
-Export-Package:
- org.jboss.tools.ui.bot.ext,
- org.jboss.tools.ui.bot.ext.condition,
- org.jboss.tools.ui.bot.ext.config,
- org.jboss.tools.ui.bot.ext.config.requirement,
- org.jboss.tools.ui.bot.ext.entity,
- org.jboss.tools.ui.bot.ext.gef,
- org.jboss.tools.ui.bot.ext.gen,
- org.jboss.tools.ui.bot.ext.generator,
- org.jboss.tools.ui.bot.ext.helper,
- org.jboss.tools.ui.bot.ext.logging,
- org.jboss.tools.ui.bot.ext.matcher,
- org.jboss.tools.ui.bot.ext.matcher.console,
- 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.widgets,
- org.jboss.tools.ui.bot.ext.wizards,
- org.jboss.tools.ui.bot.ext.zest
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
- org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
- org.eclipse.swtbot.junit4_x;bundle-version="2.0.0",
- org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
- org.hamcrest;bundle-version="1.1.0",
- org.apache.log4j;bundle-version="1.2.13",
- org.eclipse.datatools.connectivity;bundle-version="1.1.2",
- org.eclipse.datatools.connectivity.db.generic;bundle-version="1.0.1",
- org.eclipse.ui.ide;bundle-version="3.5.1",
- org.eclipse.ui.forms;bundle-version="3.4.1",
- org.junit4;bundle-version="4.5.0",
- org.eclipse.jdt.core;bundle-version="3.5.0",
- org.eclipse.ui.editors;bundle-version="3.5.0",
- org.eclipse.core.resources;bundle-version="3.5.0",
- org.eclipse.draw2d;bundle-version="3.6.1",
- org.eclipse.zest.core;bundle-version="1.2.0",
- org.eclipse.zest.layouts;bundle-version="1.1.0",
- org.eclipse.swtbot.eclipse.gef.finder;bundle-version="2.0.0",
- org.eclipse.gef;bundle-version="3.6.1",
- org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.swtbot.forms.finder
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
-Import-Package: org.eclipse.gef,
- org.jboss.tools.ui.bot.ext.helper
-Eclipse-RegisterBuddy: org.apache.log4j
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Ext
+Bundle-SymbolicName: org.jboss.tools.ui.bot.ext
+Bundle-Version: 3.2.0.qualifier
+Bundle-ClassPath: .,
+ resources/drv/hsqldb.jar
+Bundle-Activator: org.jboss.tools.ui.bot.ext.Activator
+Export-Package:
+ org.jboss.tools.ui.bot.ext,
+ org.jboss.tools.ui.bot.ext.condition,
+ org.jboss.tools.ui.bot.ext.config,
+ org.jboss.tools.ui.bot.ext.config.requirement,
+ org.jboss.tools.ui.bot.ext.entity,
+ org.jboss.tools.ui.bot.ext.gef,
+ org.jboss.tools.ui.bot.ext.gen,
+ org.jboss.tools.ui.bot.ext.generator,
+ org.jboss.tools.ui.bot.ext.helper,
+ org.jboss.tools.ui.bot.ext.logging,
+ org.jboss.tools.ui.bot.ext.matcher,
+ org.jboss.tools.ui.bot.ext.matcher.console,
+ 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.widgets,
+ org.jboss.tools.ui.bot.ext.wizards,
+ org.jboss.tools.ui.bot.ext.zest
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.junit4_x;bundle-version="2.0.0",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
+ org.hamcrest;bundle-version="1.1.0",
+ org.apache.log4j;bundle-version="1.2.13",
+ org.eclipse.datatools.connectivity;bundle-version="1.1.2",
+ org.eclipse.datatools.connectivity.db.generic;bundle-version="1.0.1",
+ org.eclipse.ui.ide;bundle-version="3.5.1",
+ org.eclipse.ui.forms;bundle-version="3.4.1",
+ org.junit4;bundle-version="4.5.0",
+ org.eclipse.jdt.core;bundle-version="3.5.0",
+ org.eclipse.ui.editors;bundle-version="3.5.0",
+ org.eclipse.core.resources;bundle-version="3.5.0",
+ org.eclipse.draw2d;bundle-version="3.6.1",
+ org.eclipse.zest.core;bundle-version="1.2.0",
+ org.eclipse.zest.layouts;bundle-version="1.1.0",
+ org.eclipse.swtbot.eclipse.gef.finder;bundle-version="2.0.0",
+ org.eclipse.gef;bundle-version="3.6.1",
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.swtbot.forms.finder
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.gef,
+ org.jboss.tools.ui.bot.ext.helper
+Eclipse-RegisterBuddy: org.apache.log4j
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -123,7 +123,9 @@
this.config = config;
try {
- filter(categoryFilter);
+ if (categoryFilter != null){
+ filter(categoryFilter);
+ }
} catch (NoTestsRemainException e) {
// TODO Auto-generated catch block
throw new InitializationError(e);
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2012 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,
@@ -32,8 +32,8 @@
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.IDELabel.PreferencesDialog;
import org.jboss.tools.ui.bot.ext.types.ViewType;
-import org.jboss.tools.ui.bot.ext.types.IDELabel.PreferencesDialog;
import org.osgi.framework.Version;
/**
* Provides JBoss Tools common operations based on SWTBot element operations
@@ -310,8 +310,6 @@
*/
public static void runProjectOnServer(SWTWorkbenchBot bot, String projectName){
- bot.shells()[0].activate();
-
SWTBotTree packageExplorerTree = eclipse.showView(ViewType.PACKAGE_EXPLORER).tree();
packageExplorerTree.setFocus();
@@ -557,6 +555,15 @@
} catch (WidgetNotFoundException wnfe){
// do nothing there is no Atlassian Connector installed
}
+
+ // Get rid of welcome screen. Simple close did not work when run in maven
+ try {
+ bot.menu("Window").menu("Close Perspective").click();
+ SWTBotFactory.getOpen().perspective(ActionItem.Perspective.JAVA.LABEL);
+ } catch (WidgetNotFoundException e){
+ // ok, Welcome screen not present
+ log.info("Welcome window not present");
+ }
}
/**
* Closes JBoss Tools / JBoss Developer Studio Report Usage Window
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2012 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,
@@ -16,10 +16,12 @@
import static org.junit.Assert.fail;
import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
+import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Iterator;
@@ -43,7 +45,9 @@
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.Result;
import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
@@ -72,7 +76,7 @@
*/
public class SWTUtilExt extends SWTUtils {
- private Logger log = Logger.getLogger(SWTUtilExt.class);
+ private static Logger log = Logger.getLogger(SWTUtilExt.class);
protected SWTWorkbenchBot bot;
private static class AlwaysMatchMatcher<T extends Widget> extends BaseMatcher<T> {
@@ -198,32 +202,50 @@
/**
* Wait for named running jobs with defined TIMEOUT
+ * @param jobNames
*/
public void waitForJobs(String... jobNames) {
- waitForJobs(TIMEOUT, jobNames);
+ waitForJobs(false,TIMEOUT, jobNames);
}
+ /**
+ * Wait for named running jobs with defined TIMEOUT
+ *
+ * @param timeout
+ * @param jobNames
+ */
+ public void waitForJobs(long timeout ,String... jobNames) {
+ waitForJobs(false,timeout, jobNames);
+ }
+
/**
* Wait for all running jobs not named in JobList.ignoredJobs
*
* @param timeOut
*/
public void waitForNonIgnoredJobs(long timeOut) {
- waitForAllExcept(timeOut, JobLists.ignoredJobs);
+ waitForAllExcept(false,timeOut, JobLists.ignoredJobs);
}
-
+ /**
+ * Wait for all running jobs not named in JobList.ignoredJobs
+ *
+ * @param timeOut
+ */
+ public void waitForNonIgnoredJobs(boolean includeSleepingJobs,long timeOut) {
+ waitForAllExcept(includeSleepingJobs,timeOut, JobLists.ignoredJobs);
+ }
/**
* Wait for all running jobs not named in JobList.ignoredJobs
*/
public void waitForNonIgnoredJobs() {
- waitForAllExcept(TIMEOUT, JobLists.ignoredJobs);
+ waitForAllExcept(false, TIMEOUT, JobLists.ignoredJobs);
}
/**
* Wait for all running jobs
*/
public void waitForAll(long timeOut) {
- waitForAllExcept(timeOut, new String[0]);
+ waitForAll(false , timeOut);
}
/**
@@ -232,16 +254,50 @@
* @param timeOut
*/
public void waitForAll() {
- waitForAllExcept(TIMEOUT, new String[0]);
+ waitForAll(false, TIMEOUT);
}
-
+ /**
+ * Wait for all running jobs
+ *
+ * @param includeSleepingJobs
+ */
+ public void waitForAll(boolean includeSleepingJobs) {
+ waitForAll(includeSleepingJobs,TIMEOUT);
+ }
+ /**
+ * Wait for all running jobs
+ *
+ * @param includeSleepingJobs
+ * @param timeout
+ */
+ public void waitForAll(boolean includeSleepingJobs , long timeout) {
+ waitForAllExcept(includeSleepingJobs,timeout, new String[0]);
+ }
+ /**
+ * Wait for all running jobs except named jobs
+ *
+ * @param timeOut
+ * @param jobNames
+ */
+ public void waitForAllExcept(long timeOut, String... jobNames) {
+ waitForAllExcept(false, timeOut,jobNames);
+ }
+ /**
+ * Wait for all running jobs except named jobs
+ *
+ * @param jobNames
+ */
+ public void waitForAllExcept(String... jobNames) {
+ waitForAllExcept(false, TIMEOUT,jobNames);
+ }
/**
* Wait for all running jobs except named jobs
*
+ * @param includeSleepingJobs
* @param timeOut
* @param jobNames
*/
- public void waitForAllExcept(long timeOut, String... jobNames) {
+ public void waitForAllExcept(boolean includeSleepingJobs , long timeOut, String... jobNames) {
// Find all jobs
Job[] jobs = Job.getJobManager().find(null);
@@ -263,16 +319,17 @@
names[i] = listNames.get(i);
}
- waitForJobs(timeOut, names);
+ waitForJobs(includeSleepingJobs,timeOut, names);
}
/**
* Waits for selected job
*
+ * @param includeSleepingJobs
* @param timeOut
* @param jobNames
*/
- public void waitForJobs(long timeOut, String... jobNames) {
+ public void waitForJobs(boolean includeSleepingJobs,long timeOut, String... jobNames) {
// DEBUG
printRunningJobs();
@@ -294,14 +351,25 @@
log.info("Blocking job " + jobName + " found");
blockingJobs.add(jobName);
}
+ else if (includeSleepingJobs && isJobSleeping(jobName)) {
+ log.info("Blocking sleeping job " + jobName + " found");
+ blockingJobs.add(jobName);
+ }
}
// Wait until all blocking jobs aren't finished or timeout
for (String jobName : blockingJobs) {
while (true) {
- if (!isJobRunning(jobName)) {
- log.info("Job " + jobName + " is finished");
- break;
+ if (!isJobRunning(jobName)){
+ boolean jobStoped = true;
+ if (includeSleepingJobs){
+ jobStoped = !isJobSleeping(jobName);
+ }
+
+ if (jobStoped){
+ log.info("Job " + jobName + " is finished");
+ break;
+ }
}
long waitTime = System.currentTimeMillis() - startTime;
@@ -310,7 +378,7 @@
+ timeOut + "ms");
break;
}
- log.info("Job \"" + jobName + "\" is running for " + waitTime
+ log.info("Waiting for Job \"" + jobName + "\" for " + waitTime
/ 1000 + "s");
bot.sleep(SLEEPTIME);
}
@@ -336,6 +404,24 @@
return false;
}
+ /**
+ * Search for jobname in JobManager job list
+ *
+ * @param jobName
+ * name of the job
+ * @return true if job with corresponding name found, else false
+ */
+ private boolean isJobSleeping(String jobName) {
+ Job[] jobs = Job.getJobManager().find(null);
+ for (Job job : jobs) {
+ if ((jobName.equalsIgnoreCase(job.getName()))
+ && (job.getState() == JobState.SLEEPING)){
+ return true;
+ }
+ }
+ return false;
+ }
+
public void printRunningJobs() {
Job[] jobs = Job.getJobManager().find(null);
for (Job job : jobs) {
@@ -663,7 +749,13 @@
public static void displayAllBotWidgets (SWTBot bot){
List<?> widgets = bot.widgets(new SWTUtilExt.AlwaysMatchMatcher<Widget>());
for (Object object : widgets){
- System.out.println(object +
+ String objectToString;
+ try{
+ objectToString = object.toString();
+ } catch (Throwable t){
+ objectToString = "<null>";
+ }
+ System.out.println(objectToString +
" Text: " + SWTUtilExt.invokeMethod(object, "getText") +
" Tooltip: " + SWTUtilExt.invokeMethod(object, "getToolTipText"));
}
@@ -853,4 +945,169 @@
return new SWTBotMenu(menuItem, matcher);
}
+ /********** CAPTURING OF STANDARD OUTPUT **********/
+
+ /**
+ * Default output stream before redirecting.
+ */
+ private static PrintStream defaultOutputStream = System.out;
+ /**
+ * Redirected output stream for capturing output.
+ */
+ private static ByteArrayOutputStream capturingByteArrayOutputStream = null;
+
+ /**
+ * Starts capturing of standard output.
+ * Redirects standard output into other <code>PrintStream</code>
+ * which is captured.
+ */
+ public static void startCapturingStandardOutput() {
+ capturingByteArrayOutputStream = new ByteArrayOutputStream();
+ System.setOut(new PrintStream(capturingByteArrayOutputStream));
+ log.info("Capturing of standard output was started.");
+ }
+
+ /**
+ * Stops capturing of standard output by setting the default standard output.
+ *
+ * @return Captured output.
+ */
+ public static String stopCapturingStandardOutput() {
+ System.setOut(defaultOutputStream);
+ final String capturedOutput = new String(capturingByteArrayOutputStream.toByteArray());
+ capturingByteArrayOutputStream = null;
+ log.info("Capturing of standard output was stopped.");
+ return capturedOutput;
+ }
+
+ /********** END OF CAPTURING OF STANDARD OUTPUT **********/
+
+ /**
+ * Waits until toolbarButton with timeout SWTBotPreferences.TIMEOUT
+ * @param toolbarButton
+ */
+ public void waitForToolbarButtonEnabled (SWTBotToolbarButton toolbarButton) {
+ waitForToolbarButtonEnabled(toolbarButton, SWTBotPreferences.TIMEOUT);
+ }
+ /**
+ * Waits until toolbarButton is enabled with timeout
+ * @param toolbarButton
+ */
+ public void waitForToolbarButtonEnabled (final SWTBotToolbarButton toolbarButton, final long timeout) {
+ bot.waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return toolbarButton.isEnabled();
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Tooolbar button with tooltip " + toolbarButton.getToolTipText() +
+ " was not enabled within " + timeout + " miliseconds";
+ }
+ },
+ timeout);
+ }
+ /**
+ * Waits while toolbarButton is disabled with timeout SWTBotPreferences.TIMEOUT
+ * @param toolbarButton
+ */
+ public void waitWhileToolbarButtonisDisabled (SWTBotToolbarButton toolbarButton) {
+ waitWhileToolbarButtonisDisabled(toolbarButton, SWTBotPreferences.TIMEOUT);
+ }
+ /**
+ * Waits while toolbarButton is disabled with timeout
+ * @param toolbarButton
+ */
+ public void waitWhileToolbarButtonisDisabled (final SWTBotToolbarButton toolbarButton, final long timeout) {
+ bot.waitWhile(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return toolbarButton.isEnabled();
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Tooolbar button with tooltip " + toolbarButton.getToolTipText() +
+ " was not enabled within " + timeout + " miliseconds";
+ }
+ },
+ timeout);
+ }
+ /**
+ * Waits until toolbarButton is with tooltip is found with timeout
+ * @param tooltip
+ * @param timeout
+ */
+ public void waitForToolbarButtonWithTooltipIsFound (final String tooltip, final long timeout) {
+ bot.waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ boolean toolbarButtonIsFound = false;
+ try {
+ bot.toolbarButtonWithTooltip(tooltip);
+ toolbarButtonIsFound = true;
+ }
+ catch (WidgetNotFoundException wnfe){
+ toolbarButtonIsFound = false;
+ }
+ return toolbarButtonIsFound;
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Tooolbar button with tooltip " + tooltip +
+ " was not available " + timeout + " miliseconds";
+ }
+ },
+ timeout);
+ }
+ /**
+ * Waits until toolbarButton with mnemonicText is found with timeout
+ * @param text
+ * @param timeout
+ */
+ public void waitForButtonIsFound (final String text, final long timeout) {
+ bot.waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ boolean buttonIsFound = false;
+ try {
+ bot.button(text);
+ buttonIsFound = true;
+ }
+ catch (WidgetNotFoundException wnfe){
+ buttonIsFound = false;
+ }
+ return buttonIsFound;
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Button with text " + text +
+ " was not available " + timeout + " miliseconds";
+ }
+ },
+ timeout);
+ }
}
\ No newline at end of file
Copied: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ViewIsActive.java (from rev 42878, trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ViewIsActive.java)
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ViewIsActive.java (rev 0)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/condition/ViewIsActive.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -0,0 +1,42 @@
+package org.jboss.tools.ui.bot.ext.condition;
+
+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.StringUtils;
+import org.eclipse.swtbot.swt.finder.utils.internal.Assert;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+
+/**
+ * SWTBot Condition checking if a view is active
+ * @author jjankovi
+ *
+ */
+public class ViewIsActive implements ICondition{
+
+ private String viewTitle;
+
+ public ViewIsActive(String viewTitle) {
+ Assert.isNotNull(viewTitle, "View title text was null");
+ Assert.isLegal(!StringUtils.isEmpty(viewTitle), "View title text was empty");
+ this.viewTitle = viewTitle;
+ }
+
+ public String getFailureMessage() {
+ return "View '" + viewTitle + "' is not active";
+ }
+
+ public boolean test() throws Exception {
+ try {
+ SWTBotView view = SWTBotFactory.getBot().viewByTitle(viewTitle);
+ return view.isActive();
+ } catch (WidgetNotFoundException e) {
+ }
+ return false;
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -2,9 +2,9 @@
import static org.junit.Assert.fail;
-import org.eclipse.swtbot.swt.finder.SWTBot;
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.JBossCommunityJBossAS32;
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;
@@ -14,6 +14,7 @@
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.Server.JBossEnterpriseMiddlewareJBossEnterpriseApplicationPlatform6x;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.ServerRuntime.JBossCommunityJBoss32Runtime;
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;
@@ -150,6 +151,9 @@
}
}
else if (TestConfigurator.Values.SERVER_TYPE_AS.equals(serverType)) {
+ if ("3.2".equals(version)) {
+ return new ServerInfo(JBossCommunityJBoss32Runtime.LABEL,JBossCommunityJBossAS32.LABEL);
+ }
if ("4.2".equals(version)) {
return new ServerInfo(JBossCommunityJBoss42Runtime.LABEL,JBossCommunityJBossAS42.LABEL);
}
Copied: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/entity/XMLConfiguration.java (from rev 42878, trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/entity/XMLConfiguration.java)
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/entity/XMLConfiguration.java (rev 0)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/entity/XMLConfiguration.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -0,0 +1,70 @@
+package org.jboss.tools.ui.bot.ext.entity;
+
+public class XMLConfiguration {
+
+ private String key;
+
+ private String value;
+
+ public XMLConfiguration() {
+ // default
+ }
+
+ public XMLConfiguration(String key, String value) {
+ super();
+ this.key = key;
+ this.value = value;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return getKey() + "=" + getValue();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((key == null) ? 0 : key.hashCode());
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ XMLConfiguration other = (XMLConfiguration) obj;
+ if (key == null) {
+ if (other.key != null)
+ return false;
+ } else if (!key.equals(other.key))
+ return false;
+ if (value == null) {
+ if (other.value != null)
+ return false;
+ } else if (!value.equals(other.value))
+ return false;
+ return true;
+ }
+}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -130,4 +130,41 @@
}
+ /**
+ * Checks Content Assist auto proposal. It's case when there is only one
+ * content assist item and that item is automatically inserted into editor
+ * and checks if expectedProposalList is equal to current Proposal List
+ * @param editorTitle
+ * @param textToSelect
+ * @param selectionOffset
+ * @param selectionLength
+ * @param textToSelectIndex
+ * @param expectedInsertedText
+ */
+ public static SWTBotEditor checkContentAssistAutoProposal(SWTBotExt bot,
+ String editorTitle, String textToSelect, int selectionOffset,
+ int selectionLength, int textToSelectIndex, String expectedInsertedText) {
+
+ SWTJBTExt.selectTextInSourcePane(bot,
+ editorTitle, textToSelect, selectionOffset, selectionLength,
+ textToSelectIndex);
+
+ bot.sleep(Timing.time1S());
+
+ SWTBotEditorExt editor = SWTTestExt.bot.swtBotEditorExtByTitle(editorTitle);
+ String editorLineBeforeInsert = editor.getTextOnCurrentLine();
+ int xPos = editor.cursorPosition().column;
+ String expectedEditorLineAfterInsert = editorLineBeforeInsert.substring(0,xPos) +
+ expectedInsertedText +
+ editorLineBeforeInsert.substring(xPos);
+ ContentAssistBot contentAssist = editor.contentAssist();
+ contentAssist.invokeContentAssist();
+ String editorLineAfterInsert = editor.getTextOnCurrentLine();
+ assertTrue("Text on current line should be:\n" +
+ "but is :\n" + editorLineAfterInsert
+ , editorLineAfterInsert.equals(expectedEditorLineAfterInsert));
+
+ return editor;
+
+ }
}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/KeyboardHelper.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.ui.bot.ext.helper;
import java.awt.AWTException;
@@ -13,34 +23,64 @@
public class KeyboardHelper {
private static Robot robot = null;
+
+ public static void keyPressedEvent (Display display, int keyCode) {
+ Event keyPressed = new Event();
+ keyPressed.keyCode = keyCode;
+ keyPressed.type = SWT.KeyDown;
+ display.post(keyPressed);
+ }
+
+ public static void keyReleasedEvent (Display display, int keyCode) {
+ Event keyReleased = new Event();
+ keyReleased.keyCode = keyCode;
+ keyReleased.type = SWT.KeyUp;
+ display.post(keyReleased);
+ }
+
/**
* Simulate pressing of key with keyCode via SWT
* @param display
* @param keyCode
*/
- public static void pressKeyCode (Display display , int keyCode){
-
- Event keyPressed = new Event();
- keyPressed.keyCode = keyCode;
- keyPressed.type = SWT.KeyDown;
- display.post(keyPressed);
- Event keyReleased = new Event();
- keyReleased.keyCode = keyCode;
- keyReleased.type = SWT.KeyUp;
- display.post(keyReleased);
-
+ public static void pressKeyCode (Display display, int keyCode) {
+ keyPressedEvent(display, keyCode);
+ keyReleasedEvent(display, keyCode);
}
+
/**
* Simulate pressing of keys with keyCodes via SWT
* @param display
* @param keyCodes
*/
- public static void pressKeyCodes (Display display , byte[] keyCodes){
- for (byte keyCode : keyCodes){
- KeyboardHelper.pressKeyCode(display,keyCode);
- SWTUtils.sleep(Timing.time1S());
- }
+ public static void pressKeyCodes (Display display, byte[] keyCodes){
+ for (byte keyCode : keyCodes){
+ KeyboardHelper.pressKeyCode(display,keyCode);
+ SWTUtils.sleep(Timing.time1S());
+ }
}
+
+ public static void typeKeyCodeUsingSWT (Display display, int swtKeyCode , int... modifiers){
+ if (modifiers != null){
+ for (int modifierCode : modifiers){
+ KeyboardHelper.keyPressedEvent(display, modifierCode);
+ }
+ }
+ KeyboardHelper.pressKeyCode(display, swtKeyCode);
+ if (modifiers != null){
+ for (int modifierCode : modifiers){
+ KeyboardHelper.keyReleasedEvent(display, modifierCode);
+ }
+ }
+ }
+
+ public static void selectTextUsingSWTEvents (Display display, boolean forward, int selectionLength) {
+ int arrowCode = forward ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT;
+ for (int index = 0 ; index < selectionLength; index ++){
+ typeKeyCodeUsingSWT(display, arrowCode, SWT.SHIFT);
+ }
+ }
+
/**
* Simulate pressing of key with keyCode via AWT
* @param awtKeyCode
Copied: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/SubversiveHelper.java (from rev 42878, trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/SubversiveHelper.java)
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/SubversiveHelper.java (rev 0)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/SubversiveHelper.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -0,0 +1,59 @@
+package org.jboss.tools.ui.bot.ext.helper;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.osgi.framework.Bundle;
+
+public class SubversiveHelper {
+
+ static Logger log = Logger.getLogger(SubversiveHelper.class);
+
+ /**
+ * Check if Subversive is installed or not
+ */
+ public static boolean isSubversiveInstalled() {
+ String[] names = { "org.eclipse.team.svn","org.eclipse.team.svn.core","org.eclipse.team.svn.ui"};
+
+ boolean result = true;
+ for (String name : names ) {
+ Bundle bundle = Platform.getBundle(name);
+ if (bundle == null) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Disables Subversive Decorations (for projects, etc.)
+ */
+ public static void disableSVNDecoration() {
+
+ if (!isSubversiveInstalled()) {
+ log.info("Subversive is not installed, skiping SVN Decoration disabling");
+ return;
+ }
+
+ // commented, this is relevant only when SVN is installed as all
+
+ SWTBotExt botExt = new SWTBotExt();
+ botExt.menu("Window").menu("Preferences").click();
+ botExt.tree().expandNode("Team", "SVN", "Label Decorations").select();
+
+ botExt.tabItem("Text Decorations").activate();
+ botExt.textWithLabel("File:").setText("");
+ botExt.textWithLabel("Folder:").setText("");
+ botExt.textWithLabel("Project:").setText("");
+ botExt.button("OK").click();
+
+ /*
+ * Obsolete text botExt.tabItem("Text").activate();
+ * botExt.textWithLabel("File Format:").setText("");
+ * botExt.textWithLabel("Folder Format:").setText("");
+ * botExt.textWithLabel("Project Format:").setText("");
+ * botExt.button("OK").click();
+ */
+ }
+}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/logging/LogWidgetsVisitor.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/logging/LogWidgetsVisitor.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/logging/LogWidgetsVisitor.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -57,7 +57,11 @@
@Override
protected void visitCLabel(CLabel widget) {
- log.info(widget);
+ StringBuilder text = new StringBuilder();
+ text.append("CLabel {");
+ text.append(widget.getText());
+ text.append("}");
+ log.info(text.toString());
}
@Override
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/matcher/console/ConsoleOutputMatcher.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/matcher/console/ConsoleOutputMatcher.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/matcher/console/ConsoleOutputMatcher.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,11 +1,15 @@
package org.jboss.tools.ui.bot.ext.matcher.console;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
/**
- * Checks if the console contains specified text.
+ * Checks if the console contains specified text (and waits for it to appear if necessary).
*
* @author Lucia Jelinkova
*
@@ -13,18 +17,63 @@
public class ConsoleOutputMatcher extends TypeSafeMatcher<String> {
private String consoleText;
+
+ private long timeout;
+
+ public ConsoleOutputMatcher() {
+ timeout = 0;
+ }
+ public ConsoleOutputMatcher(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public ConsoleOutputMatcher(TaskDuration taskDuration) {
+ this.timeout = taskDuration.getTimeout();
+ }
+
@Override
public boolean matchesSafely(String item) {
- consoleText = SWTBotFactory.getConsole().getConsoleText();
- if (consoleText == null){
- throw new IllegalStateException("No console output present");
+ try {
+ SWTBotFactory.getBot().waitUntil(new ConsoleContainsTextCondition(item), timeout);
+ if (consoleText == null){
+ throw new IllegalStateException("No console output present");
+ }
+ return true;
+ } catch (TimeoutException e){
+ return false;
}
- return consoleText.contains(item);
}
@Override
public void describeTo(Description description) {
description.appendText("is in console output, but instead: \n" + consoleText);
}
+
+ private class ConsoleContainsTextCondition implements ICondition {
+
+ private String expectedText;
+
+ public ConsoleContainsTextCondition(String item) {
+ this.expectedText = item;
+ }
+
+ @Override
+ public boolean test() throws Exception {
+ consoleText = SWTBotFactory.getConsole().getConsoleText();
+ if (consoleText == null){
+ return false;
+ }
+ return consoleText.contains(expectedText);
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return null;
+ }
+ }
}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -132,7 +132,7 @@
/*
* Invokes ContentAssistProposal shell action
*/
- private void invokeContentAssist() {
+ public void invokeContentAssist() {
String actionId = "ContentAssistProposal";
//final IAction action = ((ITextEditor) partReference.getEditor(false)).getAction(actionId);
Object oEditor = editor.getReference().getEditor(false);
@@ -282,7 +282,7 @@
* @param s2
* @return
*/
- private SWTBotShell getContentAssistShell(SWTBotShell[] s1, SWTBotShell[] s2) {
+ public SWTBotShell getContentAssistShell(SWTBotShell[] s1, SWTBotShell[] s2) {
SWTBotShell ccShell = null;
for (SWTBotShell bs2 : s2) {
boolean found = false;
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotBrowserExt.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -65,6 +65,7 @@
public SWTBotBrowserExt(Browser w) {
super(w);
pl = new PListener(this);
+ pl.setDone(false);
}
/**
* gets 'href' attribute of link from currently loaded
@@ -257,7 +258,7 @@
@Override
public void run() {
- pl.setDone(false);
+ //pl.setDone(false);
widget.addProgressListener(pl);
}
});
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -2,12 +2,12 @@
import java.lang.reflect.Field;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swtbot.swt.finder.ReferenceBy;
import org.eclipse.swtbot.swt.finder.SWTBotWidget;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.results.BoolResult;
import org.eclipse.swtbot.swt.finder.results.StringResult;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.internal.forms.widgets.FormTextModel;
@@ -36,11 +36,44 @@
}
public AbstractSWTBotControl<FormText> click() {
- setFocus();
+ /*syncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ click(widget.toDisplay(25,5).x, widget.toDisplay(25,5).y, true); //+20 is there because of icon
+ }
+ });*/
+ int timeout = 0;
+ while (!hasFocus() && timeout!=5){
+ //try to set focus
+ setFocus();
+ log.info("Trying to set focus");
+ sleep(1000);
+ timeout++;
+ }
+ if (!hasFocus()){
+ throw new IllegalStateException("Unable to focus widget of type Hyperlink");
+ }
keyboard().typeCharacter('\r');
return this;
}
+ /**
+ * Tests whether widget has focus or not. Needed for workaround of issue, where method setFocus() isn't working properly when ececuting test via maven.
+ * @return true if widget has focus. False otherwise.
+ */
+
+ public boolean hasFocus(){
+ return syncExec(new BoolResult() {
+
+ @Override
+ public Boolean run() {
+ return widget.isFocusControl();
+ }
+ });
+ }
+
+
public String selectedLinkText() {
return syncExec(new StringResult() {
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,6 +1,7 @@
package org.jboss.tools.ui.bot.ext.parts;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.results.BoolResult;
import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
import org.eclipse.ui.forms.widgets.Hyperlink;
@@ -21,11 +22,38 @@
* @return
*/
public AbstractSWTBot<Hyperlink> activate() {
- setFocus();
+ int timeout = 0;
+ while (!hasFocus() && timeout!=5){
+ //try to set focus
+ setFocus();
+ log.info("Trying to set focus");
+ sleep(1000);
+ timeout++;
+ }
+ if (!hasFocus()){
+ throw new IllegalStateException("Unable to focus widget of type Hyperlink");
+ }
keyboard().typeCharacter('\r');
return this;
}
+
+
/**
+ * Tests whether widget has focus or not. Needed for workaround of issue, where method setFocus() isn't working properly when ececuting test via maven.
+ * @return true if widget has focus. False otherwise.
+ */
+
+ public boolean hasFocus(){
+ return syncExec(new BoolResult() {
+
+ @Override
+ public Boolean run() {
+ return widget.isFocusControl();
+ }
+ });
+ }
+
+ /**
* clicks on hyper-link (not real click, but {@link SWTBotHyperlinkExt#activate()}
*/
public AbstractSWTBot<Hyperlink> click() {
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -51,15 +51,8 @@
* Toggles twistie (expands its section)
*/
public AbstractSWTBotControl<Twistie> toggle() {
- syncExec(new VoidResult() {
-
- @Override
- public void run() {
- clickXY(widget.getBounds().x+3, widget.getBounds().y+3);
- }
- });
- /*setFocus();
- keyboard().typeCharacter('\r');*/
+ setFocus();
+ keyboard().typeCharacter('\r');
return this;
}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -282,6 +282,7 @@
public static final String DATA_SOURCE_EXPLORER = "Data Source Explorer";
public static final String SERVERS = "Servers";
public static final String WEB_PROJECTS = "Web Projects";
+ public static final String WEB_SERVICE_TESTER = "Web Service Tester";
public static final String CONSOLE = "Console";
public static final String PROBLEMS = "Problems";
public static final String DEBUG = "Debug";
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ErrorLogView.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -6,6 +6,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralErrorLog;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
/**
@@ -16,6 +17,10 @@
*/
public class ErrorLogView extends ViewBase {
+ public ErrorLogView() {
+ viewObject = GeneralErrorLog.LABEL;
+ }
+
/**
* logs all error log messages into a logger
*/
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -122,7 +122,14 @@
}
item.select().doubleClick();
log.info("File Opened:" + builder.toString());
- SWTBotEditor editor = bot.activeEditor();
+ SWTBotEditor editor = null;
+ // Try to find editor containing opened file
+ try{
+ editor = bot.editorByTitle(path[path.length - 1]);
+ } catch (WidgetNotFoundException wnfe){
+ // in case name of opened file is different then editor title of editor containing opened file
+ editor = bot.activeEditor();
+ }
return editor;
}
/**
Copied: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java (from rev 42878, trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java)
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java (rev 0)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.view;
+
+import org.apache.log4j.Logger;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+/**
+ * Represents JBoss Tools Palette View
+ * @author vpakan(a)redhat.com
+ *
+ */
+public class PaletteView extends ViewBase {
+ Logger log = Logger.getLogger(PaletteView.class);
+ public PaletteView() {
+ viewObject = ActionItem.View.JBossToolsWebJBossToolsPalette.LABEL;
+ }
+
+}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,5 +1,8 @@
package org.jboss.tools.ui.bot.ext.view;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
@@ -8,10 +11,12 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
+import org.jboss.tools.ui.bot.ext.entity.XMLConfiguration;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.ServerServers;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -100,19 +105,19 @@
ContextMenuHelper.prepareTreeItemForContextMenu(tree, server);
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, "Restart", false)).click();
handleServerAlreadyRunning(bot);
-
+
bot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.VERY_LONG.getTimeout());
bot.waitUntil(new ICondition() {
-
+
@Override
public boolean test() throws Exception {
return "Started".equals(getServerStatus(serverName));
}
-
+
@Override
public void init(SWTBot bot) {
}
-
+
@Override
public String getFailureMessage() {
return "The server does not have status 'Started'";
@@ -179,10 +184,16 @@
}
return null;
}
-
+
+ public SWTBotTreeItem findServerByName(String name) {
+
+ SWTBot bot = show().bot();
+ return findServerByName(bot.tree(), name);
+ }
+
public boolean serverExists(String serverName){
SWTBot bot = show().bot();
-
+
try {
// if there are no servers the following text appears
bot.link("No servers available. Define a new server from the <a>new server wizard</a>...");
@@ -190,21 +201,57 @@
} catch (WidgetNotFoundException e){
// ok, there are some servers, let's check the name
}
-
+
SWTBotTreeItem server = findServerByName(bot.tree(), serverName);
return server != null;
}
-
+
public String getServerStatus(String serverName){
SWTBot bot = show().bot();
SWTBotTreeItem server = findServerByName(bot.tree(), serverName);
-
+
String label = server.getText();
int startIndex = label.indexOf('[') + 1;
int endIndex = label.indexOf(',');
return label.substring(startIndex, endIndex);
}
+ public String getServerPublishStatus(String serverName){
+ SWTBot bot = show().bot();
+ SWTBotTreeItem server = findServerByName(bot.tree(), serverName);
+
+ String label = server.getText();
+ int startIndex = label.indexOf(',') + 2;
+ int endIndex = label.indexOf(']');
+ return label.substring(startIndex, endIndex);
+ }
+
+ public boolean containsProject(String serverName, String project){
+ SWTBot bot = show().bot();
+ SWTBotTreeItem server = findServerByName(bot.tree(), serverName);
+ server.expand();
+
+ try {
+ getProjectNode(server, project);
+ return true;
+ } catch (WidgetNotFoundException e){
+ return false;
+ }
+ }
+
+ private SWTBotTreeItem getProjectNode(SWTBotTreeItem server, String projectName){
+ for (SWTBotTreeItem child : server.getItems()){
+ String name = child.getText();
+ if (name.contains("[")){
+ name = name.substring(0, name.indexOf("["));
+ }
+ if (name.trim().equals(projectName)){
+ return child;
+ }
+ }
+ throw new WidgetNotFoundException("Project " + projectName + " was not found within server");
+ }
+
/**
* removes project with given name from all servers
* @param projectName
@@ -249,4 +296,105 @@
}
+ public void addProjectToServer(String projectName, String serverName){
+ SWTBot bot = show().bot();
+ SWTBotTree serversTree = bot.tree();
+ SWTBotTreeItem server = findServerByName(serversTree, serverName);
+
+ ContextMenuHelper.prepareTreeItemForContextMenu(serversTree,server);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(serversTree, IDELabel.Menu.ADD_AND_REMOVE, false)).click();
+
+ SWTBot shellBot = bot.shell("Add and Remove...").bot();
+
+ shellBot.tree(0).getTreeItem(projectName).select();
+ shellBot.button("Add >").click();
+ shellBot.button("Finish").click();
+ shellBot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.VERY_LONG.getTimeout());
+ }
+
+ public void removeProjectFromServer(String projectName, String serverName){
+ SWTBot bot = show().bot();
+ SWTBotTree serversTree = bot.tree();
+ SWTBotTreeItem server = findServerByName(serversTree, serverName);
+
+ ContextMenuHelper.prepareTreeItemForContextMenu(serversTree,server);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(serversTree, IDELabel.Menu.ADD_AND_REMOVE, false)).click();
+
+ SWTBot shellBot = bot.shell("Add and Remove...").bot();
+
+ shellBot.tree(1).getTreeItem(projectName).select();
+ shellBot.button("< Remove").click();
+ shellBot.button("Finish").click();
+ shellBot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.VERY_LONG.getTimeout());
+ }
+
+ public void openServerEditor(String serverName){
+ SWTBot bot = show().bot();
+ SWTBotTreeItem server = findServerByName(bot.tree(), serverName);
+ server.doubleClick();
+ }
+
+ public void openWebPage(String serverName){
+ SWTBot bot = show().bot();
+ SWTBotTree serversTree = bot.tree();
+ SWTBotTreeItem server = findServerByName(serversTree, serverName);
+
+ server.contextMenu("Web Browser").click();
+ }
+
+ public void openWebPage(String serverName, String projectName){
+ SWTBot bot = show().bot();
+ SWTBotTree serversTree = bot.tree();
+ SWTBotTreeItem server = findServerByName(serversTree, serverName);
+ SWTBotTreeItem project = getProjectNode(server, projectName);
+ project.contextMenu("Web Browser").click();
+ }
+
+ public List<XMLConfiguration> getXMLConfiguration(String serverName, String categoryName){
+ SWTBotTreeItem server = findServerByName(serverName);
+ server.expand();
+ final SWTBotTreeItem category = server.expandNode("XML Configuration", categoryName);
+
+ String separator = " ";
+ SWTBotFactory.getBot().waitUntil(new TreeItemLabelDecorated(category.getNode(0), separator));
+
+ List<XMLConfiguration> configurations = new ArrayList<XMLConfiguration>();
+ for (final SWTBotTreeItem item : category.getItems()){
+ String[] columns = item.getText().split(separator);
+ if (columns.length < 2){
+ // it is nested node, we should process it recursively in the future
+ // but for now not crucial, let's skip it
+ continue;
+ }
+ configurations.add(new XMLConfiguration(columns[0].trim(), columns[1].trim()));
+ }
+ return configurations;
+ }
+
+ private static class TreeItemLabelDecorated implements ICondition {
+
+ private String separator;
+
+ private SWTBotTreeItem item;
+
+ public TreeItemLabelDecorated(SWTBotTreeItem item, String separator) {
+ super();
+ this.item = item;
+ this.separator = separator;
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public boolean test() throws Exception {
+ return item.getText().contains(separator);
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Expected the tree item to be decorated with separator '" + separator + "'";
+ }
+ }
}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -1,8 +1,30 @@
package org.jboss.tools.ui.bot.ext.view;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import org.apache.log4j.Logger;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.ListResult;
+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarPushButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarRadioButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarSeparatorButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.internal.WorkbenchPartReference;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTOpenExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
@@ -44,5 +66,91 @@
public SWTBotView show() {
return open.viewOpen(viewObject);
}
+ /**
+ * Get toolbar buttons contained within view
+ * It's workaround for Eclipse Juno where SWTBot is not able to find toolbar buttons of view
+ * @return
+ */
+ public List<SWTBotToolbarButton> getToolbarButtons() {
+ return UIThreadRunnable.syncExec(new ListResult<SWTBotToolbarButton>() {
+ public List<SWTBotToolbarButton> run() {
+ SWTBotView view = show();
+ IWorkbenchPart obj = ((WorkbenchPartReference) view.getReference()).getPart(false);
+ ToolBar toolbar = null;
+ IToolBarManager t = ((IViewSite)obj.getSite()).getActionBars().getToolBarManager();
+ if (t instanceof ToolBarManager) {
+ toolbar = ((ToolBarManager)t).getControl();
+ }
+
+ final List<SWTBotToolbarButton> l = new ArrayList<SWTBotToolbarButton>();
+
+ if (toolbar == null)
+ return l;
+
+ ToolItem[] items = toolbar.getItems();
+ for (int i = 0; i < items.length; i++) {
+ try {
+ if (SWTUtils.hasStyle(items[i], SWT.PUSH))
+ l.add(new SWTBotToolbarPushButton(items[i]));
+ else if(SWTUtils.hasStyle(items[i], SWT.CHECK))
+ l.add(new SWTBotToolbarToggleButton(items[i]));
+ else if(SWTUtils.hasStyle(items[i], SWT.RADIO))
+ l.add(new SWTBotToolbarRadioButton(items[i]));
+ else if(SWTUtils.hasStyle(items[i], SWT.DROP_DOWN))
+ l.add(new SWTBotToolbarDropDownButton(items[i]));
+ else if(SWTUtils.hasStyle(items[i], SWT.SEPARATOR))
+ l.add(new SWTBotToolbarSeparatorButton(items[i]));
+ } catch (WidgetNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return l;
+
+ }
+ });
+ }
+ /**
+ * Get first toolbar button contained within view with toolTip
+ * It's workaround for Eclipse Juno where SWTBot is not able to find toolbar buttons of view
+ * @param toolTip
+ * @param index
+ * @return
+ */
+ public SWTBotToolbarButton getToolbarButtonWitTooltip (String toolTip){
+ return getToolbarButtonWitTooltip(toolTip,0);
+ }
+ /**
+ * Get toolbar button contained within view with toolTip and order specified by index
+ * It's workaround for Eclipse Juno where SWTBot is not able to find toolbar buttons of view
+ * @param toolTip
+ * @param index
+ * @return
+ */
+ public SWTBotToolbarButton getToolbarButtonWitTooltip (String toolTip, int index){
+ SWTBotToolbarButton result = null;
+ List<SWTBotToolbarButton> tbList = getToolbarButtons();
+ if (tbList != null && tbList.size() > 0){
+ int indexFound = -1;
+ Iterator<SWTBotToolbarButton> itToolbarButtons = tbList.iterator();
+ while (result == null && itToolbarButtons.hasNext()){
+ SWTBotToolbarButton tbItem = itToolbarButtons.next();
+ if (toolTip.equals(tbItem.getToolTipText())){
+ indexFound++;
+ if(indexFound >= index){
+ result = tbItem;
+ }
+ }
+ }
+ }
+ if (result != null){
+ return result;
+ }
+ else{
+ throw new WidgetNotFoundException("Unable to find toolbar button with tooltip " +
+ toolTip + " within view " + viewObject.getName());
+ }
+
+ }
}
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/wizards/SWTBotWizard.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/wizards/SWTBotWizard.java 2012-08-07 13:37:43 UTC (rev 42882)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/wizards/SWTBotWizard.java 2012-08-07 14:01:52 UTC (rev 42883)
@@ -65,7 +65,7 @@
SWTBotShell activeShell = getActiveShell();
finish();
log.info("Waiting until active shell is active");
- bot().waitWhile(new ShellIsActiveCondition(activeShell), TaskDuration.VERY_LONG.getTimeout());
+ bot().waitWhile(new ShellIsActiveCondition(activeShell), TaskDuration.VERY_LONG.getTimeout()+TaskDuration.VERY_LONG.getTimeout()); //DO NOT COMMIT THIS!
log.info("Waiting until Progress Information Shell is active");
bot().waitWhile(new ProgressInformationShellIsActiveCondition(), TaskDuration.LONG.getTimeout());
log.info("Waiting until Non System Jobs run started");
12 years, 5 months
JBoss Tools SVN: r42882 - trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-07 09:37:43 -0400 (Tue, 07 Aug 2012)
New Revision: 42882
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
Log:
Dummy ui bot test multiple action added to check stability
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 13:29:49 UTC (rev 42881)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 13:37:43 UTC (rev 42882)
@@ -1,7 +1,8 @@
package org.jboss.tools.dummy.ui.bot.test;
-import static org.junit.Assert.*;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
+import static org.junit.Assert.assertEquals;
import java.io.OutputStreamWriter;
@@ -10,6 +11,8 @@
import org.apache.log4j.PatternLayout;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -22,8 +25,14 @@
@RunWith(SWTBotJunit4ClassRunner.class)
public class DummyTest {
+ static Logger log = Logger.getLogger(DummyTest.class);
+
@BeforeClass
- public static void before() {
+ public static void before() {
+ ConsoleAppender ca = new ConsoleAppender();
+ ca.setWriter(new OutputStreamWriter(System.out));
+ ca.setLayout(new PatternLayout("[%-5p] %t: %m%n"));
+ log.addAppender(ca);
}
@Test
@@ -34,10 +43,24 @@
ca.setLayout(new PatternLayout("[%-5p] %t: %m%n"));
log.addAppender(ca);
+ String pref = "Preferences";
SWTWorkbenchBot bot = new SWTWorkbenchBot();
- bot.menu("Window").menu("Preferences").click();
- assertEquals("Preferences",bot.activeShell().getText());
+ bot.menu("Window").menu(pref).click();
+ bot.waitUntil(shellIsActive(pref), 10000);
+ SWTBotShell shell = bot.shell(pref);
+ assertEquals(pref,shell.getText());
bot.activeShell().close();
+ }
+
+ @Test
+ public void hundredTimes() {
+ for (int i = 0 ; i < 100; i++)
+ dummyTest();
+ }
+
+ @AfterClass
+ public static void after() {
+ SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.closeAllShells();
}
}
12 years, 5 months
JBoss Tools SVN: r42881 - trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-07 09:29:49 -0400 (Tue, 07 Aug 2012)
New Revision: 42881
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/pom.xml
Log:
Dummy ui bot pom.xml redundant configuration removed, already in parent
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/pom.xml
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/pom.xml 2012-08-07 13:25:49 UTC (rev 42880)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/pom.xml 2012-08-07 13:29:49 UTC (rev 42881)
@@ -16,43 +16,6 @@
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
- <artifactId>target-platform-configuration</artifactId>
- <version>0.14.1</version>
- <configuration>
- <resolver>p2</resolver>
- <ignoreTychoRepositories>true</ignoreTychoRepositories>
- <environments>
- <environment>
- <os>macosx</os>
- <ws>cocoa</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>win32</os>
- <ws>win32</ws>
- <arch>x86_64</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86</arch>
- </environment>
- <environment>
- <os>linux</os>
- <ws>gtk</ws>
- <arch>x86_64</arch>
- </environment>
- </environments>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<useUIThread>false</useUIThread>
12 years, 5 months
JBoss Tools SVN: r42880 - trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-07 09:25:49 -0400 (Tue, 07 Aug 2012)
New Revision: 42880
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
Log:
Dummy ui bot test improved
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 12:59:20 UTC (rev 42879)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 13:25:49 UTC (rev 42880)
@@ -1,6 +1,8 @@
package org.jboss.tools.dummy.ui.bot.test;
+import static org.junit.Assert.*;
+
import java.io.OutputStreamWriter;
import org.apache.log4j.ConsoleAppender;
@@ -33,6 +35,9 @@
log.addAppender(ca);
SWTWorkbenchBot bot = new SWTWorkbenchBot();
- log.info("Shell with title \"" + bot.shells()[0].getText() + "\" found");
+ bot.menu("Window").menu("Preferences").click();
+ assertEquals("Preferences",bot.activeShell().getText());
+ bot.activeShell().close();
+ bot.closeAllShells();
}
}
12 years, 5 months
JBoss Tools SVN: r42879 - trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-07 08:59:20 -0400 (Tue, 07 Aug 2012)
New Revision: 42879
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
Log:
Update dummy ui bot test to provide basic bot test
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 11:30:18 UTC (rev 42878)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/src/org/jboss/tools/dummy/ui/bot/test/DummyTest.java 2012-08-07 12:59:20 UTC (rev 42879)
@@ -1,8 +1,12 @@
package org.jboss.tools.dummy.ui.bot.test;
-import static org.junit.Assert.assertTrue;
+import java.io.OutputStreamWriter;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -15,16 +19,20 @@
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class DummyTest {
-
+
@BeforeClass
public static void before() {
- assertTrue(true);
}
@Test
public void dummyTest() {
- assertTrue(true);
+ Logger log = Logger.getLogger(this.getClass());
+ ConsoleAppender ca = new ConsoleAppender();
+ ca.setWriter(new OutputStreamWriter(System.out));
+ ca.setLayout(new PatternLayout("[%-5p] %t: %m%n"));
+ log.addAppender(ca);
+
+ SWTWorkbenchBot bot = new SWTWorkbenchBot();
+ log.info("Shell with title \"" + bot.shells()[0].getText() + "\" found");
}
-
-
}
12 years, 5 months