Package com.github.koraktor.mavanagaiata.git

Examples of com.github.koraktor.mavanagaiata.git.GitCommit


    @Before
    public void setup() throws Exception{
        super.setup();

        GitCommit commit = mock(GitCommit.class);
        when(commit.getAuthorDate()).thenReturn(new Date(1162580880000L));
        when(commit.getAuthorEmailAddress()).thenReturn("john.doe@example.com");
        when(commit.getAuthorName()).thenReturn("John Doe");
        when(commit.getAuthorTimeZone()).thenReturn(TimeZone.getTimeZone("GMT"));
        when(commit.getCommitterDate()).thenReturn(new Date(1275131880000L));
        when(commit.getCommitterEmailAddress()).thenReturn("koraktor@gmail.com");
        when(commit.getCommitterName()).thenReturn("Sebastian Staudt");
        when(commit.getCommitterTimeZone()).thenReturn(TimeZone.getTimeZone("GMT+2"));
        when(commit.getId()).thenReturn("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");

        when(this.repository.getAbbreviatedCommitId()).thenReturn("deadbeef");
        when(this.repository.getHeadCommit()).thenReturn(commit);
    }
View Full Code Here


                walkAction.execute(this.mockCommit("Sebastian Staudt", "koraktor@gmail.com"));
                return null;
            }

            private GitCommit mockCommit(String authorName, String authorEmail) {
                GitCommit commit = mock(GitCommit.class);
                when(commit.getAuthorEmailAddress()).thenReturn(authorEmail);
                when(commit.getAuthorName()).thenReturn(authorName);
                when(commit.getAuthorDate()).thenReturn(new Date(dateCounter ++));
                return commit;
            }
        }).when(this.repository).walkCommits(any(GitContributorsMojo.ContributorsWalkAction.class));
    }
View Full Code Here

     * @throws MavanagaiataMojoException if retrieving information from the Git
     *         repository fails
     */
    public void run() throws MavanagaiataMojoException {
        try {
            GitCommit commit = this.repository.getHeadCommit();
            String abbrevId  = this.repository.getAbbreviatedCommitId();
            String shaId     = commit.getId();
            boolean isDirty  = false;

            SimpleDateFormat dateFormat = new SimpleDateFormat(this.dateFormat);
            dateFormat.setTimeZone(commit.getAuthorTimeZone());
            String authorDate = dateFormat.format(commit.getAuthorDate());
            dateFormat.setTimeZone(commit.getCommitterTimeZone());
            String commitDate = dateFormat.format(commit.getCommitterDate());

            if (this.repository.isDirty(this.dirtyIgnoreUntracked)) {
                isDirty = true;

                if (this.dirtyFlag != null) {
                    abbrevId += this.dirtyFlag;
                    shaId    += this.dirtyFlag;
                }
            }

            this.addProperty("commit.abbrev", abbrevId);
            this.addProperty("commit.author.date", authorDate);
            this.addProperty("commit.author.name", commit.getAuthorName());
            this.addProperty("commit.author.email", commit.getAuthorEmailAddress());
            this.addProperty("commit.committer.date", commitDate);
            this.addProperty("commit.committer.name", commit.getCommitterName());
            this.addProperty("commit.committer.email", commit.getCommitterEmailAddress());
            this.addProperty("commit.id", shaId);
            this.addProperty("commit.sha", shaId);
            this.addProperty("commit.dirty", String.valueOf(isDirty));
        } catch (GitRepositoryException e) {
            throw MavanagaiataMojoException.create("Unable to read Git commit information", e);
View Full Code Here

public class GitChangelogMojoTest extends GitOutputMojoAbstractTest<GitChangelogMojo> {

    protected List<GitCommit> mockCommits;

    private static GitCommit mockCommit(String id, String subject) {
        GitCommit commit = mock(GitCommit.class);
        when(commit.getId()).thenReturn(id);
        when(commit.getMessageSubject()).thenReturn(subject);
        return commit;
    }
View Full Code Here

TOP

Related Classes of com.github.koraktor.mavanagaiata.git.GitCommit

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.