Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Nittka2020-04-14 17:47:33 +0000
committerThomas Wolf2020-04-16 15:57:22 +0000
commit1dc6de219906fe50164434d6d1964c16e71a227b (patch)
treeb9ae0b0af6cf5c8f41ddf999c80fdc91b5d2fd01 /org.eclipse.egit.ui.test/src
parenta2081d16a08c8c76e871d3d5980f25a4b062bad6 (diff)
downloadegit-1dc6de219906fe50164434d6d1964c16e71a227b.tar.gz
egit-1dc6de219906fe50164434d6d1964c16e71a227b.tar.xz
egit-1dc6de219906fe50164434d6d1964c16e71a227b.zip
Prevent ClassCastException during cloning
Cloning commands must not assume the RepositoriesView to be active. Otherwise a ClassCastException may occur when trying to expand a group node. Bug: 562109 Change-Id: I18fb36c3b8fb28823b4465e487589e7f58406e7a Signed-off-by: Alexander Nittka <alex@nittka.de>
Diffstat (limited to 'org.eclipse.egit.ui.test/src')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
index 067d85fe11..b58583758b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
@@ -25,6 +25,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.JobFamilies;
+import org.eclipse.egit.ui.internal.CommonUtils;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.TestUtil;
@@ -39,6 +40,7 @@ import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.utils.TableCollection;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;
@@ -338,6 +340,36 @@ public class GitRepositoriesViewRepoHandlingTest extends
}
@Test
+ public void testCloneWithViewClosed() throws Exception {
+ clearView();
+ refreshAndWait();
+ assertEmpty();
+ getOrOpenView().close();
+ UIThreadRunnable.asyncExec(() -> {
+ CommonUtils.runCommand("org.eclipse.egit.ui.RepositoriesViewClone",
+ null);
+ });
+ SWTBotShell shell = bot.shell(UIText.GitCloneWizard_title);
+ shell.bot().tree().select("Clone URI");
+
+ shell.bot().button("Next >").click(); // for some reason, textWithLabel
+ // doesn't seem to work
+ shell.bot().textInGroup(UIText.RepositorySelectionPage_groupLocation, 0)
+ .setText(repositoryFile.getPath());
+ shell.bot().button(IDialogConstants.NEXT_LABEL).click();
+ bot.waitUntil(widgetIsEnabled(shell.bot().tree()), 60000);
+ shell.bot().button(IDialogConstants.NEXT_LABEL).click();
+ waitInUI();
+ // for some reason textWithLabel doesn't work; 0 is path text
+ SWTBotText pathText = shell.bot().text(0);
+ pathText.setText(pathText.getText() + "Cloned");
+ shell.bot().button(IDialogConstants.FINISH_LABEL).click();
+ TestUtil.joinJobs(JobFamilies.CLONE);
+ refreshAndWait();
+ assertHasClonedRepo();
+ }
+
+ @Test
public void testCreateRepository() throws Exception {
clearView();
refreshAndWait();

Back to the top