Search in sources :

Example 11 with JobJoiner

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

the class AbstractSynchronizeViewTest method launchSynchronization.

protected void launchSynchronization(String projectName, String srcRef, String dstRef, boolean includeLocal) throws IOException {
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    RepositoryMapping mapping = assertConnected(project);
    Repository repo = mapping.getRepository();
    GitSynchronizeData data = new GitSynchronizeData(repo, srcRef, dstRef, includeLocal);
    JobJoiner jobJoiner = JobJoiner.startListening(ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS);
    GitModelSynchronize.launch(data, new IResource[] { project });
    jobJoiner.join();
}
Also used : GitSynchronizeData(org.eclipse.egit.core.synchronize.dto.GitSynchronizeData) Repository(org.eclipse.jgit.lib.Repository) JobJoiner(org.eclipse.egit.ui.test.JobJoiner) RepositoryMapping(org.eclipse.egit.core.project.RepositoryMapping) IProject(org.eclipse.core.resources.IProject)

Example 12 with JobJoiner

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

the class CommitActionStagingViewTest method assertCommitWithAutoStage.

private void assertCommitWithAutoStage(boolean withUntracked) throws Exception {
    Activator.getDefault().getPreferenceStore().setValue(UIPreferences.AUTO_STAGE_ON_COMMIT, true);
    boolean initialIncludeUntracked = Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.COMMIT_DIALOG_INCLUDE_UNTRACKED);
    Activator.getDefault().getPreferenceStore().setValue(UIPreferences.COMMIT_DIALOG_INCLUDE_UNTRACKED, withUntracked);
    String newFile = "newFile.txt";
    try {
        setTestFileContent("I have changed this");
        touch(PROJ1, newFile, "New file content");
        SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
        util.getProjectItems(projectExplorerTree, PROJ1)[0].select();
        String menuString = util.getPluginLocalizedValue("CommitAction_label");
        JobJoiner joiner = JobJoiner.startListening(ADD_TO_INDEX, 10, TimeUnit.SECONDS);
        ContextMenuHelper.clickContextMenu(projectExplorerTree, "Team", menuString);
        joiner.join();
        TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
        TestUtil.waitUntilViewWithGivenIdShows(StagingView.VIEW_ID);
        StagingUtil.assertStaging(PROJ1, FOLDER + '/' + FILE1, true);
        StagingUtil.assertStaging(PROJ1, newFile, withUntracked);
    } finally {
        Activator.getDefault().getPreferenceStore().setValue(UIPreferences.COMMIT_DIALOG_INCLUDE_UNTRACKED, initialIncludeUntracked);
    }
}
Also used : JobJoiner(org.eclipse.egit.ui.test.JobJoiner) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)

Example 13 with JobJoiner

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

the class CompareActionsTest method testCompareWithRef.

@Test
public void testCompareWithRef() throws Exception {
    String compareWithRefActionLabel = util.getPluginLocalizedValue("CompareWithBranchOrTagAction.label");
    String dialogTitle = UIText.CompareTargetSelectionDialog_WindowTitle;
    SWTBotShell dialog = openCompareWithDialog(compareWithRefActionLabel, dialogTitle);
    // use the default (the last commit) -> no changes
    JobJoiner jobJoiner = JobJoiner.startListening(ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS);
    dialog.bot().button(UIText.CompareTargetSelectionDialog_CompareButton).click();
    jobJoiner.join();
    closeFirstEmptySynchronizeDialog();
    assertSynchronizeNoChange();
    // use the tag -> should have a change
    dialog = openCompareWithDialog(compareWithRefActionLabel, dialogTitle);
    SWTBotTreeItem tags = TestUtil.expandAndWait(dialog.bot().tree().getTreeItem(TAGS));
    TestUtil.getChildNode(tags, "SomeTag").select();
    jobJoiner = JobJoiner.startListening(ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS);
    dialog.bot().button(UIText.CompareTargetSelectionDialog_CompareButton).click();
    jobJoiner.join();
    assertSynchronizeFile1Changed();
}
Also used : JobJoiner(org.eclipse.egit.ui.test.JobJoiner) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 14 with JobJoiner

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

the class CompareActionsTest method clickCompareWithAndWaitForSync.

private void clickCompareWithAndWaitForSync(String menuLabel) {
    JobJoiner jobJoiner = JobJoiner.startListening(ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS);
    clickCompareWith(menuLabel);
    jobJoiner.join();
}
Also used : JobJoiner(org.eclipse.egit.ui.test.JobJoiner)

Example 15 with JobJoiner

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

the class FetchAndMergeActionTest method fetch.

private void fetch() throws Exception {
    SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
    getProjectItem(projectExplorerTree, PROJ1).select();
    String menuString = util.getPluginLocalizedValue("FetchFromUpstreamAction.label");
    JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.FETCH, 20, TimeUnit.SECONDS);
    ContextMenuHelper.clickContextMenu(projectExplorerTree, "Team", menuString);
    TestUtil.openJobResultDialog(jobJoiner.join());
}
Also used : JobJoiner(org.eclipse.egit.ui.test.JobJoiner) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)

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