use of sonia.scm.repository.Repository in project scm-review-plugin by scm-manager.
the class MergeServiceTest method shouldMergeSuccessfully.
@Test
void shouldMergeSuccessfully() {
when(mergeCommandBuilder.isSupported(MergeStrategy.MERGE_COMMIT)).thenReturn(true);
when(mergeCommandBuilder.executeMerge()).thenReturn(MergeCommandResult.success("1", "2", "123"));
mockPullRequest("squash", "master", "1");
MergeCommitDto mergeCommit = createMergeCommit(false);
service.merge(REPOSITORY.getNamespaceAndName(), "1", mergeCommit, MergeStrategy.MERGE_COMMIT, false);
verify(pullRequestService).setRevisions(REPOSITORY, "1", "1", "2");
verify(pullRequestService, never()).setEmergencyMerged(any(Repository.class), anyString(), anyString(), anyList());
}
use of sonia.scm.repository.Repository in project scm-review-plugin by scm-manager.
the class PullRequestCollectorTest method shouldReturnPullRequestWithAffectedSourceBranch.
@Test
void shouldReturnPullRequestWithAffectedSourceBranch() {
PullRequest pullRequest = TestData.createPullRequest("42", PullRequestStatus.OPEN);
List<PullRequest> requests = ImmutableList.of(pullRequest);
Repository repository = RepositoryTestData.createHeartOfGold("git");
when(pullRequestService.getAll(repository.getNamespace(), repository.getName())).thenReturn(requests);
List<PullRequest> prs = collector.collectAffectedPullRequests(repository, ImmutableList.of("develop"));
assertThat(prs).containsOnly(pullRequest);
}
use of sonia.scm.repository.Repository in project scm-review-plugin by scm-manager.
the class PullRequestCollectorTest method shouldReturnOnlyOpenPullRequest.
@Test
void shouldReturnOnlyOpenPullRequest() {
PullRequest one = TestData.createPullRequest("21", PullRequestStatus.OPEN);
PullRequest two = TestData.createPullRequest("42", PullRequestStatus.REJECTED);
PullRequest three = TestData.createPullRequest("64", PullRequestStatus.MERGED);
List<PullRequest> requests = ImmutableList.of(one, two, three);
Repository repository = RepositoryTestData.createHeartOfGold("git");
when(pullRequestService.getAll(repository.getNamespace(), repository.getName())).thenReturn(requests);
List<PullRequest> prs = collector.collectAffectedPullRequests(repository, ImmutableList.of("master", "develop"));
assertThat(prs).containsOnly(one);
}
use of sonia.scm.repository.Repository in project scm-review-plugin by scm-manager.
the class PullRequestCollectorTest method shouldReturnPullRequestWithAffectedTargetBranch.
@Test
void shouldReturnPullRequestWithAffectedTargetBranch() {
PullRequest pullRequest = TestData.createPullRequest("42", PullRequestStatus.OPEN);
List<PullRequest> requests = ImmutableList.of(pullRequest);
Repository repository = RepositoryTestData.createHeartOfGold("git");
when(pullRequestService.getAll(repository.getNamespace(), repository.getName())).thenReturn(requests);
List<PullRequest> prs = collector.collectAffectedPullRequests(repository, ImmutableList.of("master"));
assertThat(prs).containsOnly(pullRequest);
}
use of sonia.scm.repository.Repository in project scm-review-plugin by scm-manager.
the class PullRequestStoreFactoryTest method shouldCreateCommentStore.
@Test
public void shouldCreateCommentStore() {
Repository repository = RepositoryTestData.createHeartOfGold("git");
repository.setId("repo");
when(dataStoreFactory.getStore(any())).thenReturn((DataStore) store);
when(dataStoreFactory.withType(any())).thenCallRealMethod();
PullRequestStore commentStore = storeFactory.create(repository);
assertThat(commentStore).isNotNull();
}
Aggregations