Search in sources :

Example 1 with TestingEventMonitor

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

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

the class CopybaraTest method setUp.

@Before
public void setUp() throws Exception {
    optionsBuilder = new OptionsBuilder();
    console = new TestingConsole();
    eventMonitor = new TestingEventMonitor();
    optionsBuilder.setConsole(console);
    optionsBuilder.general.withEventMonitor(eventMonitor);
    migration = mock(Migration.class);
    config = new Config(ImmutableMap.of("workflow", migration), "foo/copy.bara.sky");
}
Also used : TestingConsole(com.google.copybara.util.console.testing.TestingConsole) Migration(com.google.copybara.config.Migration) Config(com.google.copybara.config.Config) OptionsBuilder(com.google.copybara.testing.OptionsBuilder) TestingEventMonitor(com.google.copybara.testing.TestingEventMonitor) Before(org.junit.Before)

Aggregations

OptionsBuilder (com.google.copybara.testing.OptionsBuilder)2 TestingEventMonitor (com.google.copybara.testing.TestingEventMonitor)2 TestingConsole (com.google.copybara.util.console.testing.TestingConsole)2 Before (org.junit.Before)2 Authoring (com.google.copybara.authoring.Authoring)1 Config (com.google.copybara.config.Config)1 Migration (com.google.copybara.config.Migration)1 SkylarkParser (com.google.copybara.config.SkylarkParser)1 DummyOrigin (com.google.copybara.testing.DummyOrigin)1 RecordsProcessCallDestination (com.google.copybara.testing.RecordsProcessCallDestination)1