test_class.declarator: gitHubUtil
test_class.modifier: @Mock
test_class.original_string: @Mock
      GitHubUtil gitHubUtil;
test_class.type: GitHubUtil
test_class.var_name: gitHubUtil
test_class.declarator: dockerfileGitHubUtil
test_class.modifier: private
test_class.original_string: private DockerfileGitHubUtil dockerfileGitHubUtil;
test_class.type: DockerfileGitHubUtil
test_class.var_name: dockerfileGitHubUtil
test_class.file: dockerfile-image-update/src/test/java/com/salesforce/dockerfileimageupdate/utils/DockerfileGitHubUtilTest.java
test_class.identifier: DockerfileGitHubUtilTest
test_case.body: @Test
      public void testFindFiles() throws Exception {
          gitHubUtil = mock(GitHubUtil.class);
  
          GHContentSearchBuilder ghContentSearchBuilder = mock(GHContentSearchBuilder.class);
          PagedSearchIterable<GHContent> list = mock(PagedSearchIterable.class);
          when(list.getTotalCount()).thenReturn(100);
  
          when(ghContentSearchBuilder.list()).thenReturn(list);
          when(gitHubUtil.startSearch()).thenReturn(ghContentSearchBuilder);
  
          dockerfileGitHubUtil = new DockerfileGitHubUtil(gitHubUtil);
          assertEquals(dockerfileGitHubUtil.findFilesWithImage("test", "test"), list);
      }
