Search in sources :

Example 1 with LogCommandBuilder

use of sonia.scm.repository.api.LogCommandBuilder in project scm-review-plugin by scm-manager.

the class BranchRevisionResolverTest method mockSingleChangeset.

private void mockSingleChangeset(String branch) throws IOException {
    when(repositoryService.getLogCommand()).thenReturn(logCommandBuilder);
    LogCommandBuilder subLogCommandBuilder = mock(LogCommandBuilder.class);
    lenient().when(logCommandBuilder.setBranch(branch)).thenReturn(subLogCommandBuilder);
    lenient().when(subLogCommandBuilder.setPagingStart(0)).thenReturn(subLogCommandBuilder);
    lenient().when(subLogCommandBuilder.setPagingLimit(1)).thenReturn(subLogCommandBuilder);
    Changeset changeset = new Changeset();
    changeset.setId(branch + "Id");
    lenient().when(subLogCommandBuilder.getChangesets()).thenReturn(new ChangesetPagingResult(1, singletonList(changeset)));
}
Also used : ChangesetPagingResult(sonia.scm.repository.ChangesetPagingResult) LogCommandBuilder(sonia.scm.repository.api.LogCommandBuilder) Changeset(sonia.scm.repository.Changeset)

Example 2 with LogCommandBuilder

use of sonia.scm.repository.api.LogCommandBuilder in project scm-review-plugin by scm-manager.

the class DefaultPullRequestServiceTest method mockChangesets.

private void mockChangesets(Changeset... changesets) throws IOException {
    RepositoryService service = mock(RepositoryService.class);
    lenient().when(repositoryService.create(any(Repository.class))).thenReturn(service);
    LogCommandBuilder logCommandBuilder = mock(LogCommandBuilder.class, Mockito.RETURNS_SELF);
    lenient().when(service.getLogCommand()).thenReturn(logCommandBuilder);
    lenient().when(logCommandBuilder.getChangesets()).thenReturn(new ChangesetPagingResult(changesets.length, asList(changesets)));
}
Also used : Repository(sonia.scm.repository.Repository) ChangesetPagingResult(sonia.scm.repository.ChangesetPagingResult) LogCommandBuilder(sonia.scm.repository.api.LogCommandBuilder) RepositoryService(sonia.scm.repository.api.RepositoryService)

Example 3 with LogCommandBuilder

use of sonia.scm.repository.api.LogCommandBuilder in project scm-review-plugin by scm-manager.

the class PullRequestRootResourceTest method mockChangesets.

private void mockChangesets(String sourceBranch, String targetBranch, Changeset... changesets) throws IOException {
    when(repositoryService.getLogCommand()).thenReturn(logCommandBuilder);
    LogCommandBuilder subLogCommandBuilder = mock(LogCommandBuilder.class);
    when(logCommandBuilder.setStartChangeset(sourceBranch)).thenReturn(subLogCommandBuilder);
    when(subLogCommandBuilder.setAncestorChangeset(targetBranch)).thenReturn(subLogCommandBuilder);
    when(subLogCommandBuilder.setPagingStart(0)).thenReturn(subLogCommandBuilder);
    when(subLogCommandBuilder.setPagingLimit(1)).thenReturn(subLogCommandBuilder);
    when(subLogCommandBuilder.getChangesets()).thenReturn(new ChangesetPagingResult(changesets.length, asList(changesets)));
}
Also used : ChangesetPagingResult(sonia.scm.repository.ChangesetPagingResult) LogCommandBuilder(sonia.scm.repository.api.LogCommandBuilder)

Aggregations

ChangesetPagingResult (sonia.scm.repository.ChangesetPagingResult)3 LogCommandBuilder (sonia.scm.repository.api.LogCommandBuilder)3 Changeset (sonia.scm.repository.Changeset)1 Repository (sonia.scm.repository.Repository)1 RepositoryService (sonia.scm.repository.api.RepositoryService)1