use of com.oxygenxml.git.view.staging.ConflictButtonsPanel in project oxygen-git-client-addon by oxygenxml.
the class FlatView2Test method testShowHideRebasePanelWhenChangingRepo.
/**
* <p><b>Description:</b> Show and hide the rebase panel when changing the repository.</p>
* <p><b>Bug ID:</b> EXM-42025</p>
*
* @author sorin_carbunaru
*
* @throws Exception If it fails.
*/
@Test
public void testShowHideRebasePanelWhenChangingRepo() throws Exception {
String localTestRepository_1 = "target/test-resources/testShowRebasePanel_thenAbort-local-1";
String localTestRepository_2 = "target/test-resources/testShowRebasePanel_thenAbort-local-2";
String remoteTestRepository = "target/test-resources/testShowRebasePanel_thenAbort-remote";
// Create and repositories
Repository remoteRepo = createRepository(remoteTestRepository);
Repository localRepo_1 = createRepository(localTestRepository_1);
Repository localRepo_2 = createRepository(localTestRepository_2);
bindLocalToRemote(localRepo_1, remoteRepo);
bindLocalToRemote(localRepo_2, remoteRepo);
new File(localTestRepository_1).mkdirs();
new File(localTestRepository_2).mkdirs();
// -------------- REPO 1
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_1);
File firstRepoFile = new File(localTestRepository_1 + "/test.txt");
firstRepoFile.createNewFile();
setFileContent(firstRepoFile, "First version");
GitAccess.getInstance().add(new FileStatus(GitChangeType.UNKNOWN, "test.txt"));
GitAccess.getInstance().commit("First commit.");
push("", "");
// ----------------- REPO 2
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_2);
File secondRepoFile = new File(localTestRepository_2 + "/test.txt");
refreshSupport.call();
flushAWT();
sleep(400);
assertFalse(secondRepoFile.exists());
pull("", "", PullType.REBASE, false);
assertTrue(secondRepoFile.exists());
// Modify file and commit and push
setFileContent(secondRepoFile, "Second versions");
GitAccess.getInstance().add(new FileStatus(GitChangeType.MODIFIED, "test.txt"));
GitAccess.getInstance().commit("Second commit.");
push("", "");
// -------------- REPO 1
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_1);
setFileContent(firstRepoFile, "Third version");
GitAccess.getInstance().add(new FileStatus(GitChangeType.MODIFIED, "test.txt"));
GitAccess.getInstance().commit("Third commit.");
// Now pull to generate conflict
ConflictButtonsPanel rebasePanel = stagingPanel.getConflictButtonsPanel();
assertFalse(rebasePanel.isShowing());
flushAWT();
PullResponse pullResponse = pull("", "", PullType.REBASE, false);
refreshSupport.call();
waitForScheduler();
assertEquals(PullStatus.CONFLICTS, pullResponse.getStatus());
assertTrue(rebasePanel.isShowing());
// --------------- REPO 2
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_2);
sleep(300);
assertFalse(rebasePanel.isShowing());
// --------------- REPO 1
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_1);
sleep(300);
assertTrue(rebasePanel.isShowing());
}
use of com.oxygenxml.git.view.staging.ConflictButtonsPanel in project oxygen-git-client-addon by oxygenxml.
the class FlatView2Test method testShowRebasePanel_thenContinue.
/**
* <p><b>Description:</b> Show and hide (by continuing the rebase) the rebase panel.</p>
* <p><b>Bug ID:</b> EXM-42025</p>
*
* @author sorin_carbunaru
*
* @throws Exception If it fails.
*/
@Test
public void testShowRebasePanel_thenContinue() throws Exception {
String localTestRepository_1 = "target/test-resources/testShowRebasePanel_thenContinue-local-1";
String localTestRepository_2 = "target/test-resources/testShowRebasePanel_thenContinue-local-2";
String remoteTestRepository = "target/test-resources/testShowRebasePanel_thenContinue-remote";
// Create and repositories
Repository remoteRepo = createRepository(remoteTestRepository);
Repository localRepo_1 = createRepository(localTestRepository_1);
Repository localRepo_2 = createRepository(localTestRepository_2);
bindLocalToRemote(localRepo_1, remoteRepo);
bindLocalToRemote(localRepo_2, remoteRepo);
new File(localTestRepository_1).mkdirs();
new File(localTestRepository_2).mkdirs();
// -------------- REPO 1
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_1);
File firstRepoFile = new File(localTestRepository_1 + "/test.txt");
firstRepoFile.createNewFile();
setFileContent(firstRepoFile, "First version");
GitAccess.getInstance().add(new FileStatus(GitChangeType.UNKNOWN, "test.txt"));
GitAccess.getInstance().commit("First commit.");
push("", "");
// ----------------- REPO 2
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_2);
File secondRepoFile = new File(localTestRepository_2 + "/test.txt");
refreshSupport.call();
flushAWT();
sleep(400);
assertFalse(secondRepoFile.exists());
pull("", "", PullType.REBASE, false);
assertTrue(secondRepoFile.exists());
// Modify file and commit and push
setFileContent(secondRepoFile, "Second versions");
GitAccess.getInstance().add(new FileStatus(GitChangeType.MODIFIED, "test.txt"));
GitAccess.getInstance().commit("Second commit.");
push("", "");
// -------------- REPO 1
GitAccess.getInstance().setRepositorySynchronously(localTestRepository_1);
setFileContent(firstRepoFile, "Third version");
GitAccess.getInstance().add(new FileStatus(GitChangeType.MODIFIED, "test.txt"));
GitAccess.getInstance().commit("Third commit.");
// Now pull to generate conflict
ConflictButtonsPanel rebasePanel = stagingPanel.getConflictButtonsPanel();
assertFalse(rebasePanel.isShowing());
flushAWT();
PullResponse pullResponse = pull("", "", PullType.REBASE, false);
refreshSupport.call();
waitForScheduler();
assertEquals(PullStatus.CONFLICTS, pullResponse.getStatus());
assertTrue(rebasePanel.isShowing());
GitControllerBase sc = new GitControllerBase(GitAccess.getInstance()) {
@Override
protected boolean isUserOKWithResolvingRebaseConflictUsingMineOrTheirs(ConflictResolution cmd) {
return cmd == ConflictResolution.RESOLVE_USING_MINE;
}
};
sc.asyncResolveUsingMine(Arrays.asList(new FileStatus(GitChangeType.CONFLICT, "test.txt")));
waitForScheduler();
flushAWT();
JButton continueBtn = findFirstButton(rebasePanel, Tags.CONTINUE_REBASE);
assertNotNull(continueBtn);
continueBtn.doClick();
waitForScheduler();
flushAWT();
assertFalse(rebasePanel.isShowing());
}
Aggregations