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);
}
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());
}
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;
}
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;
}
Aggregations