Author: lzoubek(a)redhat.com
Date: 2010-04-28 08:09:45 -0400 (Wed, 28 Apr 2010)
New Revision: 21776
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearProjects.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StartServer.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
Log:
SWTbot extensions : improving custom annotations, extensions
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -1,57 +1,88 @@
- package org.jboss.tools.ui.bot.ext;
+package org.jboss.tools.ui.bot.ext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.log4j.Logger;
+import org.eclipse.swtbot.swt.finder.junit.ScreenshotCaptureListener;
import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.config.requirement.RequirementBase;
import org.junit.runner.Runner;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.Suite;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;
+import org.junit.runners.model.Statement;
/**
- * JUnit4 requirement aware testsuite runner. If suite class is annotated by @
RunWith({@link RequirementAwareSuite}) class, test classes can have {@link
SWTBotTestRequires} annotations
+ * JUnit4 requirement aware testsuite runner. If suite class is annotated by @
+ * RunWith({@link RequirementAwareSuite}) class, test classes can have
+ * {@link SWTBotTestRequires} annotations
*
- * @author lzoubek(a)redhat.com
+ * @author lzoubek(a)redhat.com
*/
-public class RequirementAwareSuite extends Suite {
+public class RequirementAwareSuite extends Suite {
class ReqAwareClassRunner extends BlockJUnit4ClassRunner {
private final List<RequirementBase> requirements;
- public ReqAwareClassRunner(Class<?> klass, List<RequirementBase>
requirements) throws InitializationError {
+
+ public ReqAwareClassRunner(Class<?> klass,
+ List<RequirementBase> requirements) throws InitializationError {
super(klass);
this.requirements = requirements;
}
+
@Override
- protected Object createTest() throws Exception {
- log.info("Fullfilling requirements before test
"+getTestClass().getJavaClass());
- for (RequirementBase r : requirements) {
- r.fulfill();
+ public void run(RunNotifier notifier) {
+ // adding ability to create screen shot (taken from SWTBotJunit4ClassRunner)
+ RunListener failureSpy = new ScreenshotCaptureListener();
+ notifier.removeListener(failureSpy);
+ notifier.addListener(failureSpy);
+ try {
+ super.run(notifier);
}
- return super.createTest();
+ finally {
+ notifier.removeListener(failureSpy);
+ }
}
-
+ @Override
+ protected Statement withBeforeClasses(Statement statement) {
+ log.info("Fullfilling requirements before test "
+ + getTestClass().getJavaClass());
+ try {
+ for (RequirementBase r : requirements) {
+ r.fulfill();
+ }
+ } catch (Exception e) {
+ log.error("Fulfilling failed", e);
+ }
+
+ return super.withBeforeClasses(statement);
+ }
}
-
- private static final Logger log = Logger.getLogger(RequirementAwareSuite.class);
- private class RequirementAwareRunnerBuilder extends RunnerBuilder {
+
+ private static final Logger log = Logger
+ .getLogger(RequirementAwareSuite.class);
+
+ private class RequirementAwareRunnerBuilder extends RunnerBuilder {
@Override
- public Runner runnerForClass(Class<?> klass) throws Throwable {
- List<RequirementBase> reqs = TestConfigurator.getClassRequirements(klass);
- if (reqs!=null) {
- log.info("Returning runner for test class "+klass.getCanonicalName());
- return new ReqAwareClassRunner(klass,reqs);
+ public Runner runnerForClass(Class<?> klass) throws Throwable {
+ List<RequirementBase> reqs = TestConfigurator
+ .getClassRequirements(klass);
+ if (reqs != null) {
+ log.info("Returning runner for test class "
+ + klass.getCanonicalName());
+ return new ReqAwareClassRunner(klass, reqs);
}
- log.info("Skipping test class "+klass.getCanonicalName());
+ log.info("Skipping test class " + klass.getCanonicalName());
return null;
}
-
}
+
private final ArrayList<Runner> runners = new ArrayList<Runner>();
/**
@@ -65,14 +96,14 @@
* @param klass
* the root class
*/
- public RequirementAwareSuite(Class<?> klass)
- throws Throwable {
+ public RequirementAwareSuite(Class<?> klass) throws Throwable {
super(klass, Collections.<Runner> emptyList());
runners.add(new Suite(klass, new RequirementAwareRunnerBuilder()));
- }
+ }
+
@Override
protected List<Runner> getChildren() {
return runners;
- }
+ }
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -76,19 +76,7 @@
}
}
- /**
- * selects and returns given view, view must be opened
- *
- * @param view
- * @return
- */
- public SWTBotView viewSelect(IView view) {
- SWTBotView v = bot.viewByTitle(view.getName());
- v.show();
- v.setFocus();
- return v;
- }
/**
* selects given actionItem in bot's tree();
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -41,6 +41,11 @@
public static final ConsoleView console = new ConsoleView();
// config & state
+ /**
+ * represents state of configured stuff like server, runtimes etc
+ * NOTE : this state can change right before test class is instantiated (because of
possibly various requirements of tests defined by its annotations),
+ * please do not bind its properties, use them directly
+ */
public static final ConfiguredState configuredState = new ConfiguredState();
public static Properties properties;
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/Annotations.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -10,7 +10,15 @@
public class Annotations {
/**
* annotation which defines requirement of whole test Class
- * by default all sub-annotations are optional and are disabled
+ * by default all sub-annotations are optional and are disabled, please go through
+ * documentation of all items.
+ * <ul>
+ * <li>{@link SWTBotTestRequires#clearProjects()}</li>
+ * <li>{@link SWTBotTestRequires#clearWorkspace()}</li>
+ * <li>{@link SWTBotTestRequires#perspective()}</li>
+ * <li>{@link Server}</li>
+ * <li>{@link Seam}</li>
+ * </ul>
* @author lzoubek
*
*/
@@ -21,12 +29,28 @@
* optionally require server
*/
Server server() default @Server( required = false );
+ /**
+ * optionally require seam runtime
+ * @return
+ */
Seam seam() default @Seam( required = false );
/**
* name of perspective to run within
* @return
*/
String perspective() default "";
+ /**
+ * my default workspace is cleaned before test (attempt to close all shells and
editors, closes 'Welcome' view),
+ * setting this to false will disable this feature
+ * @return
+ */
+ boolean clearWorkspace() default true;
+ /**
+ * by default all projects are undeployed from pre-configured server & deleted
before test runs
+ * setting this to false will disable this feature
+ * @return
+ */
+ boolean clearProjects() default true;
}
/**
* Server requirement, by default matches all server types and versions
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -6,42 +6,58 @@
import org.jboss.tools.ui.bot.ext.config.requirement.RequirementBase;
/**
- * this class represents state of running test suite. Properties of this object should be
changed only by
- * classed extending {@link RequirementBase} class.
+ * this class represents state of running test suite. Properties of this object
+ * should be changed only by classed extending {@link RequirementBase} class.
+ *
* @author lzoubek
- *
+ *
*/
public class ConfiguredState {
- private List<String> jreList = new Vector<String>();
+ private List<String> jreList = new Vector<String>();
private Server server = new Server();
private Seam seam = new Seam();
-
+ private boolean welcomeViewVisible = true;
+
+ public boolean isWelcomeViewVisible() {
+ return welcomeViewVisible;
+ }
+
+ public void setWelcomeViewVisible(boolean welcomeViewVisible) {
+ this.welcomeViewVisible = welcomeViewVisible;
+ }
+
/**
* gets list of installed jre's (without the default one)
+ *
* @return
*/
public List<String> getJreList() {
return jreList;
}
+
/**
* gets configured seam runtime
+ *
* @return
*/
public Seam getSeam() {
return seam;
}
+
/**
* gets configured server state
+ *
* @return
*/
public Server getServer() {
return server;
}
+
public class Server {
/**
- * is server runtime & server added?
+ * is server runtime & server added?
*/
- public boolean isConfigured=false;
+ public boolean isConfigured = false;
/**
* is server running?
*/
@@ -49,12 +65,12 @@
/**
* version of server
*/
- public String version=null;
+ public String version = null;
/**
* type (EAP | JbossAS )
*/
- public String type=null;
+ public String type = null;
/**
* name of added server/runtime
*/
@@ -62,20 +78,21 @@
/**
* version of java configured to server (1.5 or 1.6)
*/
- public String withJavaVersion=null;
+ public String withJavaVersion = null;
}
+
public class Seam {
/**
* version of seam runtime
*/
- public String version=null;
+ public String version = null;
/**
* is configured?
*/
- public boolean isConfiured=false;
+ public boolean isConfiured = false;
/**
* name of added runtime
*/
- public String name=null;
+ public String name = null;
}
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -5,19 +5,20 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import java.util.Properties;
import org.jboss.tools.ui.bot.ext.Activator;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.config.Annotations.*;
-import org.jboss.tools.ui.bot.ext.config.requirement.AddSeam;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Seam;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
import org.jboss.tools.ui.bot.ext.config.requirement.RequirementBase;
-import org.jboss.tools.ui.bot.ext.config.requirement.StartServer;
-import org.jboss.tools.ui.bot.ext.config.requirement.SwitchPerspective;
public class TestConfigurator {
-
-
+
public class Keys {
public static final String SERVER = "SERVER";
public static final String SEAM = "SEAM";
@@ -63,8 +64,8 @@
} catch (Exception ex) {
ex.printStackTrace();
}
-
- //properties got loaded
+
+ // properties got loaded
try {
server = ServerBean.fromString(getProperty(Keys.SERVER));
seam = SeamBean.fromString(getProperty(Keys.SEAM));
@@ -75,9 +76,12 @@
}
/**
- * returns null when given Server annotation does not match global test configuration
- * (e.g. Test wants Server type EAP but we are running on JbossAS)
- * @param s Server annotation
+ * returns null when given Server annotation does not match global test
+ * configuration (e.g. Test wants Server type EAP but we are running on
+ * JbossAS)
+ *
+ * @param s
+ * Server annotation
* @return StartServer requirement otherwise
*/
private static RequirementBase getServerRequirement(Server s) {
@@ -85,22 +89,27 @@
return null;
}
if (!s.type().equals(ServerType.ALL)) {
- if (s.type().equals(ServerType.EAP) &&
!server.type.equals(ServerBean.ServerType.EAP)) {
+ if (s.type().equals(ServerType.EAP)
+ && !server.type.equals(ServerBean.ServerType.EAP)) {
return null;
}
- if (s.type().equals(ServerType.JbossAS) &&
!server.type.equals(ServerBean.ServerType.JBOSS_AS)) {
+ if (s.type().equals(ServerType.JbossAS)
+ && !server.type.equals(ServerBean.ServerType.JBOSS_AS)) {
return null;
}
}
-
+
if (!matches(server.version, s.operator(), s.version())) {
return null;
}
- return new StartServer();
+ return RequirementBase.createStartServer();
}
+
/**
- * returns null when given Seam annotation does not match global test configuration
- * (e.g. Test wants Seam version 2.2 but we are running on 1.2)
+ * returns null when given Seam annotation does not match global test
+ * configuration (e.g. Test wants Seam version 2.2 but we are running on
+ * 1.2)
+ *
* @param s
* @return AddSeam requirement otherwise
*/
@@ -111,62 +120,80 @@
if (!matches(seam.version, s.operator(), s.version())) {
return null;
}
- return new AddSeam();
+ return RequirementBase.createAddSeam();
}
+
/**
- * returns list of requirements if given class (Test) can run, all this is done by
exploring class'es
- * annotations (see {@link SWTBotTestRequires}
- * if class cannot run returns null
+ * returns list of requirements if given class (Test) can run, all this is
+ * done by exploring class'es annotations (see {@link SWTBotTestRequires} if
+ * class cannot run returns null
*/
public static List<RequirementBase> getClassRequirements(Class<?> klass) {
-
- SWTBotTestRequires requies = klass.getAnnotation(SWTBotTestRequires.class);
- // all not annotated classes can run
- if (requies==null) {
- return null;
- }
+
+ SWTBotTestRequires requies = klass
+ .getAnnotation(SWTBotTestRequires.class);
// internal list
List<RequirementBase> reqs = new ArrayList<RequirementBase>();
-
+ // all not annotated classes can run
+ if (requies == null) {
+ return reqs;
+ }
if (requies.server().required()) {
RequirementBase req = getServerRequirement(requies.server());
- if (req==null) {
+ if (req == null) {
return null;
}
reqs.add(req);
}
if (requies.seam().required()) {
RequirementBase req = getSeamRequirement(requies.seam());
- if (req==null) {
+ if (req == null) {
return null;
}
reqs.add(req);
}
if (!"".equals(requies.perspective())) {
- reqs.add(new SwitchPerspective(requies.perspective()));
+ reqs.add(RequirementBase.createSwitchPerspective(requies
+ .perspective()));
}
+ if (requies.clearWorkspace()) {
+ reqs.add(RequirementBase.createClearWorkspace());
+ }
+ if (requies.clearProjects()) {
+ reqs.add(RequirementBase.createClearProjects());
+ }
+ // sort requirements by priority
+ Collections.sort(reqs, new Comparator<RequirementBase>() {
+ public int compare(RequirementBase o1, RequirementBase o2) {
+ return o1.getPriority() - o2.getPriority();
+ }
+ });
+
return reqs;
}
+
/**
* implements comparison of 2 params by given operator (in this order)
- * params are expected version strings (in form X.X or XX)
- * if param1 or param2 is '*' true is returned
+ * params are expected version strings (in form X.X or XX) if param1 or
+ * param2 is '*' true is returned
+ *
* @param param1
- * @param operator (=,<,>=<=,>=,!=)
+ * @param operator
+ * (=,<,>=<=,>=,!=)
* @param param2
*
* @return
*/
- public static boolean matches(String param1,String operator,String param2) {
- if ("*".equals(param1)||"*".equals(param2)) {
+ public static boolean matches(String param1, String operator, String param2) {
+ if ("*".equals(param1) || "*".equals(param2)) {
return true;
}
if ("=".equals(operator)) {
- return param1.equals(param2);
+ return param1.equals(param2);
}
if ("!=".equals(operator)) {
- return !param1.equals(param2);
- }
+ return !param1.equals(param2);
+ }
int ver1 = versionToNumber(param1);
int ver2 = versionToNumber(param2);
if (">".equals(operator)) {
@@ -183,11 +210,13 @@
}
return false;
}
+
private static int versionToNumber(String version) {
return Integer.parseInt(version.replaceAll("\\.", ""));
}
+
public static String getProperty(String key) {
return swtTestProperties.getProperty(key);
- //return SWTTestExt.util.getValue(swtTestProperties, key);
+ // return SWTTestExt.util.getValue(swtTestProperties, key);
}
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/AddServer.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -25,7 +25,7 @@
public AddServer() {
String javaVer = getNeededJavaVersion(TestConfigurator.server.withJavaVersion);
if (javaVer!=null) {
- AddJRE addJava = new AddJRE(javaVer);
+ AddJRE addJava = createAddJRE(javaVer);
getDependsOn().add(addJava);
javaName=addJava.getAddedAsName();
}
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearProjects.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearProjects.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearProjects.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -0,0 +1,36 @@
+package org.jboss.tools.ui.bot.ext.config.requirement;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+/**
+ * undeploys and deletes all projects
+ * @author lzoubek(a)redhat.com
+ *
+ */
+public class ClearProjects extends RequirementBase {
+
+ @Override
+ public boolean checkFulfilled() {
+ try {
+ SWTBotTreeItem[] items =
SWTTestExt.projectExplorer.show().bot().tree().getAllItems();
+ if (items.length!=0) {
+ for (SWTBotTreeItem item : items) {
+ log.info("Item "+item.getText());
+ }
+ }
+ return items.length==0;
+ }
+ catch (Exception ex) {
+ log.error("Unable to determine count of projects",ex);
+ return false;
+ }
+ }
+
+ @Override
+ public void handle() {
+ SWTTestExt.servers.removeAllProjectsFromServer();
+ SWTTestExt.projectExplorer.deleteAllProjects();
+
+ }
+
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearProjects.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -0,0 +1,38 @@
+package org.jboss.tools.ui.bot.ext.config.requirement;
+import java.util.List;
+import java.util.Vector;
+
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.gen.IView;
+
+public class ClearWorkspace extends RequirementBase {
+
+ @Override
+ public boolean checkFulfilled() {
+ try {
+ return SWTTestExt.bot.shells().length>=2 &&
SWTTestExt.bot.editors().isEmpty() &&
!SWTTestExt.configuredState.isWelcomeViewVisible();
+ }
+ catch (Exception ex) {
+ log.error("Cannot determine, if all editors and shells are closed", ex);
+ return false;
+ }
+ }
+
+ @Override
+ public void handle() {
+ SWTTestExt.bot.closeAllShells();
+ SWTTestExt.bot.closeAllEditors();
+ SWTTestExt.open.viewClose(new IView(){
+ public List<String> getGroupPath() {
+ // TODO Auto-generated method stub
+ return new Vector<String>();
+ }
+ public String getName() {
+ // TODO Auto-generated method stub
+ return "Welcome";
+ }});
+ SWTTestExt.configuredState.setWelcomeViewVisible(false);
+
+ }
+
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -4,67 +4,139 @@
import java.util.Vector;
import org.apache.log4j.Logger;
+
/**
* An abstract class for all requirements
+ *
* @author lzoubek
- *
+ *
*/
public abstract class RequirementBase {
+ private int priority = 0;
protected final Logger log = Logger.getLogger(this.getClass());
- public RequirementBase() {
+
+ public RequirementBase() {
}
-
+
private List<RequirementBase> dependsOn;
+
/**
* gets the list of reqs on which this one depends
+ *
* @return
*/
public List<RequirementBase> getDependsOn() {
- if (dependsOn==null) {
+ if (dependsOn == null) {
dependsOn = new Vector<RequirementBase>();
}
return dependsOn;
}
+
/**
* fulfills this requirement. First fulfills the dependent ones, then this.
+ *
* @throws RequirementNotFulfilledException
*/
public void fulfill() throws RequirementNotFulfilledException {
- log.info("Fulfilling requirement
'"+this.getClass().getName()+"'");
+ log.info("Fulfilling requirement '" + this.getClass().getName() +
"'");
try {
- for (RequirementBase dep : getDependsOn()) {
- dep.fulfill();
- }
- if (!checkFulfilled()) {
- handle();
+ if (!getDependsOn().isEmpty()) {
+ log.info("Fulfilling dependencies");
+ for (RequirementBase dep : getDependsOn()) {
+ dep.fulfill();
+ }
+ log.info("All dependencies fulfilled");
+ }
if (!checkFulfilled()) {
- throw new Exception("Requirement implementation error, checkFulfilled() failed
after calling handle();");
+ handle();
+ if (!checkFulfilled()) {
+ throw new Exception(
+ "Requirement implementation error, checkFulfilled() failed after calling
"
+ + this.getClass().getName() + ".handle();");
+ }
}
- }
} catch (Exception ex) {
- log.info("Unable to fulfill requirement
'"+this.getClass().getName()+"'");
- throw new RequirementNotFulfilledException("Unable to fulfill requirement
"+this.getClass().getCanonicalName(),ex);
+ log.error("Unable to fulfill requirement '"
+ + this.getClass().getName() + "'", ex);
+ throw new RequirementNotFulfilledException(
+ "Unable to fulfill requirement "
+ + this.getClass().getCanonicalName(), ex);
}
- log.info("Requirement '"+this.getClass().getName()+"'
fulfilled");
-
+ log.info("Requirement '" + this.getClass().getName() + "'
fulfilled");
+
}
+
/**
* must return true if the Requirement is already fulfilled
+ *
* @return
*/
public abstract boolean checkFulfilled();
+
/**
- * handles (should do everything to fulfill requirement), {@link
RequirementBase#checkFulfilled()}
- * should return true after calling this method
+ * handles (should do everything to fulfill requirement),
+ * {@link RequirementBase#checkFulfilled()} should return true after calling
+ * this method
*/
public abstract void handle();
-
- @Override
- public int hashCode() {
- return getClass().hashCode();
+
+ /**
+ * gets requirement priority, higher values are fulfilled later
+ *
+ * @return
+ */
+ public int getPriority() {
+ return priority;
}
- @Override
- public boolean equals(Object obj) {
- return this.getClass().equals(obj.getClass());
+
+ /**
+ * sets requirement priority, higher values are fulfilled later
+ *
+ * @param priority
+ */
+ public void setPriority(int priority) {
+ this.priority = priority;
}
+
+ // need to have requirement's creation methods at one place to have overview
+ // by priority
+
+ public static RequirementBase createAddServer() {
+ RequirementBase req = new AddServer();
+ return req;
+ }
+
+ public static RequirementBase createStartServer() {
+ RequirementBase req = new StartServer();
+ return req;
+ }
+
+ public static RequirementBase createAddSeam() {
+ RequirementBase req = new AddSeam();
+ return req;
+ }
+
+ public static AddJRE createAddJRE(String version) {
+ AddJRE req = new AddJRE(version);
+ return req;
+ }
+
+ public static RequirementBase createSwitchPerspective(String name) {
+ RequirementBase req = new SwitchPerspective(name);
+ req.setPriority(1);
+ return req;
+ }
+
+ public static RequirementBase createClearWorkspace() {
+ RequirementBase req = new ClearWorkspace();
+ req.setPriority(-2);
+ return req;
+ }
+
+ public static RequirementBase createClearProjects() {
+ RequirementBase req = new ClearProjects();
+ req.setPriority(-1);
+ return req;
+ }
+
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StartServer.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StartServer.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/StartServer.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -10,7 +10,7 @@
public StartServer() {
// define dependency
- getDependsOn().add(new AddServer());
+ getDependsOn().add(createAddServer());
}
@Override
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -16,6 +16,8 @@
import static org.hamcrest.Matchers.instanceOf;
import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
@@ -49,6 +51,7 @@
*/
public static MenuItem getContextMenu(final AbstractSWTBot<?> bot,
final String text, final boolean hideAfterwards) {
+ final List<String> foundMenuItems = new Vector<String>();
final MenuItem menuItem = UIThreadRunnable
.syncExec(new WidgetResult<MenuItem>() {
@SuppressWarnings("unchecked")
@@ -56,7 +59,7 @@
MenuItem menuItem = null;
Menu menu = getWidgetMenu(bot.widget);
Matcher<?> matcher =
allOf(instanceOf(MenuItem.class),withMnemonic(text));
- menuItem = show(menu, matcher, hideAfterwards);
+ menuItem = show(menu, matcher, hideAfterwards, foundMenuItems);
if (menuItem != null) {
menu = menuItem.getMenu();
} else {
@@ -66,7 +69,7 @@
}
});
if (menuItem == null) {
- throw new WidgetNotFoundException("Could not find menu: " + text);
+ throw new WidgetNotFoundException("Could not find menu: '" +
text+"', found items :"+Arrays.toString(foundMenuItems.toArray()));
}
else{
if (hideAfterwards){
@@ -86,14 +89,18 @@
* @param menu
* @param matcher
* @param hideAfterwards
+ * @param foundMenuItems list of menuItems found (useful for debugging), items found in
menu are appended into given list, can be null
* @return
*/
- private static MenuItem show(final Menu menu, final Matcher<?> matcher, final
boolean hideAfterwards) {
+ private static MenuItem show(final Menu menu, final Matcher<?> matcher, final
boolean hideAfterwards, List<String> foundMenuItems) {
if (menu != null) {
menu.notifyListeners(SWT.Show, new Event());
MenuItem[] items = menu.getItems();
for (final MenuItem menuItem : items) {
- if (matcher.matches(menuItem)) {
+ if (foundMenuItems!=null) {
+ foundMenuItems.add(menuItem.getText());
+ }
+ if (matcher.matches(menuItem)) {
return menuItem;
}
}
@@ -191,7 +198,7 @@
for (String text : texts) {
Matcher<?> matcher = allOf(instanceOf(MenuItem.class),
withMnemonic(text));
- menuItem = show(menu, matcher,false);
+ menuItem = show(menu, matcher,false,null);
if (menuItem != null) {
menu = menuItem.getMenu();
} else {
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -17,6 +17,7 @@
/**
* activates hyper-link by sending special key do widget
+ * NOTE : this does not work well when SWTBot is running inside VNC
* @return
*/
public AbstractSWTBot<Hyperlink> activate() {
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -10,24 +10,18 @@
******************************************************************************/
package org.jboss.tools.ui.bot.ext.view;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralConsole;
-
import org.apache.log4j.Logger;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
-import org.jboss.tools.ui.bot.ext.SWTBotExt;
-import org.jboss.tools.ui.bot.ext.SWTOpenExt;
-import org.jboss.tools.ui.bot.ext.gen.IView;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralConsole;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
/**
* Manage Console View related tasks
* @author Vlado Pakan
*
*/
-public class ConsoleView extends SWTBotExt {
- protected IView viewObject;
- protected final SWTOpenExt open;
+public class ConsoleView extends ViewBase {
public static final int PROBLEMS_DESCRIPTION_COLUMN_INDEX = 0;
public static final int PROBLEMS_RESOURCE_COLUMN_INDEX = 1;
public static final int PROBLEMS_PATH_COLUMN_INDEX = 2;
@@ -35,15 +29,8 @@
Logger log = Logger.getLogger(ConsoleView.class);
public ConsoleView() {
viewObject = GeneralConsole.LABEL;
- open = new SWTOpenExt(this);
}
-
- /**
- * shows Explorer view
- */
- public void show() {
- open.viewOpen(viewObject);
- }
+
/**
* Returns actual console text
* @return
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -3,7 +3,6 @@
import java.util.List;
import java.util.Vector;
-import org.apache.log4j.Logger;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -13,12 +12,9 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.SWTOpenExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.gen.IView;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
/**
@@ -26,23 +22,11 @@
* @author lzoubek
*
*/
-public abstract class ExplorerBase extends SWTBotExt {
- /**
- * view object representing current view, MUST be defined in derived constructor (for
use, see {@link SWTOpenExt#viewOpen(IView)}
- */
- protected IView viewObject;
- protected final SWTOpenExt open;
- Logger log = Logger.getLogger(ExplorerBase.class);
+public abstract class ExplorerBase extends ViewBase {
+
public ExplorerBase() {
- open = new SWTOpenExt(this);
+
}
-
- /**
- * shows Explorer view
- */
- public void show() {
- open.viewOpen(viewObject);
- }
/*
* Selects given project in Package Explorer
*/
@@ -78,7 +62,8 @@
checkBox().click();
}
open.finish(this,IDELabel.Button.OK);
- new SWTUtilExt(this).waitForNonIgnoredJobs();
+ new SWTUtilExt(this).waitForNonIgnoredJobs();
+ new SWTUtilExt(this).waitForAll(Timing.time3S());
}
/**
* deletes all projects from workspace
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ProblemsView.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.ui.bot.ext.view;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt.StringConditionType;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralProblems;
-
import java.util.LinkedList;
import org.apache.log4j.Logger;
@@ -22,8 +19,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.SWTOpenExt;
-import org.jboss.tools.ui.bot.ext.gen.IView;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt.StringConditionType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.types.ViewType;
/**
@@ -31,25 +27,17 @@
* @author Vlado Pakan
*
*/
-public class ProblemsView extends SWTBotExt {
- protected IView viewObject;
- protected final SWTOpenExt open;
+public class ProblemsView extends ViewBase {
+
public static final int PROBLEMS_DESCRIPTION_COLUMN_INDEX = 0;
public static final int PROBLEMS_RESOURCE_COLUMN_INDEX = 1;
public static final int PROBLEMS_PATH_COLUMN_INDEX = 2;
public static final int PROBLEMS_TYPE_COLUMN_INDEX = 4;
Logger log = Logger.getLogger(ProblemsView.class);
public ProblemsView() {
- viewObject = GeneralProblems.LABEL;
- open = new SWTOpenExt(this);
+
}
-
- /**
- * shows Explorer view
- */
- public void show() {
- open.viewOpen(viewObject);
- }
+
/**
* Returns all warnings nodes filtered by input parameters
* @param bot
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java 2010-04-28
12:09:06 UTC (rev 21775)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -1,55 +1,46 @@
package org.jboss.tools.ui.bot.ext.view;
-import org.apache.log4j.Logger;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+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.SWTBotExt;
-import org.jboss.tools.ui.bot.ext.SWTOpenExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.View;
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;
-public class ServersView extends SWTBotExt {
+public class ServersView extends ViewBase {
- Logger log = Logger.getLogger(ProjectExplorer.class);
- private final SWTOpenExt open;
public ServersView() {
- open = new SWTOpenExt(this);
+ viewObject = ServerServers.LABEL;
}
/**
- * shows Project Explorer view
- */
- public void show() {
- open.viewOpen(ActionItem.View.ServerServers.LABEL);
- }
-
- /**
* removes all projects from server with given name
* @param serverName
*/
public void removeAllProjectsFromServer(String serverName) {
- SWTBot bot = open.viewSelect(ServerServers.LABEL).bot();
- SWTBotTree tree = bot.tree();
+ if (serverName==null) {
+ return;
+ }
+ SWTBotTree tree = show().bot().tree();
SWTBotTreeItem server = findServerByName(tree,serverName);
if (server!=null) {
ContextMenuHelper.prepareTreeItemForContextMenu(tree, server);
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree,
IDELabel.Menu.ADD_AND_REMOVE, false)).click();
try {
- shell(IDELabel.Menu.ADD_AND_REMOVE).activate();
- SWTBotButton btRemoveAll=button("<< Remove All");
+ SWTBotShell shell = shell(IDELabel.Menu.ADD_AND_REMOVE);
+ shell.activate();
+ SWTBotButton btRemoveAll=shell.bot().button("<< Remove All");
if (btRemoveAll.isEnabled()) {
btRemoveAll.click();
log.info("Removing all projects from server
'"+serverName+"'");
}
- open.finish(this, IDELabel.Button.FINISH);
+ open.finish(shell.bot(), IDELabel.Button.FINISH);
new SWTUtilExt(this).waitForNonIgnoredJobs();
new SWTUtilExt(this).waitForAll(Timing.time3S());
} catch (WidgetNotFoundException ex) {
@@ -65,7 +56,7 @@
* @param serverName
*/
public void stopServer(String serverName) {
- SWTBot bot = open.viewSelect(ServerServers.LABEL).bot();
+ SWTBot bot = open.viewOpen(ServerServers.LABEL).bot();
SWTBotTree tree = bot.tree();
SWTBotTreeItem server = findServerByName(tree,serverName);
if (server!=null) {
@@ -82,7 +73,7 @@
*/
public void startServer(String serverName) {
show();
- SWTBot bot = open.viewSelect(ServerServers.LABEL).bot();
+ SWTBot bot = open.viewOpen(ServerServers.LABEL).bot();
SWTBotTree tree = bot.tree();
SWTBotTreeItem server = findServerByName(tree,serverName);
if (server!=null) {
@@ -108,9 +99,8 @@
* @param projectName
*/
public void removeProjectFromServers(String projectName){
-
- SWTBot bot = open.viewOpen(View.ServerServers.LABEL).bot();
- SWTBotTree serverTree = bot.tree();
+
+ SWTBotTree serverTree = show().bot().tree();
// Expand All
for (SWTBotTreeItem serverTreeItem : serverTree.getAllItems()){
serverTreeItem.expand();
@@ -128,8 +118,9 @@
log.info("Found project to be removed from server: " +
serverTreeItemChildren[itemIndex].getText());
ContextMenuHelper.prepareTreeItemForContextMenu(serverTree,serverTreeItemChildren[itemIndex]);
new SWTBotMenu(ContextMenuHelper.getContextMenu(serverTree,
IDELabel.Menu.REMOVE, false)).click();
- bot.shell("Server").activate();
- open.finish(this, IDELabel.Button.OK);
+ SWTBotShell shell = shell("Server");
+ shell.activate();
+ open.finish(shell.bot(), IDELabel.Button.OK);
log.info("Removed project from server: " +
serverTreeItemChildren[itemIndex].getText());
new SWTUtilExt(this).waitForNonIgnoredJobs();
} else {
@@ -139,7 +130,12 @@
}
}
/**
- * removes project with given name from all servers
+ * removes projects from pre-configured server
* @param projectName
*/
+ public void removeAllProjectsFromServer() {
+ removeAllProjectsFromServer(SWTTestExt.configuredState.getServer().name);
+
+ }
+
}
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java 2010-04-28
12:09:45 UTC (rev 21776)
@@ -0,0 +1,33 @@
+package org.jboss.tools.ui.bot.ext.view;
+
+import org.apache.log4j.Logger;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTOpenExt;
+import org.jboss.tools.ui.bot.ext.gen.IView;
+/**
+ * base class for all view extensions
+ * @author lzoubek(a)redhat.com
+ *
+ */
+public class ViewBase extends SWTBotExt {
+ /**
+ * view object representing current view, MUST be defined in derived
+ * constructor (for use, see {@link SWTOpenExt#viewOpen(IView)}
+ */
+ protected IView viewObject;
+ protected final SWTOpenExt open;
+ Logger log = Logger.getLogger(ViewBase.class);
+
+ public ViewBase() {
+ open = new SWTOpenExt(this);
+ }
+
+ /**
+ * shows view
+ */
+ public SWTBotView show() {
+ return open.viewOpen(viewObject);
+ }
+
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain