use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class EngineResultResource method getResult.
@GET
@Path("")
@Produces(WORKFLOW_RESULT_MEDIA_TYPE)
@Operation(summary = "Workflow engine result", description = "Returns the result of the workflow checks for the given pull request.", tags = "Workflow Engine", operationId = "review_get_repository_workflow_result")
@ApiResponse(responseCode = "200", description = "success", content = @Content(mediaType = WORKFLOW_RESULT_MEDIA_TYPE, schema = @Schema(implementation = ResultListDto.class)))
@ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials")
@ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"repository:readWorkflowConfig\" privilege")
@ApiResponse(responseCode = "404", description = "either repository or pull request not found")
@ApiResponse(responseCode = "500", description = "internal server error", content = @Content(mediaType = VndMediaType.ERROR_TYPE, schema = @Schema(implementation = ErrorDto.class)))
public ResultListDto getResult(@Context UriInfo uriInfo, @PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("pullRequestId") String pullRequestId) {
Repository repository = pullRequestService.getRepository(namespace, name);
PullRequest pullRequest = pullRequestService.get(namespace, name, pullRequestId);
final Links.Builder linksBuilder = new Links.Builder();
linksBuilder.self(new PullRequestResourceLinks(uriInfo::getBaseUri).workflowEngineLinks().results(repository.getNamespace(), repository.getName(), pullRequestId));
List<Result> ruleResults = engine.validate(repository, pullRequest).getRuleResults();
return new ResultListDto(linksBuilder.build(), ruleResults.stream().map(this::createDto).collect(Collectors.toList()));
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class PullRequestInformationHookTest method createPullRequest.
private static PullRequest createPullRequest(String name, PullRequestStatus status) {
PullRequest existingPullRequest = new PullRequest();
existingPullRequest.setId("pr_id");
existingPullRequest.setSource(name);
existingPullRequest.setTarget("target");
existingPullRequest.setStatus(status);
return existingPullRequest;
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class TestData method createPullRequest.
public static PullRequest createPullRequest(String id, PullRequestStatus pullRequestStatus) {
PullRequest pullRequest = new PullRequest();
pullRequest.setSource("develop");
pullRequest.setTarget("master");
pullRequest.setTitle("PR");
pullRequest.setId(id);
pullRequest.setDescription("Hitchhiker's guide to the galaxy");
pullRequest.setAuthor("dent");
pullRequest.setCreationDate(Instant.MIN);
pullRequest.setLastModified(Instant.MIN);
pullRequest.setStatus(pullRequestStatus);
return pullRequest;
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class StatusCheckHookTest method mockRejectedPullRequest.
private PullRequest mockRejectedPullRequest() {
PullRequest pullRequest = new PullRequest();
pullRequest.setStatus(PullRequestStatus.REJECTED);
when(pullRequestService.getAll(NAMESPACE, NAME)).thenReturn(singletonList(pullRequest));
return pullRequest;
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class CommentIndexerTest method shouldIndexCommentForReplyEvent.
@Test
void shouldIndexCommentForReplyEvent() {
PullRequest pr = createPullRequest();
Comment comment = Comment.createComment("1", "first one", "trillian", new Location());
Reply reply = Reply.createReply("1", "first reply", "trillian");
indexer.handleEvent(new ReplyEvent(repository, pr, reply, reply, comment, HandlerEventType.CREATE));
verify(forType).update(any(SerializableIndexTask.class));
}
Aggregations