• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CommitComment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.egit.github.core.CommitComment的典型用法代码示例。如果您正苦于以下问题:Java CommitComment类的具体用法?Java CommitComment怎么用?Java CommitComment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommitComment类属于org.eclipse.egit.github.core包,在下文中一共展示了CommitComment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testPullRequestCommentProducer

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
@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());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:PullRequestCommentProducerTest.java


示例2: addComment

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
public CommitComment addComment(Long pullRequestId, String bodyText) {
    CommitComment commitComment = new CommitComment();

    User author = createAuthor();
    commitComment.setUser(author);
    commitComment.setCommitId("" + pullRequestId);
    commitComment.setId(commentId.getAndIncrement());
    commitComment.setBody(bodyText);
    commitComment.setBodyText(bodyText);

    List<CommitComment> comments;
    if (allComments.containsKey(pullRequestId)) {
        comments = allComments.get(pullRequestId);
    } else {
        comments = new ArrayList<CommitComment>();
    }
    comments.add(commitComment);
    allComments.put(pullRequestId, comments);

    return commitComment;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:MockPullRequestService.java


示例3: processPullRequestReviewComments

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * Processes review comments of a Pull Request.
 */
private void processPullRequestReviewComments(Repository repository, PullRequest remotePullRequest,
        RepositoryPullRequestMapping localPullRequest, Map<String, Participant> participantIndex)
{
    updateCommentsCount(remotePullRequest, localPullRequest);

    PullRequestService pullRequestService = gitHubClientProvider.getPullRequestService(repository);
    RepositoryId repositoryId = RepositoryId.createFromUrl(repository.getRepositoryUrl());
    List<CommitComment> pullRequestReviewComments;
    try
    {
        pullRequestReviewComments = pullRequestService.getComments(repositoryId, remotePullRequest.getNumber());
    }
    catch (IOException e)
    {
        throw new RuntimeException(e);
    }

    remotePullRequest.setReviewComments(Math.max(remotePullRequest.getReviewComments(), pullRequestReviewComments.size()));

    for (CommitComment comment : pullRequestReviewComments)
    {
        addParticipant(participantIndex, comment.getUser(), Participant.ROLE_PARTICIPANT);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:28,代码来源:GitHubPullRequestProcessor.java


示例4: testNoParticipants

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
@Test
public void testNoParticipants() throws IOException
{
    when(issueService.getComments(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Collections.<Comment>emptyList());
    when(gitHubPullRequestService.getComments(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Collections.<CommitComment>emptyList());

    User user = mock(User.class);
    when(user.getLogin()).thenReturn("user");
    when(pullRequest.getUser()).thenReturn(user);
    testedClass.processPullRequest(repository, pullRequest);

    verify(pullRequestService).updatePullRequestParticipants(anyInt(), anyInt(), participantsIndexCaptor.capture());
    assertEquals(participantsIndexCaptor.getValue().size(), 1);
    Participant participant = participantsIndexCaptor.getValue().get("user");
    assertParticipant(participant, "user");
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:GitHubPullRequestProcessorTest.java


示例5: getItemId

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
@Override
public long getItemId(int position) {
    switch (getItemViewType(position)) {
    case TYPE_FILE_HEADER:
        String sha = ((CommitFile) getItem(position)).getSha();
        if (!TextUtils.isEmpty(sha))
            return sha.hashCode();
        else
            return super.getItemId(position);
    case TYPE_COMMENT:
    case TYPE_LINE_COMMENT:
        return ((CommitComment) getItem(position)).getId();
    default:
        return super.getItemId(position);
    }

}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:CommitFileListAdapter.java


示例6: add

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
@Override
public boolean add(final CommitComment comment) {
    String path = comment.getPath();
    if (TextUtils.isEmpty(path))
        return super.add(comment);
    else {
        boolean added = false;
        for (FullCommitFile file : files)
            if (path.equals(file.getFile().getFilename())) {
                file.add(comment);
                added = true;
                break;
            }
        if (!added)
            added = super.add(comment);
        return added;
    }
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:19,代码来源:FullCommit.java


示例7: run

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
@Override
protected FullCommit run(Account account) throws Exception {
    RepositoryCommit commit = store.refreshCommit(repository, id);
    Commit rawCommit = commit.getCommit();
    if (rawCommit != null && rawCommit.getCommentCount() > 0) {
        List<CommitComment> comments = service.getComments(repository,
                commit.getSha());
        for (CommitComment comment : comments) {
            String formatted = HtmlUtils.format(comment.getBodyHtml())
                    .toString();
            comment.setBodyHtml(formatted);
            imageGetter.encode(comment, formatted);
        }
        return new FullCommit(commit, comments);
    } else
        return new FullCommit(commit);
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:RefreshCommitTask.java


示例8: removeIssuesAlreadyReported

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
private void removeIssuesAlreadyReported(Multimap<String, Issue> fileViolations,
		Map<String, LinePositioner> linePositioners) throws MojoExecutionException {
	List<CommitComment> currentComments;
	try {
		currentComments = pullRequestService.getComments( repository, pullRequestId );
	} catch (IOException e) {
		throw new MojoExecutionException( "Unable to retrieve comments", e );
	}
	for (CommitComment comment : currentComments) {
		Iterator<Issue> issues = fileViolations.get(
				comment.getPath() ).iterator();
		while (issues.hasNext()) {
			Issue issue = (Issue) issues.next();
			Integer line = issue.line();
			if (line == null)
				line = 1;

			int position = linePositioners.get( comment.getPath() )
					.toPostion( line );
			if (position == comment.getPosition()
					&& issue.message().equals( comment.getBody() ))
				issues.remove();
		}
	}
}
 
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:26,代码来源:SonarPullRequestMojo.java


示例9: pageComments

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * Page comments on commit with given SHA-1
 *
 * @param repository
 * @param sha
 * @param start
 * @param size
 * @return page iterator over comments
 */
public PageIterator<CommitComment> pageComments(
		IRepositoryIdProvider repository, String sha, int start, int size) {
	String id = getId(repository);
	if (sha == null)
		throw new IllegalArgumentException("Sha cannot be null"); //$NON-NLS-1$
	if (sha.length() == 0)
		throw new IllegalArgumentException("Sha cannot be empty"); //$NON-NLS-1$

	StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_COMMITS);
	uri.append('/').append(sha);
	uri.append(SEGMENT_COMMENTS);
	PagedRequest<CommitComment> request = createPagedRequest(start, size);
	request.setUri(uri);
	request.setType(new TypeToken<List<CommitComment>>() {
	}.getType());
	return createPageIterator(request);
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:29,代码来源:CommitService.java


示例10: addComment

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * Add comment to given commit
 *
 * @param repository
 * @param sha
 * @param comment
 * @return created comment
 * @throws IOException
 */
public CommitComment addComment(IRepositoryIdProvider repository,
		String sha, CommitComment comment) throws IOException {
	String id = getId(repository);
	if (sha == null)
		throw new IllegalArgumentException("Sha cannot be null"); //$NON-NLS-1$
	if (sha.length() == 0)
		throw new IllegalArgumentException("Sha cannot be empty"); //$NON-NLS-1$

	StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_COMMITS);
	uri.append('/').append(sha);
	uri.append(SEGMENT_COMMENTS);
	return client.post(uri.toString(), comment, CommitComment.class);
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:25,代码来源:CommitService.java


示例11: pullRequestCommentTest

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
@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();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:PullRequestCommentConsumerTest.java


示例12: getComments

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
public List<CommitComment> getComments(IRepositoryIdProvider repository, int pullRequestId) {
    Long id = new Long(pullRequestId);
    if (allComments.containsKey(id)) {
        List<CommitComment> comments = allComments.get(id);
        return comments;
    } else {
        return emptyComments;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:MockPullRequestService.java


示例13: process

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void process(Repository repository, Event event, boolean isSoftSync, String[] synchronizationTags, GitHubEventContext context)
{
    PullRequestReviewCommentPayload payload = getPayload(event);
    CommitComment commitComment = payload.getComment();
    PullRequest pullRequest = getPullRequestByComment(repository, commitComment);
    if (pullRequest == null)
    {
        return;
    }

    context.savePullRequest(pullRequest);
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:PullRequestReviewCommentPayloadGitHubEventProcessor.java


示例14: addItem

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * Add file to adapter
 *
 * @param file
 */
public void addItem(final FullCommitFile file) {
    addItem(TYPE_FILE_HEADER, file.getFile());
    List<CharSequence> lines = diffStyler.get(file.getFile().getFilename());
    int number = 0;
    for (CharSequence line : lines) {
        addItem(TYPE_FILE_LINE, line);
        for (CommitComment comment : file.get(number))
            addItem(TYPE_LINE_COMMENT, comment);
        number++;
    }
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:17,代码来源:CommitFileListAdapter.java


示例15: CreateCommentTask

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * Create task to create a comment
 *
 * @param activity
 * @param repository
 * @param commit
 * @param comment
 */
protected CreateCommentTask(final Activity activity,
        final IRepositoryIdProvider repository, final String commit,
        final CommitComment comment) {
    super(activity);

    this.repository = repository;
    this.commit = commit;
    this.comment = comment;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:18,代码来源:CreateCommentTask.java


示例16: run

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
@Override
public CommitComment run(final Account account) throws Exception {
    CommitComment created = service.addComment(repository, commit, comment);
    String formatted = HtmlUtils.format(created.getBodyHtml()).toString();
    created.setBodyHtml(formatted);
    return created;

}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:9,代码来源:CreateCommentTask.java


示例17: add

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * Add comment to file
 *
 * @param comment
 * @return this file
 */
public FullCommitFile add(final CommitComment comment) {
    int line = comment.getPosition();
    if (line >= 0) {
        List<CommitComment> lineComments = comments.get(line);
        if (lineComments == null) {
            lineComments = new ArrayList<CommitComment>(4);
            comments.put(line, lineComments);
        }
        lineComments.add(comment);
    }
    return this;
}
 
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:19,代码来源:FullCommitFile.java


示例18: recordGit

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
private void recordGit(Multimap<String, Issue> fileViolations, Map<String, LinePositioner> linePositioners,
		Map<String, String> filesSha) throws IOException {
	Iterator<RepositoryCommit> commits = pullRequestService.getCommits( repository, pullRequestId ).iterator();
	if (!commits.hasNext())
		return;

	Collection<Entry<String, Issue>> entries = fileViolations.entries();
	for (Entry<String, Issue> entry : entries) {
		String path = entry.getKey();

		CommitComment comment = new CommitComment();
		comment.setBody( entry.getValue().message() );
		comment.setCommitId( filesSha.get( path ) );
		comment.setPath( path );

		Integer line = entry.getValue().line();
		if (line == null)
			continue;

		comment.setLine( line );
		comment.setPosition( linePositioners.get( path ).toPostion( line ) );

		getLog().debug( "Path: " + path );
		getLog().debug( "Line: " + line );
		getLog().debug( "Position: " + comment.getPosition() );

		try {
			pullRequestService
					.createComment( repository, pullRequestId, comment );
		} catch (Exception e) {
			getLog().error( "Unable to comment on: " + path );
			getLog().debug( e );
		}
	}
}
 
开发者ID:velo,项目名称:sonar-pull-request-integration,代码行数:36,代码来源:SonarPullRequestMojo.java


示例19: reportSuccesses

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
private void reportSuccesses(int successCounter) throws IOException {
 System.out.println(successCounter +" things went well");
 GitHubClient client = new GitHubClient();
 String botUserName = System.getProperty("testUserName");
 String botPassword = System.getProperty("testUserPass");
 client.setCredentials(botUserName, botPassword);
 
 String sha = System.getenv("TRAVIS_COMMIT");
 System.out.println("making a comment on commit "+sha);
 
 RepositoryService repoService = new RepositoryService(client);
 Repository repo = repoService.getRepository("DeveloperLiberationFront", "Pdf-Reviewer");
 CommitService service = new CommitService(client);
 CommitComment comment = new CommitComment();
 
    String message = "step | pass?\n" +
            "--- | --- \n" +
            "canary site online |  :fire: \n" +
            "authenticated with GitHub | :fire: \n" +
            "no carry over reviews |  ::fire: \n" +
            "created request |  :fire: \n" +
            "Uploaded pdf |  :fire: \n" +
            "Found issues in GitHub |  :fire: \n";
    
    for(int i = 0; i< successCounter; i++) {
        message = message.replaceFirst(":fire:", ":white_check_mark:");
    }

 comment.setBody(message);
    service.addComment(repo, sha, comment);
}
 
开发者ID:DeveloperLiberationFront,项目名称:Pdf-Reviewer,代码行数:32,代码来源:BrowserTest.java


示例20: pageComments

import org.eclipse.egit.github.core.CommitComment; //导入依赖的package包/类
/**
 * Page pull request commit comments
 *
 * @param repository
 * @param id
 * @param start
 * @param size
 * @return iterator over pages of commit comments
 */
public PageIterator<CommitComment> pageComments(
		IRepositoryIdProvider repository, int id, int start, int size) {
	String repoId = getId(repository);
	StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
	uri.append('/').append(repoId);
	uri.append(SEGMENT_PULLS);
	uri.append('/').append(id);
	uri.append(SEGMENT_COMMENTS);
	PagedRequest<CommitComment> request = createPagedRequest(start, size);
	request.setUri(uri);
	request.setType(new TypeToken<List<CommitComment>>() {
	}.getType());
	return createPageIterator(request);
}
 
开发者ID:tsangiotis,项目名称:JekyllForAndroid,代码行数:24,代码来源:PullRequestService.java



注:本文中的org.eclipse.egit.github.core.CommitComment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TokenTypes类代码示例发布时间:2022-05-23
下一篇:
Java Time类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap