Search in sources :

Example 1 with ApiChecker

use of com.google.copybara.checks.ApiChecker in project copybara by google.

the class GitHubOptions method newGitHubApi.

/**
 * Returns a new {@link GitHubApi} instance for the given project  enforcing the given
 * {@link Checker}.
 *
 * <p>The project for 'https://github.com/foo/bar' is 'foo/bar'.
 */
public GitHubApi newGitHubApi(String gitHubProject, @Nullable Checker checker, Console console) throws RepoException {
    GitRepository repo = getCredentialsRepo();
    String storePath = gitOptions.getCredentialHelperStorePath();
    if (storePath == null) {
        storePath = "~/.git-credentials";
    }
    GitHubApiTransport transport = newTransport(repo, storePath, console);
    if (checker != null) {
        transport = new GitHubApiTransportWithChecker(transport, new ApiChecker(checker, console));
    }
    return new GitHubApi(transport, generalOptions.profiler());
}
Also used : GitHubApiTransport(com.google.copybara.git.github.api.GitHubApiTransport) ApiChecker(com.google.copybara.checks.ApiChecker) GitHubApi(com.google.copybara.git.github.api.GitHubApi) GitHubApiTransportWithChecker(com.google.copybara.git.github.api.GitHubApiTransportWithChecker)

Example 2 with ApiChecker

use of com.google.copybara.checks.ApiChecker in project copybara by google.

the class GerritApiTransportWithCheckerTest method setup.

@Before
public void setup() throws Exception {
    console = new TestingConsole();
    delegate = Mockito.mock(GerritApiTransport.class);
    checker = Mockito.mock(Checker.class);
    transport = new GerritApiTransportWithChecker(delegate, new ApiChecker(checker, console));
}
Also used : TestingConsole(com.google.copybara.util.console.testing.TestingConsole) Checker(com.google.copybara.checks.Checker) ApiChecker(com.google.copybara.checks.ApiChecker) ApiChecker(com.google.copybara.checks.ApiChecker) Before(org.junit.Before)

Aggregations

ApiChecker (com.google.copybara.checks.ApiChecker)2 Checker (com.google.copybara.checks.Checker)1 GitHubApi (com.google.copybara.git.github.api.GitHubApi)1 GitHubApiTransport (com.google.copybara.git.github.api.GitHubApiTransport)1 GitHubApiTransportWithChecker (com.google.copybara.git.github.api.GitHubApiTransportWithChecker)1 TestingConsole (com.google.copybara.util.console.testing.TestingConsole)1 Before (org.junit.Before)1