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


Java PagedSearchIterable类代码示例

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


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

示例1: testGetGHContents

import org.kohsuke.github.PagedSearchIterable; //导入依赖的package包/类
@Test
public void testGetGHContents() throws Exception {
    DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class);

    Parent parent = new Parent();

    GHContent content1 = mock(GHContent.class);
    GHContent content2 = mock(GHContent.class);
    GHContent content3 = mock(GHContent.class);

    PagedSearchIterable<GHContent> contentsWithImage = mock(PagedSearchIterable.class);
    Mockito.when(contentsWithImage.getTotalCount()).thenReturn(3);

    PagedIterator<GHContent> contentsWithImageIterator = mock(PagedIterator.class);
    Mockito.when(contentsWithImageIterator.hasNext()).thenReturn(true, true, true, false);
    Mockito.when(contentsWithImageIterator.next()).thenReturn(content1, content2, content3, null);
    Mockito.when(contentsWithImage.iterator()).thenReturn(contentsWithImageIterator);

    Mockito.when(dockerfileGitHubUtil.findFilesWithImage(anyString(), eq("org"))).thenReturn(contentsWithImage);

    parent.loadDockerfileGithubUtil(dockerfileGitHubUtil);

    assertEquals(parent.getGHContents("org", "image"), contentsWithImage);
}
 
开发者ID:salesforce,项目名称:dockerfile-image-update,代码行数:25,代码来源:ParentTest.java

示例2: searchUser

import org.kohsuke.github.PagedSearchIterable; //导入依赖的package包/类
@Override
public List<User> searchUser(GithubPluginSettings pluginSettings, String searchTerm) {
    List<User> users = new ArrayList<User>();
    try {
        GitHub github = getGitHub(pluginSettings);

        PagedSearchIterable<GHUser> githubSearchResults = github.searchUsers().q(searchTerm).list();
        int count = 0;
        for (GHUser githubSearchResult : githubSearchResults) {
            users.add(new User(githubSearchResult.getLogin(), githubSearchResult.getName(), githubSearchResult.getEmail()));
            count++;

            if (count == 10) {
                break;
            }
        }
    } catch (Exception e) {
        LOGGER.warn("Error occurred while trying to perform user search", e);
    }
    return users;
}
 
开发者ID:gocd-contrib,项目名称:gocd-oauth-login,代码行数:22,代码来源:GitHubProvider.java

示例3: testGHContentsNoOutput

import org.kohsuke.github.PagedSearchIterable; //导入依赖的package包/类
@Test
public void testGHContentsNoOutput() throws Exception {
    Parent parent = new Parent();

    PagedSearchIterable<GHContent> contentsWithImage = mock(PagedSearchIterable.class);
    Mockito.when(contentsWithImage.getTotalCount()).thenReturn(0);

    DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class);
    Mockito.when(dockerfileGitHubUtil.findFilesWithImage(anyString(), eq("org"))).thenReturn(contentsWithImage);
    parent.loadDockerfileGithubUtil(dockerfileGitHubUtil);

    assertNull(parent.getGHContents("org", "image"));
}
 
开发者ID:salesforce,项目名称:dockerfile-image-update,代码行数:14,代码来源:ParentTest.java

示例4: testForkRepositoriesFound

import org.kohsuke.github.PagedSearchIterable; //导入依赖的package包/类
@Test
public void testForkRepositoriesFound() throws Exception {
    DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class);

    GHRepository contentRepo1 = mock(GHRepository.class);
    GHRepository contentRepo2 = mock(GHRepository.class);
    GHRepository contentRepo3 = mock(GHRepository.class);

    GHContent content1 = mock(GHContent.class);
    Mockito.when(content1.getOwner()).thenReturn(contentRepo1);
    GHContent content2 = mock(GHContent.class);
    Mockito.when(content2.getOwner()).thenReturn(contentRepo2);
    GHContent content3 = mock(GHContent.class);
    Mockito.when(content3.getOwner()).thenReturn(contentRepo3);

    PagedSearchIterable<GHContent> contentsWithImage = mock(PagedSearchIterable.class);

    PagedIterator<GHContent> contentsWithImageIterator = mock(PagedIterator.class);
    Mockito.when(contentsWithImageIterator.hasNext()).thenReturn(true, true, true, false);
    Mockito.when(contentsWithImageIterator.next()).thenReturn(content1, content2, content3, null);
    Mockito.when(contentsWithImage.iterator()).thenReturn(contentsWithImageIterator);

    Parent parent = new Parent();
    parent.loadDockerfileGithubUtil(dockerfileGitHubUtil);
    parent.forkRepositoriesFound(new HashMap<>(), contentsWithImage);

    Mockito.verify(dockerfileGitHubUtil, times(3)).checkFromParentAndFork(any());
}
 
开发者ID:salesforce,项目名称:dockerfile-image-update,代码行数:29,代码来源:ParentTest.java

示例5: search

import org.kohsuke.github.PagedSearchIterable; //导入依赖的package包/类
@Override
protected void search(GitHub github, Multimap<String, String> versions) throws IOException {
    // start search
    final PagedSearchIterable<GHContent> list = github.searchContent().filename("build.gradle").in("file").language("gradle").q(GROUP_REGEX).list();
    System.out.println("Had: " + list.getTotalCount() + " total results");

    // paginate through results, filtering out interesting files
    processResults(github, versions, list);
}
 
开发者ID:centic9,项目名称:github-version-statistics,代码行数:10,代码来源:GradleBuildSearch.java

示例6: search

import org.kohsuke.github.PagedSearchIterable; //导入依赖的package包/类
@Override
protected void search(GitHub github, Multimap<String, String> versions) throws IOException {
    // start search
    final PagedSearchIterable<GHContent> list = github.searchContent().filename("pom.xml").in("file").language("maven").q(GROUP_REGEX).list();
    System.out.println("Had: " + list.getTotalCount() + " total results");

    // paginate through results, filtering out interesting files
    processResults(github, versions, list);
}
 
开发者ID:centic9,项目名称:github-version-statistics,代码行数:10,代码来源:MavenPomSearch.java


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