Search in sources :

Example 6 with RepoPropertiesPage

use of org.eclipse.egit.ui.common.RepoPropertiesPage in project egit by eclipse.

the class GitCloneWizardTest method acceptCloneCommandAsURI.

@Test
public void acceptCloneCommandAsURI() throws Exception {
    importWizard.openWizard();
    RepoPropertiesPage propertiesPage = importWizard.openRepoPropertiesPage();
    // remove git clone command
    propertiesPage.setURI("git clone git://www.jgit.org/EGIT");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "", "", false, false);
    // leading and trailing whitespace should be stripped automatically
    propertiesPage.setURI(" git clone git://www.jgit.org/EGIT     ");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "", "", false, false);
    // assert trimming works fine in all other places
    propertiesPage.setURI("   git clone    git://www.jgit.org/EGIT");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "", "", false, false);
    bot.button("Cancel").click();
}
Also used : RepoPropertiesPage(org.eclipse.egit.ui.common.RepoPropertiesPage) Test(org.junit.Test)

Example 7 with RepoPropertiesPage

use of org.eclipse.egit.ui.common.RepoPropertiesPage in project egit by eclipse.

the class GitCloneWizardTest method gitStyleUriSelectsSshProtocol.

@Test
public void gitStyleUriSelectsSshProtocol() throws Exception {
    importWizard.openWizard();
    RepoPropertiesPage propertiesPage = importWizard.openRepoPropertiesPage();
    propertiesPage.setURI("git@github.com:someone/somerepo.git");
    propertiesPage.assertSourceParams(null, "github.com", "someone/somerepo.git", "ssh", "", true, "git", "", true, true);
}
Also used : RepoPropertiesPage(org.eclipse.egit.ui.common.RepoPropertiesPage) Test(org.junit.Test)

Example 8 with RepoPropertiesPage

use of org.eclipse.egit.ui.common.RepoPropertiesPage in project egit by eclipse.

the class PushTest method testPush.

@Test
public void testPush() throws Exception {
    // change file
    TestUtil.appendFileContent(file, "additional content", true);
    // commit change
    try (Git git = new Git(localRepository)) {
        git.add().addFilepattern(SampleTestRepository.A_txt_name).call();
        git.commit().setMessage("Change").call();
    }
    configurePush();
    // push change
    PushWizardTester wizardTester = new PushWizardTester();
    RepoPropertiesPage repoPropertiesPage = wizardTester.openPushWizard(localRepository);
    repoPropertiesPage.setPushDestination("push");
    wizardTester.nextPage();
    // now login dialog appears
    LoginDialogTester loginDialogTester = new LoginDialogTester();
    loginDialogTester.login("agitter", "letmein");
    RefSpecPageTester refSpecPageTester = new RefSpecPageTester();
    refSpecPageTester.waitUntilPageIsReady(1);
    wizardTester.finish();
    loginDialogTester.login("agitter", "letmein");
    PushResultDialogTester pushResultDialogTester = new PushResultDialogTester();
    bot.waitUntil(shellIsActive("Push Results: push"));
    String expectedMessage = "Repository " + remoteRepository.getUri();
    pushResultDialogTester.assertResultMessage(expectedMessage);
    pushResultDialogTester.closeDialog();
}
Also used : PushWizardTester(org.eclipse.egit.ui.common.PushWizardTester) Git(org.eclipse.jgit.api.Git) PushResultDialogTester(org.eclipse.egit.ui.common.PushResultDialogTester) RepoPropertiesPage(org.eclipse.egit.ui.common.RepoPropertiesPage) LoginDialogTester(org.eclipse.egit.ui.common.LoginDialogTester) RefSpecPageTester(org.eclipse.egit.ui.common.RefSpecPageTester) Test(org.junit.Test)

Example 9 with RepoPropertiesPage

use of org.eclipse.egit.ui.common.RepoPropertiesPage in project egit by eclipse.

the class GitCloneWizardTest method canCloneARemoteRepo.

@Test
public void canCloneARemoteRepo() throws Exception {
    destRepo = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), "test1");
    importWizard.openWizard();
    RepoPropertiesPage propertiesPage = importWizard.openRepoPropertiesPage();
    RepoRemoteBranchesPage remoteBranches = propertiesPage.nextToRemoteBranches(r.getUri());
    cloneRepo(destRepo, remoteBranches);
    bot.button("Cancel").click();
}
Also used : RepoPropertiesPage(org.eclipse.egit.ui.common.RepoPropertiesPage) RepoRemoteBranchesPage(org.eclipse.egit.ui.common.RepoRemoteBranchesPage) File(java.io.File) Test(org.junit.Test)

Example 10 with RepoPropertiesPage

use of org.eclipse.egit.ui.common.RepoPropertiesPage in project egit by eclipse.

the class GitCloneWizardTest method updatesParameterFieldsInImportDialogWhenURIIsUpdated.

