Search in sources :

Example 61 with TestingConsole

use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.

the class BuildifierFormatTest method setup.

@Before
public void setup() throws IOException {
    console = new TestingConsole();
    options = new OptionsBuilder();
    options.setConsole(console);
    File buildifier = Paths.get(System.getenv("TEST_SRCDIR")).resolve(System.getenv("TEST_WORKSPACE")).resolve("javatests/com/google/copybara/format").resolve("buildifier").toFile();
    options.buildifier.buildifierBin = buildifier.getAbsolutePath();
    checkoutDir = Files.createTempDirectory("BuildifierFormatTest");
    skylark = new SkylarkTestExecutor(options);
}
Also used : TestingConsole(com.google.copybara.util.console.testing.TestingConsole) File(java.io.File) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) SkylarkTestExecutor(com.google.copybara.testing.SkylarkTestExecutor) Before(org.junit.Before)

Example 62 with TestingConsole

use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.

the class AuthoringTest method setUp.

@Before
public void setUp() throws Exception {
    OptionsBuilder options = new OptionsBuilder();
    console = new TestingConsole();
    options.setConsole(console);
    skylark = new SkylarkTestExecutor(options);
}
Also used : TestingConsole(com.google.copybara.util.console.testing.TestingConsole) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) SkylarkTestExecutor(com.google.copybara.testing.SkylarkTestExecutor) Before(org.junit.Before)

Example 63 with TestingConsole

use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.

the class BuildozerModifyTest method setup.

@Before
public void setup() throws IOException {
    console = new TestingConsole();
    options = new OptionsBuilder();
    options.setConsole(console);
    BuildozerTesting.enable(options);
    checkoutDir = Files.createTempDirectory("BuildozerModifyTest");
    skylark = new SkylarkTestExecutor(options);
}
Also used : TestingConsole(com.google.copybara.util.console.testing.TestingConsole) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) SkylarkTestExecutor(com.google.copybara.testing.SkylarkTestExecutor) Before(org.junit.Before)

Example 64 with TestingConsole

use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.

the class GerritEndpointTest method setup.

@Before
public void setup() throws Exception {
    workdir = Jimfs.newFileSystem().getPath("/");
    TestingConsole console = new TestingConsole();
    OptionsBuilder options = new OptionsBuilder();
    options.setConsole(console).setOutputRootToTmpDir();
    dummyTrigger = new DummyTrigger();
    options.testingOptions.feedbackTrigger = dummyTrigger;
    options.testingOptions.checker = new DummyChecker(ImmutableSet.of("badword"));
    gitUtil = new GitTestUtil(options);
    Path credentialsFile = Files.createTempFile("credentials", "test");
    Files.write(credentialsFile, BASE_URL.getBytes(UTF_8));
    GitRepository repo = newBareRepo(Files.createTempDirectory("test_repo"), getGitEnv(), /*verbose=*/
    true, DEFAULT_TIMEOUT, /*noVerify=*/
    false).init().withCredentialHelper("store --file=" + credentialsFile);
    gitUtil.mockRemoteGitRepos(new Validator(), repo);
    url = BASE_URL + "/foo/bar";
    options.general.starlarkMode = "STRICT";
    skylark = new SkylarkTestExecutor(options);
}
Also used : Path(java.nio.file.Path) TestingConsole(com.google.copybara.util.console.testing.TestingConsole) DummyTrigger(com.google.copybara.testing.DummyTrigger) GitTestUtil(com.google.copybara.testing.git.GitTestUtil) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) DummyChecker(com.google.copybara.testing.DummyChecker) Validator(com.google.copybara.testing.git.GitTestUtil.Validator) SkylarkTestExecutor(com.google.copybara.testing.SkylarkTestExecutor) Before(org.junit.Before)

Example 65 with TestingConsole

use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.

the class GitDestinationReaderTest method setup.

@Before
public void setup() throws Exception {
    destinationPath = Files.createTempDirectory("destination");
    gitDir = Files.createTempDirectory("gitDir");
    console = new TestingConsole();
    options = new OptionsBuilder().setConsole(console);
    options.setHomeDir(Files.createTempDirectory("home").toString());
    origin = new DummyOrigin();
    options.testingOptions.origin = origin;
    repo = GitRepository.newBareRepo(destinationPath, getGitEnv(), /*verbose=*/
    true, DEFAULT_TIMEOUT, /*noVerify=*/
    false).withWorkTree(gitDir).init();
    primaryBranch = repo.getPrimaryBranch();
    options.gitDestination.committerEmail = "commiter@email";
    options.gitDestination.committerName = "Bara Kopi";
    workDir = Files.createTempDirectory("workdir");
    options.setWorkdirToRealTempDir(workDir.toString());
    skylark = new SkylarkTestExecutor(options);
    origin.singleFileChange(1580341755, "first", "foo/origin.txt", "AAAA").singleFileChange(1580341795, "second", "foo/origin.txt", "BBBB");
}
Also used : TestingConsole(com.google.copybara.util.console.testing.TestingConsole) DummyOrigin(com.google.copybara.testing.DummyOrigin) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) SkylarkTestExecutor(com.google.copybara.testing.SkylarkTestExecutor) Before(org.junit.Before)

Aggregations

TestingConsole (com.google.copybara.util.console.testing.TestingConsole)96 Before (org.junit.Before)57 OptionsBuilder (com.google.copybara.testing.OptionsBuilder)55 SkylarkTestExecutor (com.google.copybara.testing.SkylarkTestExecutor)54 Test (org.junit.Test)34 Path (java.nio.file.Path)15 GitTestUtil (com.google.copybara.testing.git.GitTestUtil)8 FileSystem (java.nio.file.FileSystem)8 IOException (java.io.IOException)7 LowLevelHttpRequest (com.google.api.client.http.LowLevelHttpRequest)6 DummyChecker (com.google.copybara.testing.DummyChecker)6 DummyOrigin (com.google.copybara.testing.DummyOrigin)6 Console (com.google.copybara.util.console.Console)6 MockHttpTransport (com.google.api.client.testing.http.MockHttpTransport)5 MockLowLevelHttpRequest (com.google.api.client.testing.http.MockLowLevelHttpRequest)5 MockLowLevelHttpResponse (com.google.api.client.testing.http.MockLowLevelHttpResponse)5 Truth.assertWithMessage (com.google.common.truth.Truth.assertWithMessage)5 GitRepository (com.google.copybara.git.GitRepository)5 LowLevelHttpResponse (com.google.api.client.http.LowLevelHttpResponse)4 RepoException (com.google.copybara.exception.RepoException)4