Search in sources :

Example 16 with JobJoiner

use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.

the class GitRepositoriesViewFetchAndPushTest method runFetch.

private void runFetch(SWTBotTree tree) {
    JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 60, TimeUnit.SECONDS);
    ContextMenuHelper.clickContextMenuSync(tree, myUtil.getPluginLocalizedValue("SimpleFetchCommand"));
    TestUtil.openJobResultDialog(jobJoiner.join());
}
Also used : JobJoiner(org.eclipse.egit.ui.test.JobJoiner)

Example 17 with JobJoiner

use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.

the class GitRepositoriesViewFetchAndPushTest method runPush.

private void runPush(SWTBotTree tree) {
    JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 60, TimeUnit.SECONDS);
    ContextMenuHelper.clickContextMenuSync(tree, myUtil.getPluginLocalizedValue("SimplePushCommand"));
    TestUtil.openJobResultDialog(jobJoiner.join());
}
Also used : JobJoiner(org.eclipse.egit.ui.test.JobJoiner)

Example 18 with JobJoiner

use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.

the class PushActionTest method pushTo.

private void pushTo(String destination, boolean withConfirmPage) throws Exception, MissingObjectException, IncorrectObjectTypeException, IOException {
    Repository repo = lookupRepository(remoteRepositoryFile);
    try (RevWalk rw = new RevWalk(repo)) {
        String previous = rw.parseCommit(repo.resolve("HEAD")).name();
        touchAndSubmit(null);
        SWTBotShell pushDialog = openPushDialog();
        SWTBotCombo destinationCombo = pushDialog.bot().comboBox();
        String[] items = destinationCombo.items();
        for (int i = 0; i < items.length; i++) {
            if (items[i].startsWith(destination))
                destinationCombo.setSelection(i);
        }
        pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
        if (withConfirmPage) {
            pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
        }
        JobJoiner joiner = JobJoiner.startListening(JobFamilies.PUSH, 20, TimeUnit.SECONDS);
        pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
        TestUtil.openJobResultDialog(joiner.join());
        String title = NLS.bind(UIText.PushResultDialog_title, destination);
        bot.waitUntil(Conditions.shellIsActive(title));
        SWTBotShell confirm = bot.shell(title);
        String result = confirm.bot().tree().getAllItems()[0].getText();
        assertTrue("Wrong result", result.contains(previous.substring(0, 7)));
        confirm.close();
        pushDialog = openPushDialog();
        destinationCombo = pushDialog.bot().comboBox();
        for (int i = 0; i < items.length; i++) {
            if (items[i].startsWith(destination))
                destinationCombo.setSelection(i);
        }
        pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
        if (withConfirmPage) {
            pushDialog.bot().button(IDialogConstants.NEXT_LABEL).click();
        }
        joiner = JobJoiner.startListening(JobFamilies.PUSH, 20, TimeUnit.SECONDS);
        pushDialog.bot().button(IDialogConstants.FINISH_LABEL).click();
        TestUtil.openJobResultDialog(joiner.join());
        bot.waitUntil(Conditions.shellIsActive(title));
        confirm = bot.shell(title);
        result = confirm.bot().tree().getAllItems()[0].getText();
        confirm.close();
        assertTrue("Wrong result", result.contains(UIText.PushResultTable_statusUpToDate));
    }
}
Also used : SWTBotCombo(org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo) Repository(org.eclipse.jgit.lib.Repository) JobJoiner(org.eclipse.egit.ui.test.JobJoiner) RevWalk(org.eclipse.jgit.revwalk.RevWalk) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Aggregations

JobJoiner (org.eclipse.egit.ui.test.JobJoiner)18 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)6 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)6 Repository (org.eclipse.jgit.lib.Repository)4 Test (org.junit.Test)3 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)2 IProject (org.eclipse.core.resources.IProject)1 RepositoryMapping (org.eclipse.egit.core.project.RepositoryMapping)1 GitSynchronizeData (org.eclipse.egit.core.synchronize.dto.GitSynchronizeData)1 PushOperationUI (org.eclipse.egit.ui.internal.push.PushOperationUI)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1 RevWalk (org.eclipse.jgit.revwalk.RevWalk)1 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)1 SWTBotCombo (org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo)1 SWTBotToolbarButton (org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton)1