use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.
the class GitRepositoriesViewFetchAndPushTest method testFetchFromOrigin.
private void testFetchFromOrigin(boolean useRemote) throws Exception {
Activator.getDefault().getRepositoryUtil().addConfiguredRepository(clonedRepositoryFile);
Activator.getDefault().getRepositoryUtil().addConfiguredRepository(clonedRepositoryFile2);
Repository repository = lookupRepository(clonedRepositoryFile2);
// add the configuration for push from cloned2
repository.getConfig().setString("remote", "origin", "push", "refs/heads/*:refs/heads/*");
repository.getConfig().save();
SWTBotTree tree = getOrOpenView().bot().tree();
String destinationString = clonedRepositoryFile.getParentFile().getName() + " - " + "origin";
String dialogTitle = NLS.bind(UIText.FetchResultDialog_title, destinationString);
selectNode(tree, useRemote, true);
runFetch(tree);
bot.waitUntil(Conditions.shellIsActive(dialogTitle));
SWTBotShell confirm = bot.shell(dialogTitle);
assertEquals("Wrong result tree row count", 0, confirm.bot().tree().rowCount());
confirm.close();
deleteAllProjects();
shareProjects(clonedRepositoryFile2);
String objid = repository.exactRef("refs/heads/master").getTarget().getObjectId().name();
objid = objid.substring(0, 7);
touchAndSubmit(null);
// push from other repository
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 60, TimeUnit.SECONDS);
PushOperationUI op = new PushOperationUI(repository, "origin", false);
op.start();
TestUtil.openJobResultDialog(jobJoiner.join());
String pushdialogTitle = NLS.bind(UIText.PushResultDialog_title, op.getDestinationString());
bot.shell(pushdialogTitle).close();
deleteAllProjects();
refreshAndWait();
selectNode(tree, useRemote, true);
runFetch(tree);
bot.waitUntil(Conditions.shellIsActive(dialogTitle));
confirm = bot.shell(dialogTitle);
SWTBotTreeItem[] treeItems = confirm.bot().tree().getAllItems();
boolean found = false;
for (SWTBotTreeItem item : treeItems) {
found = item.getText().contains(objid);
if (found)
break;
}
assertTrue(found);
confirm.close();
selectNode(tree, useRemote, true);
runFetch(tree);
confirm = bot.shell(dialogTitle);
assertEquals("Wrong result tree row count", 0, confirm.bot().tree().rowCount());
}
use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.
the class CompareActionsTest method testCompareWithCommit.
@Test
public void testCompareWithCommit() throws Exception {
String compareWithCommitMenuText = util.getPluginLocalizedValue("CompareWithCommitAction.label");
String dialogTitle = UIText.CommitSelectionDialog_WindowTitle;
SWTBotShell dialog = openCompareWithDialog(compareWithCommitMenuText, dialogTitle);
// use the default (the last commit) -> no changes
assertEquals(3, dialog.bot().table().rowCount());
dialog.bot().table().select(0);
JobJoiner jobJoiner = JobJoiner.startListening(ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS);
dialog.bot().button(IDialogConstants.OK_LABEL).click();
jobJoiner.join();
closeFirstEmptySynchronizeDialog();
assertSynchronizeNoChange();
// use the second (previous) -> should have a change
dialog = openCompareWithDialog(compareWithCommitMenuText, dialogTitle);
dialog.bot().table().select(1);
jobJoiner = JobJoiner.startListening(ISynchronizeManager.FAMILY_SYNCHRONIZE_OPERATION, 60, TimeUnit.SECONDS);
dialog.bot().button(IDialogConstants.OK_LABEL).click();
jobJoiner.join();
assertSynchronizeFile1Changed();
}
use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.
the class FetchAndMergeActionTest method checkoutBranch.
private void checkoutBranch(String branchToCheckout) {
SWTBotTree projectExplorerTree = TestUtil.getExplorerTree();
getProjectItem(projectExplorerTree, PROJ1).select();
String[] menuPath = new String[] { util.getPluginLocalizedValue("TeamMenu.label"), util.getPluginLocalizedValue("SwitchToMenu.label"), branchToCheckout };
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.CHECKOUT, 60, TimeUnit.SECONDS);
ContextMenuHelper.clickContextMenuSync(projectExplorerTree, menuPath);
jobJoiner.join();
}
use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.
the class SynchronizeViewPushTest method shouldUpdateTrackingBranchOnPush.
@Test
public void shouldUpdateTrackingBranchOnPush() throws Exception {
makeChangesAndCommit(PROJ1);
Repository repository = lookupRepository(repositoryFile);
ObjectId headId = repository.resolve(Constants.HEAD);
String trackingBranch = Constants.R_REMOTES + "origin/master";
launchSynchronization(Constants.HEAD, trackingBranch, false);
SWTBotView viewBot = bot.viewById(ISynchronizeView.VIEW_ID);
SWTBotToolbarButton pushButton = viewBot.toolbarButton(UIText.GitActionContributor_Push);
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 30, TimeUnit.SECONDS);
pushButton.click();
TestUtil.openJobResultDialog(jobJoiner.join());
String destinationString = repositoryFile.getParentFile().getName() + " - " + "origin";
SWTBotShell resultDialog = bot.shell(NLS.bind(UIText.PushResultDialog_title, destinationString));
resultDialog.close();
Repository remoteRepository = lookupRepository(childRepositoryFile);
ObjectId masterOnRemote = remoteRepository.resolve("master");
assertThat("Expected push to update branch on remote repository", masterOnRemote, is(headId));
ObjectId trackingId = repository.resolve(trackingBranch);
assertThat("Expected tracking branch to be updated", trackingId, is(headId));
}
use of org.eclipse.egit.ui.test.JobJoiner in project egit by eclipse.
the class ReplaceActionsTest method executeReplace.
private void executeReplace(SWTBotShell dialog, String buttonLabel) {
JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.DISCARD_CHANGES, 30, TimeUnit.SECONDS);
dialog.bot().button(buttonLabel).click();
jobJoiner.join();
}
Aggregations