public PullRequest getPullRequest(final IRepositoryIdProvider repository, final int pullrequestId) { PullRequest pullrequest = null; try { pullrequest = service.getPullRequest(repository, pullrequestId); } catch (IOException e) { log.error("IO Exception fetching PullRequest {}:{}", new Object[]{repository.generateId(), pullrequestId, e}); } return pullrequest; }
public void process(Exchange exchange) throws Exception { Integer pullRequestNumber = exchange.getIn().getHeader(GitHubConstants.GITHUB_PULLREQUEST, Integer.class); PullRequest pullRequest = pullRequestService.getPullRequest(getRepository(), pullRequestNumber); pullRequest.setState("closed"); pullRequest.setClosedAt(Calendar.getInstance().getTime()); pullRequest = pullRequestService.editPullRequest(getRepository(), pullRequest); // support InOut if (exchange.getPattern().isOutCapable()) { // copy the header of in message to the out message exchange.getOut().copyFrom(exchange.getIn()); exchange.getOut().setBody(pullRequest); } }
if (pullRequestService.getPullRequest(repositoryId, Integer.parseInt(pullRequestNum)).isMergeable()) { mergeStatus = pullRequestService.merge(repositoryId,
when(pullRequestService.getPullRequest(any(RepositoryId.class), anyInt())).thenReturn(pullRequest); when(pullRequest.isMergeable()).thenReturn(true);