コード例 #1
0
  @Test
  public void getCountCommits() throws Exception {
    GitScriptService service = this.componentManager.getInstance(ScriptService.class, "git");
    Repository repository =
        service.getRepository(this.testRepository.getAbsolutePath(), TEST_REPO_CLONED);
    Assert.assertEquals(true, new Git(repository).pull().call().isSuccessful());

    UserCommitActivity[] commits = service.countAuthorCommits(1, repository);
    // 1 author
    Assert.assertEquals(1, commits.length);
    // 1 commit
    Assert.assertEquals(1, commits[0].getCount());
    // Verify user name and emai
    Assert.assertEquals("test author", commits[0].getName());
    Assert.assertEquals("*****@*****.**", commits[0].getEmail());
  }
コード例 #2
0
  @Test
  public void getRepositoryAndFindAuthors() throws Exception {
    GitScriptService service = this.componentManager.getInstance(ScriptService.class, "git");
    Repository repository =
        service.getRepository(this.testRepository.getAbsolutePath(), TEST_REPO_CLONED);
    Assert.assertEquals(true, new Git(repository).pull().call().isSuccessful());

    CommitFinder finder = new CommitFinder(repository);
    CommitCountFilter count = new CommitCountFilter();
    finder.setMatcher(count);
    finder.find();

    Assert.assertEquals(1, count.getCount());

    Set<PersonIdent> authors = service.findAuthors(repository);
    Assert.assertEquals(1, authors.size());
    Assert.assertEquals("test author", authors.iterator().next().getName());
  }