當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。