Examples of PullRequest


Examples of models.PullRequest

        project.name = name;
        return project;
    }

    private PullRequest createPullRequest(Project project) {
        PullRequest pullRequest = new PullRequest();
        pullRequest.toProject = project;
        return pullRequest;
    }
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

        initService(pullRequestService);
    }

    public void process(Exchange exchange) throws Exception {
        Integer pullRequestNumber = exchange.getIn().getHeader("GitHubPullRequest", 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
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

        if (newPullRequests.size() > 0) {
            lastOpenPullRequest = openPullRequests.get(0).getNumber();
        }

        while (!newPullRequests.empty()) {
            PullRequest newPullRequest = newPullRequests.pop();
            Exchange e = getEndpoint().createExchange();
            e.getIn().setBody(newPullRequest);
           
            // Required by the producers.  Set it here for convenience.
            e.getIn().setHeader("GitHubPullRequest", newPullRequest.getNumber());
           
            getProcessor().process(e);
        }
        return newPullRequests.size();
    }
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

    }


    @Test
    public void pullRequestTest() throws Exception {
        PullRequest pr1 = pullRequestService.addPullRequest("First add");
        PullRequest pr2 = pullRequestService.addPullRequest("Second");
        mockResultEndpoint.expectedMessageCount(2);
        mockResultEndpoint.expectedBodiesReceivedInAnyOrder(pr1, pr2);
        Thread.sleep(1 * 1000);

        mockResultEndpoint.assertIsSatisfied();
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

    public class MockPullRequestProcessor implements Processor {
        @Override
        public void process(Exchange exchange) throws Exception {
            Message in = exchange.getIn();
            PullRequest pullRequest = (PullRequest) in.getBody();
            User pullRequestUser = pullRequest.getUser();

            pullRequest.getTitle();
            pullRequest.getHtmlUrl();
            pullRequest.getUser().getLogin();
            pullRequest.getUser().getHtmlUrl();
            LOG.debug("Got PullRequest " + pullRequest.getHtmlUrl() + " [" + pullRequest.getTitle() + "] From " + pullRequestUser.getLogin());
        }
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

    }


    @Test
    public void testPullRequestCommentProducer() throws Exception {
        PullRequest pullRequest = pullRequestService.addPullRequest("testPullRequestCommentProducer");
        latestPullRequestId = pullRequest.getId();

        Endpoint commentProducerEndpoint = getMandatoryEndpoint("direct:validPullRequest");
        Exchange exchange = commentProducerEndpoint.createExchange();
        String commentText = "Pushed this comment at " + new Date();
        exchange.getIn().setBody(commentText);
        template.send(commentProducerEndpoint, exchange);

        Thread.sleep(1 * 1000);

        // Verify that the mock pull request service received this comment.
        List<CommitComment> commitComments = pullRequestService.getComments(null, (int) pullRequest.getId());
        assertEquals(1, commitComments.size());
        CommitComment commitComment = commitComments.get(0);
        assertEquals("Commit IDs did not match ", Long.toString(pullRequest.getId()), commitComment.getCommitId());
        assertEquals("Comment text did not match ", commentText, commitComment.getBodyText());
    }
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest


    @Test
    public void testPullRequestCommentProducer() throws Exception {
        // Create a pull request
        PullRequest pullRequest = pullRequestService.addPullRequest("testPullRequestCommentProducer");
        latestPullRequestId = pullRequest.getId();


        // Close it
        Endpoint closePullRequestEndpoint = getMandatoryEndpoint(PULL_REQUEST_PRODUCER_ENDPOINT);
        Exchange exchange = closePullRequestEndpoint.createExchange();
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

        };
    }

    @Test
    public void pullRequestCommentTest() throws Exception {
        PullRequest pr1 = pullRequestService.addPullRequest("First add");
        PullRequest pr2 = pullRequestService.addPullRequest("Second");
        CommitComment commitComment1 = pullRequestService.addComment(pr1.getId(), "First comment");
        CommitComment commitComment2 = pullRequestService.addComment(pr2.getId(), "Second comment");
        mockResultEndpoint.expectedBodiesReceivedInAnyOrder(commitComment1, commitComment2);

        Thread.sleep(1 * 1000);         // TODO do I need this?

        mockResultEndpoint.assertIsSatisfied();
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

    }

    public PullRequest addPullRequest(String title) {
        User author = createAuthor();

        PullRequest pullRequest = new PullRequest();
        pullRequest.setUser(author);
        pullRequest.setHtmlUrl("https://github.com/someguy/somerepo/pull" + pullRequestNumber);
        pullRequest.setTitle(title);
        pullRequest.setNumber(pullRequestNumber.get());
        pullRequest.setId(pullRequestNumber.get());
        pullRequest.setState("open");
        pullRequests.put(pullRequest.getId(), pullRequest);

        pullRequestNumber.incrementAndGet();
        return pullRequest;
    }
View Full Code Here

Examples of org.eclipse.egit.github.core.PullRequest

        return pullRequest;
    }

    @Override
    public PullRequest getPullRequest(IRepositoryIdProvider repository, int id) throws IOException {
        PullRequest pullRequest = pullRequests.get((long) id);
        return pullRequest;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.