Search in sources :

Example 6 with RestDispatcher

use of sonia.scm.web.RestDispatcher in project scm-review-plugin by scm-manager.

the class CommentResourceTest method init.

@Before
public void init() {
    when(branchRevisionResolver.getRevisions("space", "name", "1")).thenReturn(new BranchRevisionResolver.RevisionResult("source", "target"));
    when(repositoryResolver.resolve(any())).thenReturn(repository);
    CommentResource resource = new CommentResource(service, repositoryResolver, new CommentMapperImpl(), new ReplyMapperImpl(), commentPathBuilder, new ExecutedTransitionMapperImpl(), branchRevisionResolver);
    when(uriInfo.getAbsolutePathBuilder()).thenReturn(UriBuilder.fromPath("/scm"));
    dispatcher = new RestDispatcher();
    PullRequestRootResource pullRequestRootResource = new PullRequestRootResource(new PullRequestMapperImpl(), null, serviceFactory, Providers.of(new PullRequestResource(new PullRequestMapperImpl(), null, Providers.of(new CommentRootResource(new CommentMapperImpl(), repositoryResolver, service, Providers.of(resource), commentPathBuilder, pullRequestService, branchRevisionResolver)), null, channelRegistry)));
    dispatcher.addSingletonResource(pullRequestRootResource);
    when(service.get("space", "name", "1", "1")).thenReturn(EXISTING_ROOT_COMMENT);
}
Also used : PullRequestResource(com.cloudogu.scm.review.pullrequest.api.PullRequestResource) BranchRevisionResolver(com.cloudogu.scm.review.pullrequest.dto.BranchRevisionResolver) PullRequestMapperImpl(com.cloudogu.scm.review.pullrequest.dto.PullRequestMapperImpl) RestDispatcher(sonia.scm.web.RestDispatcher) PullRequestRootResource(com.cloudogu.scm.review.pullrequest.api.PullRequestRootResource) Before(org.junit.Before)

Example 7 with RestDispatcher

use of sonia.scm.web.RestDispatcher in project scm-review-plugin by scm-manager.

the class RepositoryConfigResourceTest method init.

@BeforeEach
void init() {
    configResource = new RepositoryConfigResource(configService, new RepositoryConfigMapperImpl(), repositoryManager);
    dispatcher = new RestDispatcher();
    dispatcher.addSingletonResource(configResource);
    lenient().when(uriInfo.getBaseUri()).thenReturn(URI.create("localhost/scm/api"));
    lenient().when(configService.getRepositoryPullRequestConfig(REPOSITORY)).thenReturn(new PullRequestConfig());
}
Also used : RestDispatcher(sonia.scm.web.RestDispatcher) PullRequestConfig(com.cloudogu.scm.review.config.service.PullRequestConfig) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with RestDispatcher

use of sonia.scm.web.RestDispatcher in project scm-review-plugin by scm-manager.

the class GlobalConfigResourceTest method init.

@BeforeEach
void init() {
    configResource = new GlobalConfigResource(configService, new GlobalConfigMapperImpl());
    dispatcher = new RestDispatcher();
    dispatcher.addSingletonResource(configResource);
    lenient().when(uriInfo.getBaseUri()).thenReturn(URI.create("localhost/scm/api"));
    lenient().when(configService.getGlobalPullRequestConfig()).thenReturn(new GlobalPullRequestConfig());
}
Also used : GlobalPullRequestConfig(com.cloudogu.scm.review.config.service.GlobalPullRequestConfig) RestDispatcher(sonia.scm.web.RestDispatcher) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with RestDispatcher

use of sonia.scm.web.RestDispatcher in project scm-review-plugin by scm-manager.

the class GlobalEngineConfigResourceTest method init.

@BeforeEach
void init() {
    availableRules = new LinkedHashSet<>();
    GlobalEngineConfigMapperImpl mapper = new GlobalEngineConfigMapperImpl();
    mapper.availableRules = AvailableRules.of(new SuccessRule());
    GlobalEngineConfigResource globalEngineConfigResource = new GlobalEngineConfigResource(mapper, configurator, availableRules);
    dispatcher = new RestDispatcher();
    dispatcher.addSingletonResource(globalEngineConfigResource);
    lenient().when(uriInfo.getBaseUri()).thenReturn(URI.create("localhost/scm/api"));
}
Also used : RestDispatcher(sonia.scm.web.RestDispatcher) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

RestDispatcher (sonia.scm.web.RestDispatcher)9 BeforeEach (org.junit.jupiter.api.BeforeEach)5 Before (org.junit.Before)3 PullRequestResource (com.cloudogu.scm.review.pullrequest.api.PullRequestResource)2 PullRequestRootResource (com.cloudogu.scm.review.pullrequest.api.PullRequestRootResource)2 BranchRevisionResolver (com.cloudogu.scm.review.pullrequest.dto.BranchRevisionResolver)2 PullRequestMapperImpl (com.cloudogu.scm.review.pullrequest.dto.PullRequestMapperImpl)2 GlobalPullRequestConfig (com.cloudogu.scm.review.config.service.GlobalPullRequestConfig)1 PullRequestConfig (com.cloudogu.scm.review.config.service.PullRequestConfig)1 DefaultPullRequestService (com.cloudogu.scm.review.pullrequest.service.DefaultPullRequestService)1 NamespaceAndName (sonia.scm.repository.NamespaceAndName)1 Repository (sonia.scm.repository.Repository)1 DisplayUser (sonia.scm.user.DisplayUser)1 User (sonia.scm.user.User)1