本文整理汇总了Java中org.eclipse.egit.github.core.service.IssueService类的典型用法代码示例。如果您正苦于以下问题:Java IssueService类的具体用法?Java IssueService怎么用?Java IssueService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IssueService类属于org.eclipse.egit.github.core.service包,在下文中一共展示了IssueService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadRequirements
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
private List<Issue> loadRequirements() throws IOException {
IssueService iService = new IssueService(client);
Map<String, String> filderdata = new HashMap<String, String>();
filderdata.put(IssueService.FILTER_LABELS, "Software Requirements Document (SRD)");
filderdata.put(IssueService.FILTER_STATE, IssueService.STATE_OPEN);
List<Issue> issues = iService.getIssues(repositoryId, filderdata);
filderdata.put(IssueService.FILTER_STATE, IssueService.STATE_CLOSED);
issues.addAll(iService.getIssues(repositoryId, filderdata));
class IssueComparator implements Comparator<Issue> {
@Override
public int compare(Issue o1, Issue o2) {
return Integer.compare(o1.getNumber(), o2.getNumber());
}
}
Collections.sort(issues, new IssueComparator());
return issues;
}
示例2: loadRequirements
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
private List<Issue> loadRequirements() throws IOException {
IssueService iService = new IssueService(client);
Map<String, String> filderdata = new HashMap<String, String>();
filderdata.put(IssueService.FILTER_LABELS, "User Requirements Document (URD)");
filderdata.put(IssueService.FILTER_STATE, IssueService.STATE_OPEN);
List<Issue> issues = iService.getIssues(repositoryId, filderdata);
filderdata.put(IssueService.FILTER_STATE, IssueService.STATE_CLOSED);
issues.addAll(iService.getIssues(repositoryId, filderdata));
class IssueComparator implements Comparator<Issue> {
@Override
public int compare(Issue o1, Issue o2) {
return Integer.compare(o1.getNumber(), o2.getNumber());
}
}
Collections.sort(issues, new IssueComparator());
return issues;
}
示例3: createObviousFixCommentIfNecessary
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
/**
* Add a "disarming" comment.
* @param pullRequestId
* @param userMentionMarkdown
* @param issues
* @param claUserComments
* @throws IOException
*/
private void createObviousFixCommentIfNecessary(PullRequestId pullRequestId, String userMentionMarkdown,
IssueService issues, List<Comment> claUserComments) throws IOException {
// only if not already present and if a comment says "please sign the CLA"
if (claUserComments.stream().anyMatch(c -> c.getBody().contains(PLEASE_SIGN))
&& !claUserComments.stream().anyMatch(c -> c.getBody().contains(OBVIOUS_FIX_CLA_NOT_REQUIRED))) {
if (claUserComments.stream().anyMatch(c -> c.getBody().contains(THANK_YOU))) {
return;
}
String claNotRequiredBody = String.format("%s %s", userMentionMarkdown, OBVIOUS_FIX_CLA_NOT_REQUIRED);
issues.createComment(pullRequestId.getRepositoryId(), pullRequestId.getId(), claNotRequiredBody);
}
}
示例4: ExportPrParticipants
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
private void ExportPrParticipants(PullRequestService service, RepositoryId repo, int prNum) {
try {
HashSet<String> participants = new HashSet<String>();
getParticipantsFromComments(participants, service.getComments(repo, prNum));
IssueService issueService = new IssueService(service.getClient());
getParticipantsFromComments(participants, issueService.getComments(repo, prNum));
if(participants.isEmpty()){
return;
}
exportConfigParam(getBuild(), "teamcity.build.pull_req.participants",
StringUtil.join(";", participants));
} catch (IOException e) {
e.printStackTrace();
getLogger().error(e.getMessage());
}
}
示例5: commentPullRequest
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
/**
* Adds comment to provided pull request.
*
* @param owner of repository
* @param pullRequest pull request owner
* @param comment message
* @return created remote comment
*/
public Comment commentPullRequest(String owner, String repositoryName, PullRequest pullRequest, String comment)
{
RepositoryContext bySlug = repositoryBySlug.get(getSlug(owner, repositoryName));
IssueService issueService = new IssueService(getGitHubClient(owner));
try
{
return issueService.createComment(bySlug.repository,
pullRequest.getIssueUrl().substring(pullRequest.getIssueUrl().lastIndexOf('/') + 1), comment);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
示例6: processPullRequestComments
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
/**
* Processes comments of a Pull Request.
*/
private void processPullRequestComments(Repository repository, PullRequest remotePullRequest,
RepositoryPullRequestMapping localPullRequest, Map<String, Participant> participantIndex)
{
updateCommentsCount(remotePullRequest, localPullRequest);
IssueService issueService = gitHubClientProvider.getIssueService(repository);
RepositoryId repositoryId = RepositoryId.createFromUrl(repository.getRepositoryUrl());
List<Comment> pullRequestComments;
try
{
pullRequestComments = issueService.getComments(repositoryId, remotePullRequest.getNumber());
}
catch (IOException e)
{
throw new RuntimeException(e);
}
remotePullRequest.setComments(Math.max(remotePullRequest.getComments(), pullRequestComments.size()));
for (Comment comment : pullRequestComments)
{
addParticipant(participantIndex, comment.getUser(), Participant.ROLE_PARTICIPANT);
}
}
示例7: testCreateOrUpdateItem
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
public void testCreateOrUpdateItem(@Mocked ClientResponse clientResponse, @Mocked StorageEngine store,
@Mocked Repository repoMock, @Mocked RepositoryService service, @Mocked IssueService issueServiceMock,
@Mocked ODocument workItem) throws Exception {
new Expectations() {
{
settings.hasJiraProperties();
result = true;
clientResponse.getStatus();
result = Status.OK.getStatusCode();
service.getRepository(anyString, anyString);
result = repoMock;
}
};
JiraExporter jiraExporter = JiraExporter.INSTANCE;
jiraExporter.initialize(settings, store);
jiraExporter.createOrUpdateItem(workItem);
new Verifications() {
{
}
};
}
示例8: testExport_WithDBEntries_ExpectExport
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
@Test
public void testExport_WithDBEntries_ExpectExport(@Mocked Repository repoMock, @Mocked IssueService issueServiceMock)
throws Exception {
new Expectations() {
{
settingsMock.hasGithubProperties();
result = true;
_service.getRepository(anyString, anyString);
result = repoMock;
}
};
engine.withDB(db -> {
createWorkItem(123);
createWorkItem(324);
});
ExportManager exportManager = new ExportManager();
exportManager.addExporters(exporter);
exportManager.export(settingsMock, engine);
new Verifications() {
{
issueServiceMock.createIssue(null, withInstanceOf(Issue.class));
times = 2;
}
};
}
示例9: testExport_EmptyDB_ExpectNoExport
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
@Test
public void testExport_EmptyDB_ExpectNoExport(@Mocked IssueService issueServiceMock) throws Exception {
new Expectations() {
{
exporter.isConfigured();
result = true;
}
};
ExportManager exportManager = new ExportManager();
exportManager.addExporters(exporter);
exportManager.export(settingsMock, engine);
new Verifications() {
{
exporter.initialize(settingsMock, engine);
times = 1;
issueServiceMock.createIssue(withInstanceOf(IRepositoryIdProvider.class), withInstanceOf(Issue.class));
times = 0;
exporter.createOrUpdateItem(withInstanceOf(ODocument.class));
times = 0;
}
};
}
示例10: close
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
@Override
public void close(String issueId) {
Validate.notNull(gitHubClient, "GitHub REST client must be specified.");
Comment comment = null;
try {
final Issue issue = getIssue(issueId);
issue.setState(IssueService.STATE_CLOSED);
comment =
this.issueService.createComment(this.gitHubGovernorConfiguration.getRepositoryUser(), this.gitHubGovernorConfiguration.getRepository(), issueId,
getClosingMessage());
this.issueService.editIssue(this.gitHubGovernorConfiguration.getRepositoryUser(), this.gitHubGovernorConfiguration.getRepository(), issue);
} catch (Exception e) {
if (comment != null) {
deleteComment(comment);
}
logger.warning(String.format("An exception has occured while closing the issue %s. Exception: %s", issueId, e.getMessage()));
}
}
示例11: handlePrintIssue
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
private void handlePrintIssue(int issueId) {
try {
Issue issue = new IssueService().getIssue(githubUser, githubRepo, issueId);
String labelStr = "";
List<Label> labels = issue.getLabels();
for (int i=0; i<labels.size(); i++) {
labelStr += labels.get(i);
labelStr += (i < labels.size()-1) ? ", " : "";
}
sendAndLog("Issue #" + issueId + " (" + issue.getState() + "): "+ issue.getTitle());
sendAndLog("Created at " + issue.getCreatedAt() + " by " + issue.getUser().getName() + ", " + issue.getComments() + " comment(s), labels: " + labelStr);
sendAndLog(issue.getHtmlUrl());
}
catch (IOException e) {
e.printStackTrace();
}
}
示例12: connect
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
public boolean connect(String username, String password){
this.username=username;
client = new GitHubClient();
client.setCredentials(username, password);
repoService = new MyRepositoriesService(client);
userService = new UserService(client);
issueService = new IssueService(client);
milestoneService = new MilestoneService(client);
labelService = new LabelService(client);
commitService = new CommitService(client);
markdownService = new MarkdownService(client);
colaboratorService = new CollaboratorService(client);
contentsService = new ContentsService(client);
try {
loadInformations();
return true;
} catch (IOException e) {
mainApp.writeNotification(e.getMessage());
return false;
}
}
示例13: getIssuesByMilestone
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
public ArrayList<Issue> getIssuesByMilestone(Repository repository, Milestone milestone){
try {
Map<String, String> filterData = new HashMap<String, String>();
filterData.put(IssueService.FILTER_MILESTONE, Integer.toString(milestone.getNumber()));
filterData.put(IssueService.FILTER_STATE, IssueService.STATE_CLOSED);
ArrayList<Issue> issues = new ArrayList<Issue>(issueService.getIssues(repository, filterData));
filterData.put(IssueService.FILTER_STATE, IssueService.STATE_OPEN);
issues.addAll(issueService.getIssues(repository, filterData));
return issues;
} catch (IOException e) {
mainApp.writeNotification("Failed getting the issues.");
}
return null;
}
示例14: createReviewRequestIssue
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
private void createReviewRequestIssue(Label reviewRequestLabel, Review review, IssueService issueService, UserService userService) throws IOException {
Issue issue = new Issue();
issue.setTitle("Reviewer - " + review.reviewer.login);
List<Label> labels = new ArrayList<>();
labels.add(reviewRequestLabel);
issue.setLabels(labels);
issue.setAssignee(userService.getUser(review.reviewer.login));
String downloadLink = "https://github.com/" + review.repo.repoOwner + '/' + review.repo.repoName + "/raw/master/" + review.pathToPaperInRepo;
issue.setBody("@" + review.reviewer.login + " has been requested to review this paper by @"+review.requester.login+".\n" +
"Click [here](" + downloadLink + ") to download the paper\n" +
"Click [here](" + review.linkToReviewPaper + ") to upload your review.");
issueService.createIssue(review.repo.repoOwner, review.repo.repoName, issue);
}
示例15: IssueToEGitHub
import org.eclipse.egit.github.core.service.IssueService; //导入依赖的package包/类
/**
* Class to convert the issue and transfers it
*
* @param data
* @throws IOException
*/
public IssueToEGitHub( final ConnectionData data )
throws IOException {
this.repositoryParam = data.getRepository();
this.userParam = data.getUser();
this.mantisbturlParam = data.getMantisurl();
GitHubClient client = new GitHubClient();
client.setOAuth2Token( data.getToken() );
RepositoryService repositoryService = new RepositoryService( client );
MilestoneService milestoneService = new MilestoneService( client );
IssueService issueService = new IssueService( client );
Repository repository = repositoryService.getRepository( this.userParam, this.repositoryParam );
TransferService transferService = new TransferService( milestoneMap, issueService, milestoneService, userParam,
repositoryParam, repository );
this.transferService = transferService;
readMilestones( milestoneService );
}