Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Hohenegger2015-08-18 19:47:06 +0000
committerMatthias Sohn2015-08-24 08:13:46 +0000
commit3ffaa8127582517e4386cc68f2cbc1e36808d205 (patch)
tree681bc5f8ca858df9018b841f4844783532dcd5ea /org.eclipse.egit.ui.test
parentb9dad5fadac493446990048db3c679687eb329fd (diff)
downloadegit-3ffaa8127582517e4386cc68f2cbc1e36808d205.tar.gz
egit-3ffaa8127582517e4386cc68f2cbc1e36808d205.tar.xz
egit-3ffaa8127582517e4386cc68f2cbc1e36808d205.zip
Initializing a Gitflow repository should allow changing branch names
- added new dialog that opens when initializing the repository - changed API for "git flow init" to accept a config PoJo - deprecated redundant API - added UI test Bug: 475293 Change-Id: If7e314d749b0fcd3e77eb82576336c1aa20d4d14 Signed-off-by: Max Hohenegger <eclipse@hohenegger.eu>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java63
1 files changed, 59 insertions, 4 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java
index 1fff621bc7..cc16bef23f 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java
@@ -9,14 +9,23 @@
package org.eclipse.egit.ui.gitflow;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import org.eclipse.egit.gitflow.GitFlowConfig;
+import org.eclipse.egit.gitflow.GitFlowRepository;
import org.eclipse.egit.gitflow.ui.Activator;
import org.eclipse.egit.gitflow.ui.internal.JobFamilies;
+
+import static org.eclipse.egit.gitflow.ui.internal.UIText.*;
+
import org.eclipse.egit.ui.test.ContextMenuHelper;
import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.ui.PlatformUI;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -25,21 +34,67 @@ import org.junit.runner.RunWith;
*/
@RunWith(SWTBotJunit4ClassRunner.class)
public class InitHandlerTest extends AbstractGitflowHandlerTest {
+ private static final String DEVELOP_BRANCH = "a";
+ private static final String MASTER_BRANCH = "b";
+ private static final String FEATURE_BRANCH_PREFIX = "c";
+ private static final String RELEASE_BRANCH_PREFIX = "d";
+ private static final String HOTFIX_BRANCH_PREFIX = "e";
+ private static final String VERSION_TAG_PREFIX = "f";
+
+ private static final String ILLEGAL_BRANCH_NAME = "!@#$%^&*()_";
@Test
public void testInit() throws Exception {
init();
- assertEquals(DEVELOP, repository.getBranch());
+ GitFlowRepository gitFlowRepository = new GitFlowRepository(repository);
+ GitFlowConfig config = gitFlowRepository.getConfig();
+
+ assertEquals(DEVELOP_BRANCH, repository.getBranch());
+ assertEquals(MASTER_BRANCH, config.getMaster());
+ assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix());
+ assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix());
+ assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix());
+ assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix());
+
}
private void init() {
- SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
+ final SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
getProjectItem(projectExplorerTree, PROJ1).select();
- String[] menuPath = new String[] {
+ final String[] menuPath = new String[] {
util.getPluginLocalizedValue("TeamMenu.label"),
util.getPluginLocalizedValue("TeamGitFlowInit.name", false, Activator.getDefault().getBundle()) };
- ContextMenuHelper.clickContextMenuSync(projectExplorerTree, menuPath);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ ContextMenuHelper.clickContextMenuSync(projectExplorerTree,
+ menuPath);
+ }
+ });
+
+ SWTBotText developText = bot.textWithLabel(InitDialog_developBranch);
+ developText.selectAll();
+ developText.typeText(ILLEGAL_BRANCH_NAME);
+
+
+ SWTBotButton ok = bot.button("OK");
+ assertFalse(ok.isEnabled());
+
+ typeInto(InitDialog_developBranch, DEVELOP_BRANCH);
+ typeInto(InitDialog_masterBranch, MASTER_BRANCH);
+ typeInto(InitDialog_featureBranchPrefix, FEATURE_BRANCH_PREFIX);
+ typeInto(InitDialog_releaseBranchPrefix, RELEASE_BRANCH_PREFIX);
+ typeInto(InitDialog_hotfixBranchPrefix, HOTFIX_BRANCH_PREFIX);
+ typeInto(InitDialog_versionTagPrefix, VERSION_TAG_PREFIX);
+
+ ok.click();
bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
}
+
+ private void typeInto(String textLabel, String textInput) {
+ SWTBotText developText = bot.textWithLabel(textLabel);
+ developText.selectAll();
+ developText.typeText(textInput);
+ }
}

Back to the top