Search in sources :

Example 1 with Issue

use of org.eclipse.egit.github.core.Issue in project camel by apache.

the class CreateIssueProducer method process.

public void process(Exchange exchange) throws Exception {
    Issue issue = new Issue();
    String issueTitle = exchange.getIn().getHeader(GitHubConstants.GITHUB_ISSUE_TITLE, String.class);
    if (ObjectHelper.isEmpty(issueTitle)) {
        throw new IllegalArgumentException("Issue Title must be specified to create an issue");
    }
    issue.setTitle(issueTitle);
    issue.setBody(exchange.getIn().getBody(String.class));
    Issue finalIssue = issueService.createIssue(getRepository(), issue);
    // copy the header of in message to the out message
    exchange.getOut().copyFrom(exchange.getIn());
    exchange.getOut().setBody(finalIssue);
}
Also used : Issue(org.eclipse.egit.github.core.Issue)

Example 2 with Issue

use of org.eclipse.egit.github.core.Issue in project camel by apache.

the class CreateIssueProducerTest method testCreateIssue.

@Test
public void testCreateIssue() throws Exception {
    Repository repository = new Repository();
    Endpoint issueProducerEndpoint = getMandatoryEndpoint("direct:createIssue");
    Exchange exchange = issueProducerEndpoint.createExchange();
    String issueBody = "There's an error";
    exchange.getIn().setBody(issueBody);
    template.send(issueProducerEndpoint, exchange);
    Thread.sleep(1 * 1000);
    // Verify that the mock pull request service received this comment.
    Issue issue = issueService.getIssue(repository, 1);
    assertEquals("Error", issue.getTitle());
    assertEquals("There's an error", issue.getBody());
}
Also used : Exchange(org.apache.camel.Exchange) Repository(org.eclipse.egit.github.core.Repository) Issue(org.eclipse.egit.github.core.Issue) Endpoint(org.apache.camel.Endpoint) Test(org.junit.Test)

Example 3 with Issue

use of org.eclipse.egit.github.core.Issue in project camel by apache.

the class MockIssueService method createIssue.

@Override
public Issue createIssue(IRepositoryIdProvider repository, Issue issue) {
    Issue finalIssue = new Issue();
    issue.setBody("There's an error");
    issue.setTitle("Error");
    issue.setId(1L);
    return finalIssue;
}
Also used : Issue(org.eclipse.egit.github.core.Issue)

Example 4 with Issue

use of org.eclipse.egit.github.core.Issue in project camel by apache.

the class MockIssueService method getIssue.

@Override
public Issue getIssue(IRepositoryIdProvider repository, String issueNumber) {
    Issue issue = new Issue();
    issue.setBody("There's an error");
    issue.setTitle("Error");
    issue.setId(1L);
    return issue;
}
Also used : Issue(org.eclipse.egit.github.core.Issue)

Aggregations

Issue (org.eclipse.egit.github.core.Issue)4 Endpoint (org.apache.camel.Endpoint)1 Exchange (org.apache.camel.Exchange)1 Repository (org.eclipse.egit.github.core.Repository)1 Test (org.junit.Test)1