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


Java GHIssueState类代码示例

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


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

示例1: listPullRequestsByRepository

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@GET
@Path("pullrequests/{user}/{repository}")
@Produces(MediaType.APPLICATION_JSON)
public GitHubPullRequestList listPullRequestsByRepository(
    @PathParam("user") String user,
    @PathParam("repository") String repository,
    @QueryParam("head") String head,
    @HeaderParam(AUTH_HEADER_NAME) String oauthToken)
    throws ApiException {
  try {
    return gitHubDTOFactory.createPullRequestsList(
        gitHubFactory
            .oauthConnect(oauthToken)
            .getUser(user)
            .getRepository(repository)
            .queryPullRequests()
            .head(head)
            .state(GHIssueState.OPEN)
            .list());
  } catch (IOException e) {
    LOG.error("Getting list of pull request by repositories", e);
    throw new ServerException(e.getMessage());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:GitHubService.java

示例2: pullRequestsToCheck

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
/**
 * @return remote pull requests for future analysing.
 */
private static Set<GHPullRequest> pullRequestsToCheck(@Nullable Integer prNumber,
                                                      @Nonnull GHRepository remoteRepo,
                                                      @Nonnull GitHubPRRepository localRepo) throws IOException {
    if (prNumber != null) {
        return execute(() -> singleton(remoteRepo.getPullRequest(prNumber)));
    } else {
        List<GHPullRequest> remotePulls = execute(() -> remoteRepo.getPullRequests(GHIssueState.OPEN));

        Set<Integer> remotePRNums = from(remotePulls).transform(extractPRNumber()).toSet();

        return from(localRepo.getPulls().keySet())
                // add PRs that was closed on remote
                .filter(not(in(remotePRNums)))
                .transform(fetchRemotePR(remoteRepo))
                .filter(notNull())
                .append(remotePulls)
                .toSet();
    }
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:23,代码来源:GitHubPRTrigger.java

示例3: check

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@Override
    public GitHubPRCause check(GitHubPRTrigger gitHubPRTrigger, GHPullRequest remotePR,
                               GitHubPRPullRequest localPR, TaskListener listener) throws IOException {
        if (remotePR.getState().equals(GHIssueState.CLOSED)) {
            //TODO check whether push to closed allowed?
            return null; // already closed, nothing to check
        }

        if (isNull(localPR)) { // new
            return null; // not interesting for this event
        }

        GitHubPRCause cause = null;

        GHCommitPointer head = remotePR.getHead();
        if (!localPR.getHeadSha().equals(head.getSha())) {
            LOGGER.debug("New commit. Sha: {} => {}", localPR.getHeadSha(), head.getSha());
            final PrintStream logger = listener.getLogger();
            logger.println(this.getClass().getSimpleName() + ": new commit found, sha " + head.getSha());
//            GHUser user = head.getUser();
            cause = new GitHubPRCause(remotePR, DISPLAY_NAME, false);
        }

        return cause;
    }
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:26,代码来源:GitHubPRCommitEvent.java

示例4: check

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@Override
public GitHubPRCause check(GitHubPRTrigger gitHubPRTrigger, GHPullRequest remotePR,
                           @CheckForNull GitHubPRPullRequest localPR, TaskListener listener) throws IOException {
    if (remotePR.getState().equals(GHIssueState.CLOSED)) {
        return null; // already closed, skip check?
    }

    GitHubPRCause cause = null;

    Collection<GHLabel> remoteLabels = remotePR.getRepository().getIssue(remotePR.getNumber()).getLabels();
    Set<String> existingLabels = new HashSet<String>();

    for (GHLabel ghLabel : remoteLabels) {
        existingLabels.add(ghLabel.getName());
    }

    if (existingLabels.containsAll(label.getLabelsSet())) {
        final PrintStream logger = listener.getLogger();
        logger.println(DISPLAY_NAME + ": " + label.getLabelsSet() + " found");
        cause = new GitHubPRCause(remotePR, label.getLabelsSet() + " labels exist", isSkip());
    }

    return cause;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:25,代码来源:GitHubPRLabelExistsEvent.java

示例5: check

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@Override
public GitHubPRCause check(GitHubPRTrigger gitHubPRTrigger, GHPullRequest remotePR,
                           GitHubPRPullRequest localPR, TaskListener listener) throws IOException {
    if (isNull(localPR)) {
        return null;
    }

    GitHubPRCause cause = null;

    // must be closed once
    if (remotePR.getState().equals(GHIssueState.CLOSED)) {
        final PrintStream logger = listener.getLogger();
        logger.println(DISPLAY_NAME + ": state has changed (PR was closed)");
        cause = new GitHubPRCause(remotePR, "PR was closed", false);
    }

    return cause;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:19,代码来源:GitHubPRCloseEvent.java

示例6: shouldSkipSkippableEvents

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
/**
 * Test trigger configuration of:
 *
 *     1.) Skip PR if label is not present (when label is not present)
 *     2.) Cause PR if commit changed (when commit has changed)
 *
 * Expected result is that the PR should be skipped. No causes should be
 * identified.
 */
@Test
public void shouldSkipSkippableEvents() throws Exception {
    GHCommitPointer commitPtr = mock(GHCommitPointer.class);
    when(local.getPulls()).thenReturn(ImmutableMap.of(3, localPR));
    when(localPR.getHeadSha()).thenReturn("this is not the sha you are looking for");
    when(remotePR.getNumber()).thenReturn(3);
    when(remotePR.getState()).thenReturn(GHIssueState.OPEN);
    when(remotePR.getHead()).thenReturn(commitPtr);
    when(trigger.getEvents()).thenReturn(asList(
            new GitHubPRLabelNotExistsEvent(new GitHubPRLabel("notfound"), true),
            new GitHubPRCommitEvent()));

    final GitHubPRCause cause = toGitHubPRCause(local, tlRule.getListener(), trigger)
            .apply(remotePR);

    assertThat(cause, nullValue());
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:27,代码来源:PullRequestToCauseConverterTest.java

示例7: testCheckMethodWhenUsingGitHubEnterprise

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@Test
public void testCheckMethodWhenUsingGitHubEnterprise() throws IOException {
    // GIVEN
    given(gt.getRateLimit()).willThrow(new FileNotFoundException());
    List<GHPullRequest> ghPullRequests = createListWithMockPR();
    given(ghRepository.getPullRequests(eq(GHIssueState.OPEN))).willReturn(ghPullRequests);

    mockHeadAndBase();
    mockCommitList();

    pulls.put(1, ghprcPullRequest);

    given(ghPullRequest.getUpdatedAt()).willReturn(UPDATE_DATE);
    given(ghPullRequest.getNumber()).willReturn(1);

    // WHEN
    ghprcRepository.check();

    // THEN
    verifyGetGithub(1);
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:22,代码来源:GhprcRepositoryTest.java

示例8: testCheckMethodWithNoPR

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@Test
public void testCheckMethodWithNoPR() throws IOException {
    // GIVEN
    List<GHPullRequest> ghPullRequests = new ArrayList<GHPullRequest>();
    given(ghRepository.getPullRequests(eq(GHIssueState.OPEN))).willReturn(ghPullRequests);

    // WHEN
    ghprcRepository.check();
    verify(helper).isProjectDisabled();

    // THEN
    verifyGetGithub(1);
    verifyNoMoreInteractions(gt);

    verify(ghRepository, times(1)).getPullRequests(OPEN); // Call to Github API
    verifyNoMoreInteractions(ghRepository);
    verifyZeroInteractions(helper);
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:19,代码来源:GhprcRepositoryTest.java

示例9: getOpenPullRequests

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
public static List<GHPullRequest> getOpenPullRequests(GHRepository ghRepository, String label) throws IOException {
    List<GHPullRequest> pullRequests = retryGithub(() -> ghRepository.getPullRequests(GHIssueState.OPEN));
    List<GHPullRequest> answer = new ArrayList<>();
    if (pullRequests != null) {
        for (GHPullRequest pullRequest : pullRequests) {
            if (GitHubHelpers.hasLabel(Issues.getLabels(pullRequest), label)) {
                answer.add(pullRequest);
            }
        }
    }
    return answer;
}
 
开发者ID:fabric8-updatebot,项目名称:updatebot,代码行数:13,代码来源:PullRequests.java

示例10: getOpenIssues

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
public static List<GHIssue> getOpenIssues(GHRepository ghRepository, String label) throws IOException {
    List<GHIssue> issues = retryGithub(() -> ghRepository.getIssues(GHIssueState.OPEN));
    List<GHIssue> answer = new ArrayList<>();
    for (GHIssue issue : issues) {
        if (GitHubHelpers.hasLabel(getLabels(issue), label) && !issue.isPullRequest()) {
            answer.add(issue);
        }
    }
    return answer;
}
 
开发者ID:fabric8-updatebot,项目名称:updatebot,代码行数:11,代码来源:Issues.java

示例11: isOpen

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
public static boolean isOpen(GHIssue issue) {
    GHIssueState state = issue.getState();
    if (state == null) {
        return true;
    }
    return state == GHIssueState.OPEN;
}
 
开发者ID:fabric8-updatebot,项目名称:updatebot,代码行数:8,代码来源:Issues.java

示例12: getSlackIssues

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
public static List<GHIssue> getSlackIssues(GHRepository repo)
		throws IOException {
	List<GHIssue> filteredIssues = new ArrayList<GHIssue>();
	List<GHIssue> issues = repo.getIssues(GHIssueState.OPEN);
	for (GHIssue issue : issues) {
		if (isSlackIssue(issue)) {
			filteredIssues.add(issue);
		}
	}
	return filteredIssues;
}
 
开发者ID:eraether,项目名称:WatchWordBot,代码行数:12,代码来源:GitHubHelper.java

示例13: mapGhRepository

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
private GitHubRepository mapGhRepository(GHRepository gitHubRepository) throws IOException {
  String repositoryName = gitHubRepository.getName();
  int stars = gitHubRepository.listStargazers().asList().size();
  int openPullRequests = gitHubRepository.getPullRequests(GHIssueState.OPEN).size();
  int pullRequests =
      openPullRequests + gitHubRepository.getPullRequests(GHIssueState.CLOSED).size();
  int openIssues = gitHubRepository.getOpenIssueCount();
  int branches = gitHubRepository.getBranches().size();
  int collaborators = gitHubRepository.getCollaborators().size();
  int forks = gitHubRepository.getForks();
  int watchers = gitHubRepository.getWatchers();

  return new GitHubRepository(repositoryName, stars, openPullRequests, pullRequests, openIssues,
      branches, collaborators, forks, watchers);
}
 
开发者ID:Karumi,项目名称:Reddo,代码行数:16,代码来源:GitHubApiClient.java

示例14: check

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@Override
public GitHubPRCause check(GitHubPRTrigger gitHubPRTrigger, GHPullRequest remotePR,
                           @CheckForNull GitHubPRPullRequest localPR, TaskListener listener) throws IOException {
    if (remotePR.getState().equals(GHIssueState.CLOSED)) {
        return null; // already closed, skip check?
    }

    if (label == null) {
        LOG.error("Label is null. Bad configured event: {}", getDescriptor().getDisplayName());
        throw new IllegalStateException("Label is null. Bad configured event: " + getDescriptor().getDisplayName());
    }

    //localPR exists before, checking for changes
    if (localPR != null && localPR.getLabels().containsAll(label.getLabelsSet())) {
        return null; // label existed before exiting
    }

    GitHubPRCause cause = null;

    Collection<GHLabel> labels = remotePR.getRepository().getIssue(remotePR.getNumber()).getLabels();
    Set<String> existingLabels = new HashSet<String>();

    for (GHLabel curLabel : labels) {
        existingLabels.add(curLabel.getName());
    }

    if (existingLabels.containsAll(label.getLabelsSet())) {
        final PrintStream logger = listener.getLogger();
        logger.println(DISPLAY_NAME + ": state has changed (" + label.getLabelsSet() + " labels were added");
        cause = new GitHubPRCause(remotePR, label.getLabelsSet() + " labels were added", false);
    }

    return cause;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:35,代码来源:GitHubPRLabelAddedEvent.java

示例15: check

import org.kohsuke.github.GHIssueState; //导入依赖的package包/类
@Override
public GitHubPRCause check(GitHubPRTrigger gitHubPRTrigger, GHPullRequest remotePR,
                           @CheckForNull GitHubPRPullRequest localPR, TaskListener listener) throws IOException {
    if (remotePR.getState().equals(GHIssueState.CLOSED)) {
        return null; // already closed, skip check?
    }

    GitHubPRCause cause = null;

    Collection<GHLabel> remoteLabels = remotePR.getRepository().getIssue(remotePR.getNumber()).getLabels();
    Set<String> existingLabels = new HashSet<>();

    for (GHLabel ghLabel : remoteLabels) {
        existingLabels.add(ghLabel.getName());
    }

    existingLabels.retainAll(label.getLabelsSet());

    if (existingLabels.isEmpty()) {
        final PrintStream logger = listener.getLogger();
        LOG.debug("{}:{} not found", DISPLAY_NAME, label.getLabelsSet());
        logger.println(DISPLAY_NAME + ": " + label.getLabelsSet() + " not found");
        cause = new GitHubPRCause(remotePR, label.getLabelsSet() + " labels not exist", isSkip());
    }

    return cause;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:28,代码来源:GitHubPRLabelNotExistsEvent.java


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