本文整理汇总了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);
}
示例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;
}
示例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"));
}
示例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());
}
示例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);
}
示例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);
}