@Test
public void updatesParameterFieldsInImportDialogWhenURIIsUpdated() throws Exception {
    importWizard.openWizard();
    RepoPropertiesPage propertiesPage = importWizard.openRepoPropertiesPage();
    propertiesPage.setURI("git://www.jgit.org/EGIT");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "", "", false, false);
    propertiesPage.appendToURI("X");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGITX", "git", "", true, "", "", false, false);
    propertiesPage.setURI("git://www.jgit.org/EGIT");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "git", "", true, "", "", false, false);
    propertiesPage.setURI("git://user:hi@www.jgit.org/EGIT");
    propertiesPage.assertSourceParams(" User not supported on git protocol.", "www.jgit.org", "/EGIT", "git", "", true, "", "", false, false);
    // UI doesn't change URI even when password is entered in clear text as
    // part of URI. Opinions on this may vary.
    propertiesPage.assertURI("git://user:hi@www.jgit.org/EGIT");
    propertiesPage.setURI("ssh://user@www.jgit.org/EGIT");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "ssh", "", true, "user", "", true, true);
    propertiesPage.setURI("ssh://user@www.jgit.org/EGIT");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "ssh", "", true, "user", "", true, true);
    propertiesPage.setURI("ssh://user:hi@www.jgit.org:33/EGIT");
    propertiesPage.assertSourceParams(null, "www.jgit.org", "/EGIT", "ssh", "33", true, "user", "hi", true, true);
    propertiesPage.setURI("ssh:///EGIT");
    propertiesPage.assertSourceParams(" Host required for ssh protocol.", "", "/EGIT", "ssh", "", true, "", "", true, true);
    propertiesPage.setURI("file:///some/place");
    if (Platform.getOS().equals(Platform.OS_WIN32))
        propertiesPage.assertSourceParams(" " + System.getProperty("user.dir") + "\\.\\some\\place does not exist.", "", "/some/place", "file", "", false, "", "", false, false);
    else
        propertiesPage.assertSourceParams(" /some/place does not exist.", "", "/some/place", "file", "", false, "", "", false, false);
    // Now try changing some fields other than URI and see how the URI field
    // gets changed
    propertiesPage.setURI("ssh://user@www.jgit.org/EGIT");
    // ..change host
    bot.textWithLabel("Host:").setText("example.com");
    propertiesPage.assertURI("ssh://user@example.com/EGIT");
    propertiesPage.assertSourceParams(null, "example.com", "/EGIT", "ssh", "", true, "user", "", true, true);
    // ..change user
    bot.textWithLabel("User:").setText("gitney");
    propertiesPage.assertURI("ssh://gitney@example.com/EGIT");
    propertiesPage.assertSourceParams(null, "example.com", "/EGIT", "ssh", "", true, "gitney", "", true, true);
    // ..change password
    bot.textWithLabel("Password:").setText("fsck");
    // Password is not written into the URL here!
    propertiesPage.assertURI("ssh://gitney@example.com/EGIT");
    propertiesPage.assertSourceParams(null, "example.com", "/EGIT", "ssh", "", true, "gitney", "fsck", true, true);
    // change port number
    bot.textWithLabel("Port:").setText("99");
    propertiesPage.assertURI("ssh://gitney@example.com:99/EGIT");
    propertiesPage.assertSourceParams(null, "example.com", "/EGIT", "ssh", "99", true, "gitney", "fsck", true, true);
    // change protocol to another with user/password capability
    bot.comboBoxWithLabel("Protocol:").setSelection("ftp");
    propertiesPage.assertURI("ftp://gitney@example.com:99/EGIT");
    propertiesPage.assertSourceParams(null, "example.com", "/EGIT", "ftp", "99", true, "gitney", "fsck", true, true);
    // change protocol to one without user/password capability
    bot.comboBoxWithLabel("Protocol:").setSelection("git");
    propertiesPage.assertURI("git://example.com:99/EGIT");
    propertiesPage.assertSourceParams(null, "example.com", "/EGIT", "git", "99", true, "", "", false, false);
    // change protocol to one without host capability
    bot.comboBoxWithLabel("Protocol:").setSelection("file");
    propertiesPage.assertURI("file:///EGIT");
    propertiesPage.assertSourceParams(" /EGIT does not exist.", "", "/EGIT", "file", "", false, "", "", false, false);
    // that one should exist.
    if (Platform.getOS().equals(Platform.OS_WIN32))
        propertiesPage.setURI("file:///" + System.getProperty("user.home"));
    else
        propertiesPage.setURI("file://" + System.getProperty("user.home"));
    propertiesPage.assertSourceParams(null, "", System.getProperty("user.home"), "file", "", false, "", "", false, false);
    // Local protocol without file: prefix
    propertiesPage.setURI(System.getProperty("user.home"));
    propertiesPage.assertSourceParams(null, "", System.getProperty("user.home"), "file", "", false, "", "", false, false);
    // a case for forward slashes using the non prefixed local protocol.
    if (Platform.getOS().equals(Platform.OS_WIN32)) {
        propertiesPage.setURI(System.getProperty("user.home"));
        propertiesPage.assertSourceParams(null, "", System.getProperty("user.home"), "file", "", false, "", "", false, false);
    }
    bot.button("Cancel").click();
}
Also used : RepoPropertiesPage(org.eclipse.egit.ui.common.RepoPropertiesPage) Test(org.junit.Test)

Aggregations

RepoPropertiesPage (org.eclipse.egit.ui.common.RepoPropertiesPage)12 Test (org.junit.Test)11 RepoRemoteBranchesPage (org.eclipse.egit.ui.common.RepoRemoteBranchesPage)8 File (java.io.File)4 Ignore (org.junit.Ignore)3 WorkingCopyPage (org.eclipse.egit.ui.common.WorkingCopyPage)2 LoginDialogTester (org.eclipse.egit.ui.common.LoginDialogTester)1 PushResultDialogTester (org.eclipse.egit.ui.common.PushResultDialogTester)1 PushWizardTester (org.eclipse.egit.ui.common.PushWizardTester)1 RefSpecPageTester (org.eclipse.egit.ui.common.RefSpecPageTester)1 Git (org.eclipse.jgit.api.Git)1 Repository (org.eclipse.jgit.lib.Repository)1 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)1