Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-07-15 18:15:08 +0000
committerThomas Wolf2016-07-15 18:40:02 +0000
commit54f14a6dc53c238ed59a572023470287811d08de (patch)
treeb5863e4cb5df61d6e23f2979f780febdcec6b52d /org.eclipse.egit.ui.test
parent3d1af24fe5df4e5501bbe05c38c5ef9e6a9e2835 (diff)
downloadegit-54f14a6dc53c238ed59a572023470287811d08de.tar.gz
egit-54f14a6dc53c238ed59a572023470287811d08de.tar.xz
egit-54f14a6dc53c238ed59a572023470287811d08de.zip
Test stability: force display of result dialog of background jobs
Change-Id: Ia930bf0c9b391f6fd41869693166ed211ce1c2e1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java7
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java19
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java2
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java27
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java25
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewPushTest.java3
6 files changed, 32 insertions, 51 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java
index b1f29cdd1d..afbab9cebc 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/push/PushToUpstreamTest.java
@@ -12,12 +12,15 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import java.io.File;
+import java.util.concurrent.TimeUnit;
import org.eclipse.egit.core.op.BranchOperation;
import org.eclipse.egit.core.op.CreateLocalBranchOperation;
import org.eclipse.egit.core.op.CreateLocalBranchOperation.UpstreamConfig;
+import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.test.ContextMenuHelper;
+import org.eclipse.egit.ui.test.JobJoiner;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.ObjectId;
@@ -104,9 +107,11 @@ public class PushToUpstreamTest extends LocalRepositoryTestCase {
private void pushToUpstream() {
SWTBotTree project = selectProject();
+ JobJoiner joiner = JobJoiner.startListening(JobFamilies.PUSH, 20,
+ TimeUnit.SECONDS);
ContextMenuHelper
.clickContextMenu(project, getPushToUpstreamMenuPath());
-
+ TestUtil.openJobResultDialog(joiner.join());
SWTBotShell resultDialog = TestUtil
.botForShellStartingWith("Push Results");
resultDialog.close();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
index 555b9788db..53b6475cf3 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
@@ -40,6 +40,7 @@ import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.commit.CommitHelper;
import org.eclipse.egit.ui.internal.commit.CommitHelper.CommitInfo;
import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.action.Action;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -57,6 +58,8 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
@@ -70,6 +73,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.IProgressConstants;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
@@ -853,4 +857,19 @@ public class TestUtil {
SWTBotView view = showExplorerView();
return view.bot().tree();
}
+
+ public static void openJobResultDialog(Job job) {
+ assertNotNull("Job should not be null", job);
+ final Action action = (Action) job
+ .getProperty(IProgressConstants.ACTION_PROPERTY);
+ if (action != null) {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ action.run();
+ }
+ });
+ }
+ }
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
index 990cd7a210..97c4767d9a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
@@ -172,7 +172,7 @@ public class FetchAndMergeActionTest extends LocalRepositoryTestCase {
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 20, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenu(projectExplorerTree, "Team",
menuString);
- jobJoiner.join();
+ TestUtil.openJobResultDialog(jobJoiner.join());
}
private SWTBotShell openMergeDialog() throws Exception {
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
index 79d65654dc..bd1ee29b45 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/PushActionTest.java
@@ -10,35 +10,29 @@
*******************************************************************************/
package org.eclipse.egit.ui.test.team.actions;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.common.LocalRepositoryTestCase;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.JobJoiner;
import org.eclipse.egit.ui.test.TestUtil;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.ui.progress.IProgressConstants;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -71,21 +65,6 @@ public class PushActionTest extends LocalRepositoryTestCase {
pushTo("push", false);
}
- private void openResultDialog(Job job) {
- assertNotNull("Job should not be null", job);
- final Action action = (Action) job
- .getProperty(IProgressConstants.ACTION_PROPERTY);
- if (action != null) {
- UIThreadRunnable.asyncExec(new VoidResult() {
-
- @Override
- public void run() {
- action.run();
- }
- });
- }
- }
-
private void pushTo(String destination, boolean withConfirmPage)
throws Exception, MissingObjectException,
IncorrectObjectTypeException, IOException {
@@ -109,8 +88,7 @@ public class PushActionTest extends LocalRepositoryTestCase {
JobJoiner joiner = JobJoiner.startListening(JobFamilies.PUSH, 20,
TimeUnit.SECONDS);
pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
- Job job = joiner.join();
- openResultDialog(job);
+ TestUtil.openJobResultDialog(joiner.join());
String title = NLS.bind(UIText.PushResultDialog_title, destination);
bot.waitUntil(Conditions.shellIsActive(title));
SWTBotShell confirm = bot.shell(title);
@@ -136,8 +114,7 @@ public class PushActionTest extends LocalRepositoryTestCase {
joiner = JobJoiner.startListening(JobFamilies.PUSH, 20,
TimeUnit.SECONDS);
pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
- job = joiner.join();
- openResultDialog(job);
+ TestUtil.openJobResultDialog(joiner.join());
bot.waitUntil(Conditions.shellIsActive(title));
confirm = bot.shell(title);
result = confirm.bot().tree().getAllItems()[0].getText();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
index 8a8372c51f..28a9622920 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
@@ -12,13 +12,11 @@ package org.eclipse.egit.ui.view.repositories;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.concurrent.TimeUnit;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.core.op.CloneOperation;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
@@ -27,20 +25,16 @@ import org.eclipse.egit.ui.internal.push.PushOperationUI;
import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.JobJoiner;
import org.eclipse.egit.ui.test.TestUtil;
-import org.eclipse.jface.action.Action;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
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.eclipse.ui.progress.IProgressConstants;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -301,32 +295,17 @@ public class GitRepositoriesViewFetchAndPushTest extends
}
}
- private void openResultDialog(Job job) {
- assertNotNull("Job should not be null", job);
- final Action action = (Action) job
- .getProperty(IProgressConstants.ACTION_PROPERTY);
- if (action != null) {
- UIThreadRunnable.asyncExec(new VoidResult() {
-
- @Override
- public void run() {
- action.run();
- }
- });
- }
- }
-
private void runPush(SWTBotTree tree) {
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 60, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenuSync(tree, myUtil
.getPluginLocalizedValue("SimplePushCommand"));
- openResultDialog(jobJoiner.join());
+ TestUtil.openJobResultDialog(jobJoiner.join());
}
private void runFetch(SWTBotTree tree) {
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 60, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenuSync(tree, myUtil
.getPluginLocalizedValue("SimpleFetchCommand"));
- openResultDialog(jobJoiner.join());
+ TestUtil.openJobResultDialog(jobJoiner.join());
}
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewPushTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewPushTest.java
index a76dd1ad72..da640f3397 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewPushTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewPushTest.java
@@ -17,6 +17,7 @@ import org.eclipse.egit.core.op.FetchOperation;
import org.eclipse.egit.ui.JobFamilies;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.test.JobJoiner;
+import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -70,7 +71,7 @@ public class SynchronizeViewPushTest extends AbstractSynchronizeViewTest {
SWTBotToolbarButton pushButton = viewBot.toolbarButton(UIText.GitActionContributor_Push);
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 30, TimeUnit.SECONDS);
pushButton.click();
- jobJoiner.join();
+ TestUtil.openJobResultDialog(jobJoiner.join());
String destinationString = repositoryFile.getParentFile().getName() + " - " + "origin";
SWTBotShell resultDialog = bot.shell(NLS.bind(UIText.PushResultDialog_title, destinationString));

Back to the top