Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2016-01-08 13:28:03 +0000
committerThomas Wolf2016-02-13 12:13:06 +0000
commitc6a421bcccd8b07382af86e00781f03e2118c00b (patch)
tree4b2de0dcac4946cdadde22ff514d06c7f4afea96 /org.eclipse.egit.ui.test
parent292099f2d5bfbd6acff3ef4de981220ca285323c (diff)
downloadegit-c6a421bcccd8b07382af86e00781f03e2118c00b.tar.gz
egit-c6a421bcccd8b07382af86e00781f03e2118c00b.tar.xz
egit-c6a421bcccd8b07382af86e00781f03e2118c00b.zip
Wizard to configure pull operation
This is accessible on project's context menu, as "Pull..." just below "Pull". The wizard enables the user to specify the remote or add a new one, and also to specify the remote reference. There is content assist for published remote references, but the user may also pull from non-published remote refs, such as pull requests on Github or patch sets in Gerrit. Bug: 485124 Change-Id: I88122d3fedf10de35a0c1c233b7dd9920bb8c0c7 Signed-off-by: Mickael Istria <mistria@redhat.com> 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/wizards/pull/PullWizardTest.java104
1 files changed, 104 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/pull/PullWizardTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/pull/PullWizardTest.java
new file mode 100644
index 0000000000..a16c08ad28
--- /dev/null
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/pull/PullWizardTest.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Red Hat Inc. and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * Mickael Istria (Red Hat Inc.) - Initial implementation
+ *******************************************************************************/
+package org.eclipse.egit.ui.wizards.pull;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.waitForShell;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.view.repositories.GitRepositoriesViewTestBase;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.util.SystemReader;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.hamcrest.Description;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class PullWizardTest extends GitRepositoriesViewTestBase {
+
+ private static final class ShellWithTextPrefixMatcher
+ extends AbstractMatcher<Shell> {
+ private String prefix;
+
+ private SWTBotShell foundShell;
+
+ public ShellWithTextPrefixMatcher(@NonNull String prefix) {
+ this.prefix = prefix;
+ }
+
+ @Override
+ public void describeTo(Description arg0) {
+ arg0.appendText("With title starting by '" + this.prefix + "'");
+ }
+
+ @Override
+ protected boolean doMatch(Object item) {
+ SWTBotShell shell = new SWTBotShell((Shell) item);
+ if (shell.getText().startsWith(this.prefix)) {
+ this.foundShell = shell;
+ return true;
+ }
+ return false;
+ }
+
+ public SWTBotShell getFoundShell() {
+ return this.foundShell;
+ }
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ SystemReader.setInstance(null);
+ }
+
+ private File repositoryFile;
+
+ @Before
+ public void setUp() throws Exception {
+ deleteAllProjects();
+ clearView();
+ repositoryFile = createProjectAndCommitToRepository();
+ createRemoteRepository(repositoryFile);
+ Activator.getDefault().getRepositoryUtil()
+ .addConfiguredRepository(repositoryFile);
+ refreshAndWait();
+ assertHasRepo(repositoryFile);
+ }
+
+ @Test
+ public void pullFromProjectRepo() throws Exception {
+ SWTBotTree repositoriesTree = getOrOpenView().bot().tree();
+ repositoriesTree.select(0);
+ repositoriesTree.contextMenu("Pull...").click();
+ bot.shell("Pull").setFocus();
+ assertTrue("Remote combo misses items",
+ bot.comboBox().items().length > 1);
+ bot.button(IDialogConstants.FINISH_LABEL).click();
+ ShellWithTextPrefixMatcher shellWithTextPrefixMatcher = new ShellWithTextPrefixMatcher(
+ "Pull Result");
+ bot.waitUntil(waitForShell(shellWithTextPrefixMatcher));
+ shellWithTextPrefixMatcher.getFoundShell().setFocus();
+ bot.button(IDialogConstants.OK_LABEL).click();
+ }
+
+
+}

Back to the top