Search in sources :

Example 6 with GitModelCommit

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit in project egit by eclipse.

the class GitChangeSetSorterTest method cacheTreeShouldBeLessThanCommit.

@Test
public void cacheTreeShouldBeLessThanCommit() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCache cache = mock(GitModelCache.class);
    GitModelCommit commit = mock(GitModelCommit.class);
    // when
    int actual = sorter.compare(viewer, cache, commit);
    // then
    assertTrue(actual < 0);
}
Also used : GitModelCache(org.eclipse.egit.ui.internal.synchronize.model.GitModelCache) GitModelCommit(org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) Test(org.junit.Test)

Example 7 with GitModelCommit

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit in project egit by eclipse.

the class GitChangeSetSorterTest method treeShouldBeGreaterThanCommit.

@Test
public void treeShouldBeGreaterThanCommit() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelTree tree = mock(GitModelTree.class);
    GitModelCommit commit = mock(GitModelCommit.class);
    // when
    int actual = sorter.compare(viewer, tree, commit);
    // then
    assertTrue(actual > 0);
}
Also used : GitModelTree(org.eclipse.egit.ui.internal.synchronize.model.GitModelTree) GitModelCommit(org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) Test(org.junit.Test)

Example 8 with GitModelCommit

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit in project egit by eclipse.

the class GitChangeSetSorterTest method blobShouldBeGreaterThanCommit.

@Test
public void blobShouldBeGreaterThanCommit() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelBlob blob = mock(GitModelBlob.class);
    GitModelCommit commit = mock(GitModelCommit.class);
    // when
    int actual = sorter.compare(viewer, blob, commit);
    // then
    assertTrue(actual > 0);
}
Also used : GitModelCommit(org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) GitModelBlob(org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob) Test(org.junit.Test)

Example 9 with GitModelCommit

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit in project egit by eclipse.

the class GitChangeSetSorterTest method commitTreeShouldBeGreaterThanWorkingTree.

/*
	 * Tests for GitModelCommit
	 */
@Test
public void commitTreeShouldBeGreaterThanWorkingTree() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCommit commit = mock(GitModelCommit.class);
    GitModelWorkingTree workingTree = mock(GitModelWorkingTree.class);
    // when
    int actual = sorter.compare(viewer, commit, workingTree);
    // then
    assertTrue(actual > 0);
}
Also used : GitModelCommit(org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) GitModelWorkingTree(org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree) Test(org.junit.Test)

Example 10 with GitModelCommit

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit in project egit by eclipse.

the class GitChangeSetLabelProvider method createChangeSetLabel.

private String createChangeSetLabel(GitModelCommit commitModel) {
    String format = store.getString(UIPreferences.SYNC_VIEW_CHANGESET_LABEL_FORMAT);
    Commit commit = commitModel.getCachedCommitObj();
    Map<String, String> bindings = new HashMap<>();
    bindings.put(BINDING_CHANGESET_DATE, dateFormatter.formatDate(commit.getCommitDate()));
    bindings.put(BINDING_CHANGESET_AUTHOR, commit.getAuthorName());
    bindings.put(BINDING_CHANGESET_COMMITTER, commit.getCommitterName());
    bindings.put(BINDING_CHANGESET_SHORT_MESSAGE, commit.getShortMessage());
    return formatName(format, bindings);
}
Also used : Commit(org.eclipse.egit.core.synchronize.GitCommitsModelCache.Commit) GitModelCommit(org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit) HashMap(java.util.HashMap) StyledString(org.eclipse.jface.viewers.StyledString)

Aggregations

GitModelCommit (org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit)11 Viewer (org.eclipse.jface.viewers.Viewer)8 CommonViewer (org.eclipse.ui.navigator.CommonViewer)8 Test (org.junit.Test)8 Commit (org.eclipse.egit.core.synchronize.GitCommitsModelCache.Commit)3 GitModelBlob (org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob)3 GitModelCache (org.eclipse.egit.ui.internal.synchronize.model.GitModelCache)3 GitModelWorkingTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree)3 GitModelTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelTree)2 StyledString (org.eclipse.jface.viewers.StyledString)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 GitChangeSetModelProvider (org.eclipse.egit.ui.internal.synchronize.GitChangeSetModelProvider)1