Search in sources :

Example 26 with OptionsBuilder

use of com.google.copybara.testing.OptionsBuilder in project copybara by google.

the class FeedbackTest method setup.

@Before
public void setup() throws Exception {
    workdir = Files.createTempDirectory("workdir");
    Files.createDirectories(workdir);
    console = new TestingConsole();
    options = new OptionsBuilder();
    dummyEndpoint = new DummyEndpoint();
    options.setConsole(console);
    options.testingOptions.feedbackEndpoint = dummyEndpoint;
    skylark = new SkylarkParser(ImmutableSet.of(Core.class, TestingModule.class));
}
Also used : DummyEndpoint(com.google.copybara.testing.DummyEndpoint) SkylarkParser(com.google.copybara.config.SkylarkParser) TestingConsole(com.google.copybara.util.console.testing.TestingConsole) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) Before(org.junit.Before)

Example 27 with OptionsBuilder

use of com.google.copybara.testing.OptionsBuilder in project copybara by google.

the class TransformWorkTest method setup.

@Before
public void setup() throws IOException {
    origin = new DummyOrigin().setAuthor(ORIGINAL_AUTHOR);
    destination = new RecordsProcessCallDestination();
    OptionsBuilder options = new OptionsBuilder();
    console = new TestingConsole();
    options.setConsole(console);
    options.testingOptions.origin = origin;
    options.testingOptions.destination = destination;
    // We don't care about force for this test
    options.setForce(true);
    skylark = new SkylarkTestExecutor(options, TestingModule.class);
    workdir = Files.createTempDirectory("workdir");
}
Also used : RecordsProcessCallDestination(com.google.copybara.testing.RecordsProcessCallDestination) TestingModule(com.google.copybara.testing.TestingModule) DummyOrigin(com.google.copybara.testing.DummyOrigin) 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 28 with OptionsBuilder

use of com.google.copybara.testing.OptionsBuilder in project copybara by google.

the class WorkflowTest method setup.

@Before
public void setup() throws Exception {
    options = new OptionsBuilder();
    authoring = "authoring.overwrite('" + DEFAULT_AUTHOR + "')";
    includeReleaseNotes = false;
    workdir = Files.createTempDirectory("workdir");
    Files.createDirectories(workdir);
    origin = new DummyOrigin().setAuthor(ORIGINAL_AUTHOR);
    originFiles = "glob(['**'], exclude = ['copy.bara.sky', 'excluded/**'])";
    destinationFiles = "glob(['**'])";
    destination = new RecordsProcessCallDestination();
    transformations = ImmutableList.of("" + "        core.replace(\n" + "             before = '${linestart}${number}',\n" + "             after = '${linestart}" + PREFIX + "${number}',\n" + "             regex_groups = {\n" + "                 'number'    : '[0-9]+',\n" + "                 'linestart' : '^',\n" + "             },\n" + "             multiline = True," + "        )");
    TestingConsole console = new TestingConsole();
    options.setConsole(console);
    options.testingOptions.origin = origin;
    options.testingOptions.destination = destination;
    // Force by default unless we are testing the flag.
    options.setForce(true);
    skylark = new SkylarkParser(ImmutableSet.of(Core.class, Authoring.Module.class, TestingModule.class, MetadataModule.class, FolderModule.class, GitModule.class));
    eventMonitor = new TestingEventMonitor();
    options.general.withEventMonitor(eventMonitor);
    transformWork = TransformWorks.of(workdir, "example", console);
}
Also used : RecordsProcessCallDestination(com.google.copybara.testing.RecordsProcessCallDestination) SkylarkParser(com.google.copybara.config.SkylarkParser) Authoring(com.google.copybara.authoring.Authoring) DummyOrigin(com.google.copybara.testing.DummyOrigin) TestingConsole(com.google.copybara.util.console.testing.TestingConsole) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) TestingEventMonitor(com.google.copybara.testing.TestingEventMonitor) Before(org.junit.Before)

Example 29 with OptionsBuilder

use of com.google.copybara.testing.OptionsBuilder 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 30 with OptionsBuilder

use of com.google.copybara.testing.OptionsBuilder in project copybara by google.

the class SubmodulesInDestinationTest method setup.

@Before
public void setup() throws Exception {
    repoGitDir = Files.createTempDirectory("SubmodulesInDestinationTest-repoGitDir");
    workdir = Files.createTempDirectory("workdir");
    git("init", "--bare", repoGitDir.toString());
    console = new TestingConsole();
    options = new OptionsBuilder().setConsole(console).setOutputRootToTmpDir();
    options.gitDestination.committerEmail = "commiter@email";
    options.gitDestination.committerName = "Bara Kopi";
    destinationFiles = Glob.createGlob(ImmutableList.of("**"));
    url = "file://" + repoGitDir;
    skylark = new SkylarkTestExecutor(options, GitModule.class);
    submodule = GitRepository.newBareRepo(Files.createTempDirectory("gitdir"), getGitEnv(), /*verbose=*/
    true).withWorkTree(Files.createTempDirectory("worktree")).init();
    Files.write(submodule.getWorkTree().resolve("foo"), new byte[] { 1 });
    submodule.add().files("foo").run();
    submodule.simpleCommand("commit", "-m", "dummy commit");
}
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)

Aggregations

OptionsBuilder (com.google.copybara.testing.OptionsBuilder)34 Before (org.junit.Before)33 TestingConsole (com.google.copybara.util.console.testing.TestingConsole)28 SkylarkTestExecutor (com.google.copybara.testing.SkylarkTestExecutor)26 FileSystem (java.nio.file.FileSystem)7 Core (com.google.copybara.Core)5 SkylarkParser (com.google.copybara.config.SkylarkParser)5 DummyOrigin (com.google.copybara.testing.DummyOrigin)5 Path (java.nio.file.Path)5 Authoring (com.google.copybara.authoring.Authoring)4 RepoException (com.google.copybara.exception.RepoException)4 RecordsProcessCallDestination (com.google.copybara.testing.RecordsProcessCallDestination)4 TestGitOptions (com.google.copybara.testing.git.GitTestUtil.TestGitOptions)4 HttpTransport (com.google.api.client.http.HttpTransport)3 GitApiMockHttpTransport (com.google.copybara.testing.OptionsBuilder.GitApiMockHttpTransport)3 MockLowLevelHttpRequest (com.google.api.client.testing.http.MockLowLevelHttpRequest)2 GeneralOptions (com.google.copybara.GeneralOptions)2 GithubApi (com.google.copybara.git.github.api.GithubApi)2 TestingEventMonitor (com.google.copybara.testing.TestingEventMonitor)2 IOException (java.io.IOException)2