Author: ljelinko
Date: 2011-11-28 11:20:04 -0500 (Mon, 28 Nov 2011)
New Revision: 36703
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java
Log:
Created own waiting task.
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java 2011-11-28
16:20:04 UTC (rev 36703)
@@ -0,0 +1,57 @@
+package org.jboss.tools.portlet.ui.bot.task.progress;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
+
+/**
+ * Waits until there is no job running.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class AllJobsFinishedWaitingTask extends AbstractSWTTask {
+
+ public enum JobDuration {
+ SHORT(1 * 1000), NORMAL(10 * 1000), LONG(1 * 60 * 1000), VERY_LONG(10 * 60 * 1000);
+
+ private long timeout;
+
+ private JobDuration(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+ }
+
+ private JobDuration jobDuration;
+
+ public AllJobsFinishedWaitingTask(JobDuration timeout) {
+ super();
+ this.jobDuration = timeout;
+ }
+
+ @Override
+ public void perform() {
+ getBot().waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return Job.getJobManager().isIdle();
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return null;
+ }
+ }, jobDuration.getTimeout());
+ }
+}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java 2011-11-28
16:11:30 UTC (rev 36702)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java 2011-11-28
16:20:04 UTC (rev 36703)
@@ -4,7 +4,7 @@
import java.util.List;
import org.jboss.tools.portlet.ui.bot.task.CompositeSWTTask;
-import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.portlet.ui.bot.task.progress.AllJobsFinishedWaitingTask;
/**
*
@@ -29,7 +29,7 @@
super.perform();
getBot().button("Finish").click();
- SWTBotFactory.getUtil().waitForAll();
+ performInnerTask(new
AllJobsFinishedWaitingTask(AllJobsFinishedWaitingTask.JobDuration.LONG));
}
public void addWizardPage(WizardPageFillingTask task){