Search in sources :

Example 56 with Repository

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

the class RepositoryLinkEnricherTest method shouldNotEnrichRepositoriesForConfigWhenRepositoryConfigIsDisabled.

@Test
@SubjectAware(username = "dent", password = "secret")
public void shouldNotEnrichRepositoriesForConfigWhenRepositoryConfigIsDisabled() {
    enricher = new RepositoryLinkEnricher(scmPathInfoStoreProvider, pullRequestService, configService, globalEngineConfigurator);
    when(pullRequestService.supportsPullRequests(any())).thenReturn(true);
    mockGlobalConfig(true);
    Repository repo = new Repository("id", "type", "space", "name");
    HalEnricherContext context = HalEnricherContext.of(repo);
    enricher.enrich(context, appender);
    verify(appender).appendLink("pullRequest", "https://scm-manager.org/scm/api/v2/pull-requests/space/name");
    verify(appender, never()).appendLink(eq("pullRequestConfig"), any());
}
Also used : Repository(sonia.scm.repository.Repository) HalEnricherContext(sonia.scm.api.v2.resources.HalEnricherContext) Test(org.junit.Test) SubjectAware(com.github.sdorra.shiro.SubjectAware)

Example 57 with Repository

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

the class RepositoryLinkEnricherTest method shouldEnrichPullRequestCheckLink.

@Test
@SubjectAware(username = "dent", password = "secret")
public void shouldEnrichPullRequestCheckLink() {
    when(pullRequestService.supportsPullRequests(any())).thenReturn(true);
    mockGlobalConfig(true);
    enricher = new RepositoryLinkEnricher(scmPathInfoStoreProvider, pullRequestService, configService, globalEngineConfigurator);
    Repository repo = new Repository("id", "type", "space", "name");
    HalEnricherContext context = HalEnricherContext.of(repo);
    enricher.enrich(context, appender);
    verify(appender).appendLink("pullRequestCheck", "https://scm-manager.org/scm/api/v2/pull-requests/space/name/check");
}
Also used : Repository(sonia.scm.repository.Repository) HalEnricherContext(sonia.scm.api.v2.resources.HalEnricherContext) Test(org.junit.Test) SubjectAware(com.github.sdorra.shiro.SubjectAware)

Example 58 with Repository

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

the class EventListenerTest method createReplyEvent.

private ReplyEvent createReplyEvent() {
    Repository repository = RepositoryTestData.createHeartOfGold();
    PullRequest pullRequest = TestData.createPullRequest();
    mockChannel(repository, pullRequest);
    Reply reply = new Reply();
    reply.setId("c42");
    return new ReplyEvent(repository, pullRequest, reply, reply, null, HandlerEventType.MODIFY);
}
Also used : Repository(sonia.scm.repository.Repository) PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) ReplyEvent(com.cloudogu.scm.review.comment.service.ReplyEvent) Reply(com.cloudogu.scm.review.comment.service.Reply)

Example 59 with Repository

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

the class EventListenerTest method createPullRequestMergedEvent.

private PullRequestMergedEvent createPullRequestMergedEvent() {
    Repository repository = RepositoryTestData.createHeartOfGold();
    PullRequest pullRequest = TestData.createPullRequest();
    mockChannel(repository, pullRequest);
    return new PullRequestMergedEvent(repository, pullRequest);
}
Also used : Repository(sonia.scm.repository.Repository) PullRequestMergedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent) PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest)

Example 60 with Repository

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

the class EventListenerTest method createPullRequestUpdatedEvent.

private PullRequestUpdatedEvent createPullRequestUpdatedEvent() {
    Repository repository = RepositoryTestData.createHeartOfGold();
    PullRequest pullRequest = TestData.createPullRequest();
    mockChannel(repository, pullRequest);
    return new PullRequestUpdatedEvent(repository, pullRequest);
}
Also used : Repository(sonia.scm.repository.Repository) PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) PullRequestUpdatedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestUpdatedEvent)

Aggregations

Repository (sonia.scm.repository.Repository)66 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)25 Operation (io.swagger.v3.oas.annotations.Operation)20 Path (javax.ws.rs.Path)20 ApiResponse (io.swagger.v3.oas.annotations.responses.ApiResponse)19 NamespaceAndName (sonia.scm.repository.NamespaceAndName)16 GET (javax.ws.rs.GET)11 Produces (javax.ws.rs.Produces)11 Test (org.junit.jupiter.api.Test)9 Subscribe (com.github.legman.Subscribe)6 SubjectAware (com.github.sdorra.shiro.SubjectAware)6 Consumes (javax.ws.rs.Consumes)6 POST (javax.ws.rs.POST)6 Test (org.junit.Test)6 HalEnricherContext (sonia.scm.api.v2.resources.HalEnricherContext)6 PermissionCheck (com.cloudogu.scm.review.PermissionCheck)5 PullRequestResourceLinks (com.cloudogu.scm.review.PullRequestResourceLinks)5 Comment (com.cloudogu.scm.review.comment.service.Comment)5 PullRequestService (com.cloudogu.scm.review.pullrequest.service.PullRequestService)5 Inject (javax.inject.Inject)5