Package org.eclipse.egit.ui.common

Examples of org.eclipse.egit.ui.common.CommitDialogTester


  }

  @Test
  public void testCommitSingleFile() throws Exception {
    setTestFileContent("I have changed this");
    CommitDialogTester commitDialogTester = CommitDialogTester
        .openCommitDialog(PROJ1);
    assertEquals("Wrong row count", 1, commitDialogTester.getRowCount());
    assertTrue("Wrong file",
        commitDialogTester.getEntryText(0).endsWith("test.txt"));
    commitDialogTester.setAuthor(TestUtil.TESTAUTHOR);
    commitDialogTester.setCommitter(TestUtil.TESTCOMMITTER);
    commitDialogTester.setCommitMessage("The new commit");
    commitDialogTester.commit();
    TestUtil.checkHeadCommit(lookupRepository(repositoryFile),
        TestUtil.TESTAUTHOR, TestUtil.TESTCOMMITTER, "The new commit");
    NoFilesToCommitPopup popup = CommitDialogTester
        .openCommitDialogExpectNoFilesToCommit(PROJ1);
    popup.cancelPopup();
View Full Code Here


  public void testAmendWithChangeIdPreferenceOff() throws Exception {
    Repository repo = lookupRepository(repositoryFile);
    repo.getConfig().setBoolean(ConfigConstants.CONFIG_GERRIT_SECTION,
        null, ConfigConstants.CONFIG_KEY_CREATECHANGEID, true);
    setTestFileContent("Another Change");
    CommitDialogTester commitDialogTester = CommitDialogTester
        .openCommitDialog(PROJ1);
    assertEquals("Wrong row count", 1, commitDialogTester.getRowCount());
    assertTrue("Wrong file",
        commitDialogTester.getEntryText(0).endsWith("test.txt"));
    commitDialogTester.setAuthor(TestUtil.TESTAUTHOR);
    commitDialogTester.setCommitter(TestUtil.TESTCOMMITTER);
    String commitMessage = commitDialogTester.getCommitMessage();
    assertTrue(commitMessage.indexOf("Change-Id") > 0);
    String newCommitMessage = "Change to be amended \n\n" + commitMessage;
    commitDialogTester.setCommitMessage(newCommitMessage);
    commitDialogTester.commit();
    NoFilesToCommitPopup noFilesToCommitPopup = CommitDialogTester
        .openCommitDialogExpectNoFilesToCommit(PROJ1);
    repo.getConfig().setBoolean(ConfigConstants.CONFIG_GERRIT_SECTION,
        null, ConfigConstants.CONFIG_KEY_CREATECHANGEID, false);
    commitDialogTester = noFilesToCommitPopup.confirmPopup();
    assertTrue(commitDialogTester.getCommitMessage().indexOf("Change-Id") > 0);
  }
View Full Code Here

    RevCommit oldHeadCommit = TestUtil.getHeadCommit(repository);
    commitOneFileChange("Again another Change");
    ObjectId headCommitId = TestUtil.getHeadCommit(repository).getId();
    NoFilesToCommitPopup noFilesToCommitPopup = CommitDialogTester
        .openCommitDialogExpectNoFilesToCommit(PROJ1);
    CommitDialogTester commitDialogTester = noFilesToCommitPopup.confirmPopup();
    assertTrue(commitDialogTester.getCommitMessage().indexOf("Change-Id") > 0);
    assertTrue(commitDialogTester.getCommitMessage().indexOf("Signed-off-by") > 0);
    assertTrue(commitDialogTester.getAmend());
    assertTrue(commitDialogTester.getSignedOff());
    assertTrue(commitDialogTester.getInsertChangeId());
    // change commit message to get a different SHA1 for the commit
    commitDialogTester.setCommitMessage("Changed "
        + commitDialogTester.getCommitMessage());
    commitDialogTester.commit();
    RevCommit headCommit = TestUtil.getHeadCommit(repository);
    if(headCommitId.equals(headCommit.getId()))
      fail("There is no new commit");
    assertEquals(oldHeadCommit, headCommit.getParent(0));
  }