test_case.class_method_signature: DockerfileGitHubUtilTest.testFindFiles()
test_case.full_signature: @Test public void testFindFiles()
test_case.identifier: testFindFiles
test_case.invocations: mock mock mock thenReturn when getTotalCount thenReturn when list thenReturn when startSearch assertEquals findFilesWithImage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFindFiles()
focal_class.declarator: log = LoggerFactory.getLogger(DockerfileGitHubUtil.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(DockerfileGitHubUtil.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: gitHubUtil
focal_class.modifier: private final
focal_class.original_string: private final GitHubUtil gitHubUtil;
focal_class.type: GitHubUtil
focal_class.var_name: gitHubUtil
focal_class.file: dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/utils/DockerfileGitHubUtil.java
focal_class.identifier: DockerfileGitHubUtil
focal_class.class_method_signature: DockerfileGitHubUtil.DockerfileGitHubUtil(GitHubUtil gitHubUtil)
focal_class.full_signature: public  DockerfileGitHubUtil(GitHubUtil gitHubUtil)
focal_class.identifier: DockerfileGitHubUtil
focal_class.modifiers: public
focal_class.parameters: (GitHubUtil gitHubUtil)
focal_class.signature:  DockerfileGitHubUtil(GitHubUtil gitHubUtil)
focal_class.class_method_signature: DockerfileGitHubUtil.getGitHubUtil()
focal_class.full_signature: protected GitHubUtil getGitHubUtil()
focal_class.identifier: getGitHubUtil
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: GitHubUtil
focal_class.signature: GitHubUtil getGitHubUtil()
focal_class.class_method_signature: DockerfileGitHubUtil.getOrCreateFork(GHRepository parent)
focal_class.full_signature: public GHRepository getOrCreateFork(GHRepository parent)
focal_class.identifier: getOrCreateFork
focal_class.modifiers: public
focal_class.parameters: (GHRepository parent)
focal_class.return: GHRepository
focal_class.signature: GHRepository getOrCreateFork(GHRepository parent)
focal_class.class_method_signature: DockerfileGitHubUtil.getMyself()
focal_class.full_signature: public GHMyself getMyself()
focal_class.identifier: getMyself
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: GHMyself
focal_class.signature: GHMyself getMyself()
focal_class.class_method_signature: DockerfileGitHubUtil.getRepo(String repoName)
focal_class.full_signature: public GHRepository getRepo(String repoName)
focal_class.identifier: getRepo
focal_class.modifiers: public
focal_class.parameters: (String repoName)
focal_class.return: GHRepository
focal_class.signature: GHRepository getRepo(String repoName)
focal_class.class_method_signature: DockerfileGitHubUtil.findFilesWithImage(String query, String org)
focal_class.full_signature: public PagedSearchIterable<GHContent> findFilesWithImage(String query, String org)
focal_class.identifier: findFilesWithImage
focal_class.modifiers: public
focal_class.parameters: (String query, String org)
focal_class.return: PagedSearchIterable<GHContent>
focal_class.signature: PagedSearchIterable<GHContent> findFilesWithImage(String query, String org)
focal_class.class_method_signature: DockerfileGitHubUtil.getGHRepositories(Multimap<String, String> pathToDockerfileInParentRepo,
                                                              GHMyself currentUser)
focal_class.full_signature: public List<GHRepository> getGHRepositories(Multimap<String, String> pathToDockerfileInParentRepo,
                                                              GHMyself currentUser)
focal_class.identifier: getGHRepositories
focal_class.modifiers: public
focal_class.parameters: (Multimap<String, String> pathToDockerfileInParentRepo,
                                                              GHMyself currentUser)
focal_class.return: List<GHRepository>
focal_class.signature: List<GHRepository> getGHRepositories(Multimap<String, String> pathToDockerfileInParentRepo,
                                                              GHMyself currentUser)
focal_class.class_method_signature: DockerfileGitHubUtil.modifyAllOnGithub(GHRepository repo, String branch,
                                    String img, String tag)
focal_class.full_signature: public void modifyAllOnGithub(GHRepository repo, String branch,
                                    String img, String tag)
focal_class.identifier: modifyAllOnGithub
focal_class.modifiers: public
focal_class.parameters: (GHRepository repo, String branch,
                                    String img, String tag)
focal_class.return: void
focal_class.signature: void modifyAllOnGithub(GHRepository repo, String branch,
                                    String img, String tag)
focal_class.class_method_signature: DockerfileGitHubUtil.modifyOnGithubRecursive(GHRepository repo, GHContent content,
                                             String branch, String img, String tag)
focal_class.full_signature: protected void modifyOnGithubRecursive(GHRepository repo, GHContent content,
                                             String branch, String img, String tag)
focal_class.identifier: modifyOnGithubRecursive
focal_class.modifiers: protected
focal_class.parameters: (GHRepository repo, GHContent content,
                                             String branch, String img, String tag)
focal_class.return: void
focal_class.signature: void modifyOnGithubRecursive(GHRepository repo, GHContent content,
                                             String branch, String img, String tag)
focal_class.class_method_signature: DockerfileGitHubUtil.tryRetrievingContent(GHRepository repo, String path, String branch)
focal_class.full_signature: public GHContent tryRetrievingContent(GHRepository repo, String path, String branch)
focal_class.identifier: tryRetrievingContent
focal_class.modifiers: public
focal_class.parameters: (GHRepository repo, String path, String branch)
focal_class.return: GHContent
focal_class.signature: GHContent tryRetrievingContent(GHRepository repo, String path, String branch)
focal_class.class_method_signature: DockerfileGitHubUtil.modifyOnGithub(GHContent content,
                                 String branch, String img, String tag, String customMessage)
focal_class.full_signature: public void modifyOnGithub(GHContent content,
                                 String branch, String img, String tag, String customMessage)
focal_class.identifier: modifyOnGithub
focal_class.modifiers: public
focal_class.parameters: (GHContent content,
                                 String branch, String img, String tag, String customMessage)
focal_class.return: void
focal_class.signature: void modifyOnGithub(GHContent content,
                                 String branch, String img, String tag, String customMessage)
focal_class.class_method_signature: DockerfileGitHubUtil.findImagesAndFix(GHContent content,
                                      String branch, String img, String tag, String customMessage,
                                      BufferedReader reader)
focal_class.full_signature: protected void findImagesAndFix(GHContent content,
                                      String branch, String img, String tag, String customMessage,
                                      BufferedReader reader)
focal_class.identifier: findImagesAndFix
focal_class.modifiers: protected
focal_class.parameters: (GHContent content,
                                      String branch, String img, String tag, String customMessage,
                                      BufferedReader reader)
focal_class.return: void
focal_class.signature: void findImagesAndFix(GHContent content,
                                      String branch, String img, String tag, String customMessage,
                                      BufferedReader reader)
focal_class.class_method_signature: DockerfileGitHubUtil.rewriteDockerfile(String img, String tag, BufferedReader reader, StringBuilder strB)
focal_class.full_signature: protected boolean rewriteDockerfile(String img, String tag, BufferedReader reader, StringBuilder strB)
focal_class.identifier: rewriteDockerfile
focal_class.modifiers: protected
focal_class.parameters: (String img, String tag, BufferedReader reader, StringBuilder strB)
focal_class.return: boolean
focal_class.signature: boolean rewriteDockerfile(String img, String tag, BufferedReader reader, StringBuilder strB)
focal_class.class_method_signature: DockerfileGitHubUtil.changeIfDockerfileBaseImageLine(String imageToFind, String tag, StringBuilder stringBuilder, String line)
focal_class.full_signature: protected boolean changeIfDockerfileBaseImageLine(String imageToFind, String tag, StringBuilder stringBuilder, String line)
focal_class.identifier: changeIfDockerfileBaseImageLine
focal_class.modifiers: protected
focal_class.parameters: (String imageToFind, String tag, StringBuilder stringBuilder, String line)
focal_class.return: boolean
focal_class.signature: boolean changeIfDockerfileBaseImageLine(String imageToFind, String tag, StringBuilder stringBuilder, String line)
focal_class.class_method_signature: DockerfileGitHubUtil.getGitHubJsonStore(String store)
focal_class.full_signature: public GitHubJsonStore getGitHubJsonStore(String store)
focal_class.identifier: getGitHubJsonStore
focal_class.modifiers: public
focal_class.parameters: (String store)
focal_class.return: GitHubJsonStore
focal_class.signature: GitHubJsonStore getGitHubJsonStore(String store)
focal_class.class_method_signature: DockerfileGitHubUtil.createPullReq(GHRepository origRepo,
                                String branch, GHRepository forkRepo,
                                PullRequestInfo pullRequestInfo)
focal_class.full_signature: public void createPullReq(GHRepository origRepo,
                                String branch, GHRepository forkRepo,
                                PullRequestInfo pullRequestInfo)
focal_class.identifier: createPullReq
focal_class.modifiers: public
focal_class.parameters: (GHRepository origRepo,
                                String branch, GHRepository forkRepo,
                                PullRequestInfo pullRequestInfo)
focal_class.return: void
focal_class.signature: void createPullReq(GHRepository origRepo,
                                String branch, GHRepository forkRepo,
                                PullRequestInfo pullRequestInfo)
focal_class.class_method_signature: DockerfileGitHubUtil.getPullRequestForImageBranch(GHRepository repository, GitForkBranch gitForkBranch)
focal_class.full_signature: public Optional<GHPullRequest> getPullRequestForImageBranch(GHRepository repository, GitForkBranch gitForkBranch)
focal_class.identifier: getPullRequestForImageBranch
focal_class.modifiers: public
focal_class.parameters: (GHRepository repository, GitForkBranch gitForkBranch)
focal_class.return: Optional<GHPullRequest>
focal_class.signature: Optional<GHPullRequest> getPullRequestForImageBranch(GHRepository repository, GitForkBranch gitForkBranch)
focal_class.class_method_signature: DockerfileGitHubUtil.createOrUpdateForkBranchToParentDefault(GHRepository parent, GHRepository fork, GitForkBranch gitForkBranch)
focal_class.full_signature: public void createOrUpdateForkBranchToParentDefault(GHRepository parent, GHRepository fork, GitForkBranch gitForkBranch)
focal_class.identifier: createOrUpdateForkBranchToParentDefault
focal_class.modifiers: public
focal_class.parameters: (GHRepository parent, GHRepository fork, GitForkBranch gitForkBranch)
focal_class.return: void
focal_class.signature: void createOrUpdateForkBranchToParentDefault(GHRepository parent, GHRepository fork, GitForkBranch gitForkBranch)
focal_class.class_method_signature: DockerfileGitHubUtil.thisUserIsOwner(GHRepository repo)
focal_class.full_signature: public boolean thisUserIsOwner(GHRepository repo)
focal_class.identifier: thisUserIsOwner
focal_class.modifiers: public
focal_class.parameters: (GHRepository repo)
focal_class.return: boolean
focal_class.signature: boolean thisUserIsOwner(GHRepository repo)
focal_class.class_method_signature: DockerfileGitHubUtil.getGHContents(String org, String img)
focal_class.full_signature: public Optional<PagedSearchIterable<GHContent>> getGHContents(String org, String img)
focal_class.identifier: getGHContents
focal_class.modifiers: public
focal_class.parameters: (String org, String img)
focal_class.return: Optional<PagedSearchIterable<GHContent>>
focal_class.signature: Optional<PagedSearchIterable<GHContent>> getGHContents(String org, String img)
focal_method.body: public PagedSearchIterable<GHContent> findFilesWithImage(String query, String org) throws IOException {
          GHContentSearchBuilder search = gitHubUtil.startSearch();
          // Filename search appears to yield better / more results than language:Dockerfile
          // Root cause: linguist doesn't currently deal with prefixes of files:
          // https://github.com/github/linguist/issues/4566
          search.filename("Dockerfile");
          if (org != null) {
              search.user(org);
          }
          if (query.substring(query.lastIndexOf(' ') + 1).length() <= 1) {
              throw new IOException("Invalid image name.");
          }
          search.q("\"FROM " + query + "\"");
          log.debug("Searching for {}", query);
          PagedSearchIterable<GHContent> files = search.list();
          int totalCount = files.getTotalCount();
          if (totalCount > 1000) {
              log.warn("Number of search results is above 1000! The GitHub Search API will only return around 1000 results - https://developer.github.com/v3/search/#about-the-search-api");
          }
          log.info("Number of files found for {}:{}", query, totalCount);
          return files;
      }
focal_method.class_method_signature: DockerfileGitHubUtil.findFilesWithImage(String query, String org)
focal_method.full_signature: public PagedSearchIterable<GHContent> findFilesWithImage(String query, String org)
focal_method.identifier: findFilesWithImage
focal_method.invocations: startSearch filename user length substring lastIndexOf q debug list getTotalCount warn info
focal_method.modifiers: public
focal_method.parameters: (String query, String org)
focal_method.return: PagedSearchIterable<GHContent>
focal_method.signature: PagedSearchIterable<GHContent> findFilesWithImage(String query, String org)