use of org.eclipse.egit.ui.common.ExistingOrNewPage.Row in project egit by eclipse.
the class SharingWizardTest method shareProjectWithAlreadyCreatedRepos.
@Test
public void shareProjectWithAlreadyCreatedRepos() throws Exception {
Repository repo1 = FileRepositoryBuilder.create(new File(new File(createProject(projectName1)).getParent(), ".git"));
repo1.create();
repo1.close();
Repository repo2 = FileRepositoryBuilder.create(new File(createProject(projectName2), ".git"));
repo2.create();
repo2.close();
Repository repo3 = FileRepositoryBuilder.create(new File(createProject(projectName3), ".git"));
repo3.create();
try (Git git = new Git(repo3)) {
git.add().addFilepattern(".").call();
git.commit().setAuthor("A U Thior", "au.thor@example.com").setMessage("Created Project 3").call();
}
repo3.close();
ExistingOrNewPage existingOrNewPage = sharingWizard.openWizard(projectName1, projectName2, projectName3);
existingOrNewPage.setInternalMode(true);
// initial state
IWorkspace workspace = ResourcesPlugin.getWorkspace();
String projectPath1 = workspace.getRoot().getProject(projectName1).getLocation().toOSString();
String projectPath2 = workspace.getRoot().getProject(projectName2).getLocation().toOSString();
String projectPath3 = workspace.getRoot().getProject(projectName3).getLocation().toOSString();
existingOrNewPage.assertContents(new Row[] { new Row(true, projectName1, projectPath1, ".." + File.separator + ".git"), new Row(false, projectName2, projectPath2, "", new Row[] { new Row(false, ".", "", ".git"), new Row(false, "..", "", ".." + File.separator + ".git") }), new Row(false, projectName3, projectPath3, "", new Row[] { new Row(true, ".", "", ".git"), new Row(false, "..", "", ".." + File.separator + ".git") }) }, "");
bot.tree().getAllItems()[1].getItems()[0].check();
existingOrNewPage.assertEnabling(false, false, true);
SWTBotShell shell = bot.activeShell();
bot.button(IDialogConstants.FINISH_LABEL).click();
bot.waitUntil(Conditions.shellCloses(shell));
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
assertEquals(repo1.getDirectory().getAbsolutePath(), RepositoryMapping.getMapping(workspace.getRoot().getProject(projectName1)).getRepository().getDirectory().toString());
assertEquals(repo2.getDirectory().getAbsolutePath(), RepositoryMapping.getMapping(workspace.getRoot().getProject(projectName2)).getRepository().getDirectory().toString());
}
Aggregations