当前位置: 首页>>代码示例>>Java>>正文


Java IRepositoryIdProvider类代码示例

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


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

示例1: replyToComment

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
public ExtendedCommitComment replyToComment(final IRepositoryIdProvider repository, final String sha,
                                            final int commentId, final String body) throws IOException {
    Objects.requireNonNull(sha, "sha cannot be null");
    if(sha.isEmpty()) {
        throw new IllegalArgumentException("Sha cannot be empty");
    }

    String id = this.getId(repository);
    StringBuilder uri = new StringBuilder("/repos");
    uri.append('/').append(id);
    uri.append("/commits");
    uri.append('/').append(sha);
    uri.append("/comments");

    Map<String, String> params = new HashMap<>();
    params.put("in_reply_to", Integer.toString(commentId));
    params.put("body", body);
    return (ExtendedCommitComment) getClient().post(uri.toString(), params, ExtendedCommitComment.class);
}
 
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:20,代码来源:ExtendedCommitService.java

示例2: pageComments2

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
public PageIterator<ExtendedCommitComment> pageComments2(final IRepositoryIdProvider repository,
                                                         final String sha,
                                                         final int start,
                                                         final int size) {
    Objects.requireNonNull(sha, "sha cannot be null");
    if(sha.isEmpty()) {
        throw new IllegalArgumentException("sha cannot be empty");
    }

    String id = this.getId(repository);
    StringBuilder uri = new StringBuilder("/repos");
    uri.append('/').append(id);
    uri.append("/commits");
    uri.append('/').append(sha);
    uri.append("/comments");
    PagedRequest<ExtendedCommitComment> request = createPagedRequest(start, size);
    request.setUri(uri);
    request.setType((new TypeToken<List<ExtendedCommitComment>>() {}).getType());
    return createPageIterator(request);
}
 
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:21,代码来源:ExtendedCommitService.java

示例3: merge

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
public ExtendedMergeStatus merge(final IRepositoryIdProvider repository,
                                 final int id,
                                 final String commitTitle,
                                 final String commitMessage,
                                 final String sha,
                                 final String mergeMethod) throws IOException {
    String repoId = this.getId(repository);
    StringBuilder uri = new StringBuilder("/repos");
    uri.append('/').append(repoId);
    uri.append("/pulls");
    uri.append('/').append(id);
    uri.append("/merge");

    Map<String, String> params = new HashMap<>();
    params.put("commit_title", commitTitle);
    params.put("commit_message", commitMessage);
    params.put("sha", sha);
    params.put("merge_method", mergeMethod);
    return getClient().put(uri.toString(), params, ExtendedMergeStatus.class);
}
 
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:21,代码来源:ExtendedPullRequestService.java

示例4: createReviewRequests

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
public void createReviewRequests(final IRepositoryIdProvider repository,
                                 final int id,
                                 final String...reviewers) throws IOException {
    Objects.requireNonNull(reviewers, "reviewers cannot be null");

    String repoId = this.getId(repository);
    StringBuilder uri = new StringBuilder("/repos");
    uri.append('/').append(repoId);
    uri.append("/pulls");
    uri.append('/').append(id);
    uri.append("/requested_reviewers");

    Map<String, Object> params = new HashMap<>();
    params.put("reviewers", Arrays.asList(reviewers));
    getClient().post(uri.toString(), params, ExtendedPullRequest.class, BLACK_CAT_PREVIEW);
}
 
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:17,代码来源:ExtendedPullRequestService.java

示例5: deleteReviewRequests

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
public void deleteReviewRequests(final IRepositoryIdProvider repository,
                                 final int id,
                                 final String...reviewers) throws IOException {
    Objects.requireNonNull(reviewers, "reviewers cannot be null");

    String repoId = this.getId(repository);
    StringBuilder uri = new StringBuilder("/repos");
    uri.append('/').append(repoId);
    uri.append("/pulls");
    uri.append('/').append(id);
    uri.append("/requested_reviewers");

    Map<String, Object> params = new HashMap<>();
    params.put("reviewers", Arrays.asList(reviewers));
    getClient().delete(uri.toString(), params, BLACK_CAT_PREVIEW);
}
 
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:17,代码来源:ExtendedPullRequestService.java

示例6: getContextStatuses

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
/**
 * Get statuses for commit SHA-1
 *
 * @param repository
 * @param sha
 * @return list of statuses
 * @throws IOException
 */
