Search in sources :

Example 1 with PostReceiveRepositoryHookEvent

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

the class ProcessChangedFilesHookTest method createRepositoryHookEvent.

private PostReceiveRepositoryHookEvent createRepositoryHookEvent(List<String> branches) {
    PostReceiveRepositoryHookEvent event = mock(PostReceiveRepositoryHookEvent.class, Answers.RETURNS_DEEP_STUBS);
    when(event.getRepository()).thenReturn(repository);
    when(event.getContext().getBranchProvider().getCreatedOrModified()).thenReturn(branches);
    return event;
}
Also used : PostReceiveRepositoryHookEvent(sonia.scm.repository.PostReceiveRepositoryHookEvent)

Example 2 with PostReceiveRepositoryHookEvent

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

the class ProcessChangedFilesHookTest method prepareEvent.

private PostReceiveRepositoryHookEvent prepareEvent(Comment... comments) {
    lenient().when(commentCollector.collectNonOutdated(repository, pullRequest)).thenReturn(Stream.of(comments));
    List<String> branches = ImmutableList.of(pullRequest.getSource(), pullRequest.getTarget());
    PostReceiveRepositoryHookEvent event = createRepositoryHookEvent(branches);
    lenient().when(pullRequestCollector.collectAffectedPullRequests(repository, branches)).thenReturn(ImmutableList.of(pullRequest));
    List<Changeset> changesets = ImmutableList.of(new Changeset(), new Changeset());
    lenient().when(event.getContext().getChangesetProvider().getChangesets()).thenReturn(changesets);
    return event;
}
Also used : Changeset(sonia.scm.repository.Changeset) PostReceiveRepositoryHookEvent(sonia.scm.repository.PostReceiveRepositoryHookEvent)

Example 3 with PostReceiveRepositoryHookEvent

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

the class ProcessChangedFilesHookTest method flagAffectedComments.

private void flagAffectedComments(Comment... comments) {
    PostReceiveRepositoryHookEvent event = prepareEvent(comments);
    hook.checkChangedFiles(event);
}
Also used : PostReceiveRepositoryHookEvent(sonia.scm.repository.PostReceiveRepositoryHookEvent)

Aggregations

PostReceiveRepositoryHookEvent (sonia.scm.repository.PostReceiveRepositoryHookEvent)3 Changeset (sonia.scm.repository.Changeset)1