private void checkApiUrlValidity(GitHub github) throws IOException { try { github.checkApiUrlValidity(); } catch (HttpException e) { String message = String.format("It seems %s is unreachable", apiUri == null ? GITHUB_URL : apiUri); throw new AbortException(message); } }
URL api = new URL(apiUri); GitHub github = GitHub.connectToEnterpriseAnonymously(api.toString()); github.checkApiUrlValidity(); LOGGER.log(Level.FINE, "Trying to configure a GitHub Enterprise server");
public static DockerfileGitHubUtil initializeDockerfileGithubUtil(String gitApiUrl) throws IOException { if (gitApiUrl == null) { gitApiUrl = System.getenv("git_api_url"); if (gitApiUrl == null) { throw new IOException("No Git API URL in environment variables."); } } String token = System.getenv("git_api_token"); if (token == null) { log.error("Please provide GitHub token in environment variables."); System.exit(3); } GitHub github = new GitHubBuilder().withEndpoint(gitApiUrl) .withOAuthToken(token) .build(); github.checkApiUrlValidity(); GitHubUtil gitHubUtil = new GitHubUtil(github); return new DockerfileGitHubUtil(gitHubUtil); } }
public static DockerfileGitHubUtil initializeDockerfileGithubUtil(String gitApiUrl) throws IOException { if (gitApiUrl == null) { gitApiUrl = System.getenv("git_api_url"); if (gitApiUrl == null) { throw new IOException("No Git API URL in environment variables."); } } String token = System.getenv("git_api_token"); if (token == null) { log.error("Please provide GitHub token in environment variables."); System.exit(3); } GitHub github = new GitHubBuilder().withEndpoint(gitApiUrl) .withOAuthToken(token) .build(); github.checkApiUrlValidity(); GitHubUtil gitHubUtil = new GitHubUtil(github); return new DockerfileGitHubUtil(gitHubUtil); } }
@BeforeClass public void setUp() throws Exception { String gitApiUrl = System.getenv("git_api_url"); String token = System.getenv("git_api_token"); github = new GitHubBuilder().withEndpoint(gitApiUrl) .withOAuthToken(token) .build(); github.checkApiUrlValidity(); gitHubUtil = new GitHubUtil(github); TestCommon.cleanBefore(REPOS, DUPLICATES_CREATED_BY_GIT_HUB, STORE_NAME, github); GHOrganization org = github.getOrganization(ORGS.get(0)); TestCommon.initializeRepos(org, REPOS, IMAGE_1, createdRepos, gitHubUtil); for (String s: ORGS) { org = github.getOrganization(s); TestCommon.initializeRepos(org, DUPLICATES, IMAGE_2, createdRepos, gitHubUtil); } /* We need to wait because there is a delay on the search API used in the parent command; it takes time * for the search API to pick up recently created repositories. */ checkIfSearchUpToDate("image1", IMAGE_1, REPOS.size(), github); checkIfSearchUpToDate("image2", IMAGE_2, DUPLICATES.size() * ORGS.size(), github); }
@BeforeClass public void setUp() throws Exception { String gitApiUrl = System.getenv("git_api_url"); String token = System.getenv("git_api_token"); github = new GitHubBuilder().withEndpoint(gitApiUrl) .withOAuthToken(token) .build(); github.checkApiUrlValidity(); cleanBefore(); gitHubUtil = new GitHubUtil(github); GHOrganization org = github.getOrganization(ORG); GHRepository repo = org.createRepository(NAME) .description("Delete if this exists. If it exists, then an integration test crashed somewhere.") .private_(false) .create(); log.info("Initializing {}", repo.getFullName()); createdRepos.add(repo); repo.createContent("FROM " + IMAGE + ":test", "Integration Testing", "Dockerfile"); }
.withOAuthToken(token) .build(); github.checkApiUrlValidity(); gitHubUtil = new GitHubUtil(github);
try { try { github.checkApiUrlValidity(); } catch (HttpException e) { String message = String.format("It seems %s is unreachable",
try { try { github.checkApiUrlValidity(); } catch (HttpException e) { String message = String.format("It seems %s is unreachable",