@SneakyThrows
public List<ContextCommitStatus> getContextStatuses(IRepositoryIdProvider repository,
		String sha) {
	String id = getId(repository);
	if (sha == null)
		throw new IllegalArgumentException("SHA-1 cannot be null"); //$NON-NLS-1$
	if (sha.length() == 0)
		throw new IllegalArgumentException("SHA-1 cannot be empty"); //$NON-NLS-1$

	StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
	uri.append('/').append(id);
	uri.append(SEGMENT_STATUSES);
	uri.append('/').append(sha);
	PagedRequest<ContextCommitStatus> request = createPagedRequest();
	request.setType(new TypeToken<List<ContextCommitStatus>>() {
	}.getType());
	request.setUri(uri);
	return getAll(request);
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:28,代码来源:ContextCommitService.java

示例7: createPullsRequest

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
protected PagedRequest<PullRequest> createPullsRequest(final IRepositoryIdProvider provider, final String state, final String sort, final String direction, final int start, final int size)
{
    PagedRequest<PullRequest> request = createPullsRequest(provider, state, start, size);
    if (sort != null && direction != null)
    {
        Map<String, String> params = new HashMap<String, String>(request.getParams());
        if (sort != null)
        {
            params.put(SORT, sort);
        }

        if (direction != null)
        {
            params.put(DIRECTION, direction);
        }

        request.setParams(params);
    }

    return request;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:CustomPullRequestService.java

示例8: gettingDetailChangeset_ShouldSendGETRequestToGithub_AndParseJsonResult

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
@Test
public void gettingDetailChangeset_ShouldSendGETRequestToGithub_AndParseJsonResult()
        throws ResponseException, IOException
{
    when(repository.getSlug()).thenReturn("SLUG");
    when(repository.getOrgName()).thenReturn("ORG");

    RepositoryCommit repositoryCommit = mock(RepositoryCommit.class);
    when(commitService.getCommit(Matchers.<IRepositoryIdProvider>anyObject(), anyString())).thenReturn(repositoryCommit);
    Commit commit = mock(Commit.class);
    when(repositoryCommit.getCommit()).thenReturn(commit);
    when(commit.getMessage()).thenReturn("ABC-123 fix");

    Changeset detailChangeset = communicator.getChangeset(repository, "abcde");

    verify(commitService).getCommit(Matchers.<IRepositoryIdProvider>anyObject(), anyString());

    assertThat(detailChangeset.getMessage()).isEqualTo("ABC-123 fix");
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:20,代码来源:GithubCommunicatorTest.java

示例9: testAccessDenied

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
@Test
public void testAccessDenied() throws IOException
{
    when(gitHubPullRequestService.getPullRequest(any(IRepositoryIdProvider.class), anyInt())).thenThrow(new RequestException(new RequestError(), 401));

    try
    {
        testedClass.onReceive(message, payload);

        Assert.fail("Exception is expected");
    }
    catch (RuntimeException e)
    {
        assertEquals(((RequestException) e.getCause()).getStatus(), 401);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:GitHubPullRequestSynchronizeMessageConsumerTest.java

示例10: testNotFound

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
@Test
public void testNotFound() throws IOException
{
    when(gitHubPullRequestService.getPullRequest(any(IRepositoryIdProvider.class), anyInt())).thenThrow(new RequestException(new RequestError(), 404));

    try
    {
        testedClass.onReceive(message, payload);

        Assert.fail("Exception is expected");
    }
    catch (RuntimeException e)
    {
        assertEquals(((RequestException) e.getCause()).getStatus(), 404);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:GitHubPullRequestSynchronizeMessageConsumerTest.java

示例11: testInternalServerError

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
@Test
public void testInternalServerError() throws IOException
{
    when(gitHubPullRequestService.getPullRequest(any(IRepositoryIdProvider.class), anyInt())).thenThrow(new RequestException(new RequestError(), 500));

    try
    {
        testedClass.onReceive(message, payload);

        Assert.fail("Exception is expected");
    }
    catch (RuntimeException e)
    {
        assertEquals(((RequestException) e.getCause()).getStatus(), 500);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:GitHubPullRequestSynchronizeMessageConsumerTest.java

示例12: nullProcessedPRsAreHandledGracefully

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
@Test
public void nullProcessedPRsAreHandledGracefully() throws IOException
{
    final Long[] prIds = new Long[] {1L, 2L, 3L};

    final PageIterator<PullRequest> prIterator = mockPageIterator(ImmutableList.copyOf(prIds));
    when(gitHubPullRequestService.pagePullRequests(any(IRepositoryIdProvider.class), eq(STATE_ALL), eq(SORT_UPDATED), eq(DIRECTION_DESC), eq(DEFAULT_PAGE), eq(DEFAULT_PAGELEN)))
            .thenReturn(prIterator);
    when(gitHubPullRequestProcessor.processPullRequestIfNeeded(eq(repository), any(PullRequest.class))).thenReturn(true);

    testedClass.onReceive(message, mockPayload(true, DEFAULT_PAGE, DEFAULT_PAGELEN, null));

    verify(gitHubPullRequestProcessor, times(3)).processPullRequestIfNeeded(eq(repository), any(PullRequest.class));
    // next msg is fired
    verify(messagingService).publish(any(MessageAddress.class), matchMessageWithProcessedPrIds(prIds), any(String[].class));
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:17,代码来源:GitHubPullRequestPageMessageConsumerTest.java

示例13: testNoParticipants

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的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

示例14: testCommit

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
@Test
public void testCommit() throws IOException
{
    when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(null);

    RepositoryCommit repositoryCommit = mockCommit("aaa");
    when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));
    final String issueKey = "TST-1";
    final ImmutableSet<String> issueKeys = ImmutableSet.of(issueKey);
    when(repositoryPullRequestDao.getIssueKeys(anyInt(), anyInt())).thenReturn(issueKeys);

    testedClass.processPullRequest(repository, pullRequest);
    verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());

    assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");
    ArgumentCaptor<Object> eventCaptor = ArgumentCaptor.forClass(Object.class);
    verify(notificationService, times(1)).broadcast(eventCaptor.capture());

    DevSummaryChangedEvent firstEvent = (DevSummaryChangedEvent) eventCaptor.getValue();
    assertThat(firstEvent.getIssueKeys(), contains(new String[] { issueKey }));
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:GitHubPullRequestProcessorTest.java

示例15: testUpdateCommits

import org.eclipse.egit.github.core.IRepositoryIdProvider; //导入依赖的package包/类
@Test
public void testUpdateCommits() throws IOException
{
    when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(null);

    RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
    when(commitMapping.getNode()).thenReturn("original");
    when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
    target.setCommits(new RepositoryCommitMapping[] { commitMapping });

    RepositoryCommit repositoryCommit = mockCommit("aaa");
    when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));

    testedClass.processPullRequest(repository, pullRequest);
    verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
    assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");

    verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
    verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
    verify(notificationService, times(1)).broadcast(anyObject());
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:22,代码来源:GitHubPullRequestProcessorTest.java


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