View Full Code Here

    assertEquals(oldHeadCommit, headCommit.getParent(0));
  }

  private void commitOneFileChange(String fileContent) throws Exception {
    setTestFileContent(fileContent);
    CommitDialogTester commitDialogTester = CommitDialogTester
        .openCommitDialog(PROJ1);
    commitDialogTester.setShowUntracked(false);

    assertEquals("Wrong row count", 1, commitDialogTester.getRowCount());
    assertTrue("Wrong file",
        commitDialogTester.getEntryText(0).endsWith("test.txt"));
    commitDialogTester.setAuthor(TestUtil.TESTAUTHOR);
    commitDialogTester.setCommitter(TestUtil.TESTCOMMITTER);
    commitDialogTester.setCommitMessage("Commit message");
    commitDialogTester.setInsertChangeId(true);
    commitDialogTester.setSignedOff(true);

    String commitMessage = commitDialogTester.getCommitMessage();
    assertTrue(commitMessage.indexOf("Change-Id") > 0);
    assertTrue(commitMessage.indexOf("Signed-off-by") > 0);
    commitDialogTester.commit();
  }
View Full Code Here

    RevCommit headCommit = TestUtil.getHeadCommit(repository);
    ObjectId headCommitId = headCommit.getId();
    String changeId = CommitMessageUtil.extractChangeId(headCommit
        .getFullMessage());
    setTestFileContent("Changes over changes");
    CommitDialogTester commitDialogTester = CommitDialogTester
        .openCommitDialog(PROJ1);
    commitDialogTester.setAmend(true);
    assertTrue(commitDialogTester.getCommitMessage().indexOf("Change-Id") > 0);
    assertTrue(commitDialogTester.getCommitMessage().indexOf(
        "Signed-off-by") > 0);
    assertTrue(commitDialogTester.getSignedOff());
    assertTrue(commitDialogTester.getInsertChangeId());
    commitDialogTester.commit();
    headCommit = TestUtil.getHeadCommit(repository);
    if(headCommitId.equals(headCommit.getId()))
      fail("There is no new commit");
    assertEquals(oldHeadCommit, headCommit.getParent(0));
    assertTrue(headCommit.getFullMessage().indexOf(changeId) > 0);
View Full Code Here

      assertFalse(file.exists());
      file.create(
          new ByteArrayInputStream("new file".getBytes(prj
              .getDefaultCharset())), 0, null);
      assertTrue(file.exists());
      CommitDialogTester commitDialogTester = CommitDialogTester
          .openCommitDialog(PROJ1);
      assertEquals(1, commitDialogTester.getRowCount());
      assertTrue(commitDialogTester.isEntryChecked(0));
      String path = RepositoryMapping.getMapping(file)
          .getRepoRelativePath(file);
      assertEquals(path, commitDialogTester.getEntryText(0));
      commitDialogTester.setCommitMessage("Add new file");
      commitDialogTester.commit();
      file.delete(false, null);
    } finally {
      Activator
          .getDefault()
          .getPreferenceStore()
View Full Code Here

  @Test
  public void testSortingByName() throws Exception {
    IFile fileA = touch(PROJ1, "a", "a");
    IFile fileB = touch(PROJ1, "b", "b");
    CommitDialogTester commitDialogTester = CommitDialogTester
        .openCommitDialog(PROJ1);
    commitDialogTester.setShowUntracked(true);
    assertEquals(2, commitDialogTester.getRowCount());
    assertEquals(PROJ1 + "/a", commitDialogTester.getEntryText(0));
    assertEquals(PROJ1 + "/b", commitDialogTester.getEntryText(1));
    // Sort ascending (first click changes default sort order)
    commitDialogTester.sortByName();
    // Sort descending (now the sort order should be reversed)
    commitDialogTester.sortByName();
    assertEquals(PROJ1 + "/b", commitDialogTester.getEntryText(0));
    assertEquals(PROJ1 + "/a", commitDialogTester.getEntryText(1));
    commitDialogTester.cancel();
    fileA.delete(false, null);
    fileB.delete(false, null);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.common.CommitDialogTester

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.