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));
}
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");
}
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);
}
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);
}
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");
}
Aggregations