Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Kinzler2010-07-07 13:22:42 +0000
committerMathias Kinzler2010-07-07 13:22:42 +0000
commit6a5df1536c8b9e7468e9567a52b9aafb7b14e09e (patch)
treee8720edfcefcfc51af0e4f048125f5bb9355ce6b /org.eclipse.egit.ui.test
parent2632498c64d1024704e230a665fd34c323c08e9e (diff)
downloadegit-6a5df1536c8b9e7468e9567a52b9aafb7b14e09e.tar.gz
egit-6a5df1536c8b9e7468e9567a52b9aafb7b14e09e.tar.xz
egit-6a5df1536c8b9e7468e9567a52b9aafb7b14e09e.zip
Added tests for working set option in project import wizard
Bug: 319021 Change-Id: I9fbccdd059f8df72bb5ea8c99bdcdbd6642e6ea8 Signed-off-by: Benjamin Muskalla <bmuskalla@eclipsesource.com> Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java61
1 files changed, 59 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
index 74967ad977..40eb097045 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
@@ -19,7 +19,9 @@ import java.io.File;
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIText;
@@ -35,6 +37,9 @@ import org.eclipse.swtbot.swt.finder.utils.TableCollection;
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.IWorkingSet;
+import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.ui.PlatformUI;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -290,6 +295,59 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
}
@Test
+ public void testImportWizardGeneralProjectWithWorkingSet() throws Exception {
+ deleteAllProjects();
+ assertProjectExistence(PROJ1, false);
+ SWTBotTree tree = getOrOpenView().bot().tree();
+ String wizardTitle = NLS.bind(
+ UIText.GitCreateProjectViaWizardWizard_WizardTitle,
+ repositoryFile.getPath());
+ // start wizard from PROJ1
+ getWorkdirItem(tree, repositoryFile).expand().getNode(PROJ1).select();
+ ContextMenuHelper.clickContextMenu(tree, myUtil
+ .getPluginLocalizedValue("ImportProjectsCommand"));
+ SWTBotShell shell = bot.shell(wizardTitle);
+ shell = bot.shell(wizardTitle);
+ // try import existing project first
+ activateItemByKeyboard(shell,
+ UIText.GitSelectWizardPage_ImportExistingButton);
+ // auto share
+ activateItemByKeyboard(shell,
+ UIText.GitSelectWizardPage_AutoShareButton);
+ shell.bot().button(IDialogConstants.NEXT_LABEL).click();
+ waitInUI();
+ shell.bot().tree().getAllItems()[0].check();
+ // add to working set
+ shell.bot().checkBox().select();
+ // create new working set
+ shell.bot().button("Select...").click();
+ SWTBotShell workingSetDialog = bot.shell("Select Working Sets");
+ workingSetDialog.bot().button("New...").click();
+ SWTBotShell newDialog = bot.shell("New Working Set");
+ newDialog.bot().table().select("Java");
+ newDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
+ String workingSetName = "myWorkingSet";
+ newDialog.bot().text(0).setText(workingSetName);
+ newDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
+ workingSetDialog.bot().table().getTableItem(workingSetName).check();
+ workingSetDialog.bot().button(IDialogConstants.OK_LABEL).click();
+ shell.bot().button(IDialogConstants.FINISH_LABEL).click();
+ waitInUI();
+ assertProjectExistence(PROJ1, true);
+ assertProjectInWorkingSet(workingSetName, PROJ1);
+ }
+
+ private void assertProjectInWorkingSet(String workingSetName,
+ String projectName) {
+ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
+ IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetName);
+ IAdaptable[] elements = workingSet.getElements();
+ assertEquals("Wrong number of projects in working set", 1, elements.length);
+ IProject project = (IProject) elements[0].getAdapter(IProject.class);
+ assertEquals("Wrong project in working set", projectName, project.getName());
+ }
+
+ @Test
public void testImportWizardGeneralProjectManualShareCancel()
throws Exception {
deleteAllProjects();
@@ -500,5 +558,4 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
perspective.activate();
}
}
-}
-
+} \ No newline at end of file

Back to the top