use of com.google.copybara.util.console.testing.TestingConsole 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");
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class CoreReverseTest method setup.
@Before
public void setup() {
OptionsBuilder options = new OptionsBuilder();
skylark = new SkylarkTestExecutor(options).withStaticModules(ImmutableSet.of(Mock.class));
console = new TestingConsole();
options.setConsole(console);
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class MigrateCmdTest method setUp.
@Before
public void setUp() throws Exception {
console = new TestingConsole();
temp = Files.createTempDirectory("temp");
optionsBuilder = new OptionsBuilder();
optionsBuilder.setConsole(console).setOutputRootToTmpDir();
optionsBuilder.setForce(true);
Path userHomeForTest = Files.createTempDirectory("home");
optionsBuilder.setEnvironment(GitTestUtil.getGitEnv().getEnvironment());
optionsBuilder.setHomeDir(userHomeForTest.toString());
eventMonitor = new TestingEventMonitor();
optionsBuilder.general.enableEventMonitor("just testing", eventMonitor);
outPut = optionsBuilder.general.getOutputRoot();
optionsBuilder.general.starlarkMode = StarlarkMode.STRICT.name();
remote = Files.createTempDirectory("remote");
repo = GitRepository.newRepo(/*verbose*/
true, remote, new GitEnvironment(optionsBuilder.general.getEnvironment())).init();
primaryBranch = repo.getPrimaryBranch();
Files.createDirectories(remote.resolve("include"));
Files.write(remote.resolve("include/fileA.txt"), new byte[0]);
git(remote, "add", "include/fileA.txt");
git(remote, "commit", "-m", "not include");
optionsBuilder.setLastRevision(repo.parseRef("HEAD"));
git(remote, "checkout", primaryBranch);
Files.write(remote.resolve("include/mainline-file.txt"), new byte[0]);
git(remote, "add", "include/mainline-file.txt");
git(remote, "commit", "-m", "message_a!");
optionsBuilder.general.dryRunMode = true;
url = "file://" + remote.toFile().getAbsolutePath();
writeFile(remote, "test.txt", "some content");
writeFile(remote, "testA.txt", "some content");
repo.add().files("test.txt", "testA.txt").run();
git(remote, "commit", "-m", "first file", "--date", COMMIT_TIME);
optionsBuilder.setForce(true);
RecordsProcessCallDestination destination = new RecordsProcessCallDestination();
optionsBuilder.testingOptions.destination = destination;
skylark = new SkylarkTestExecutor(optionsBuilder);
}
use of com.google.copybara.util.console.testing.TestingConsole 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);
workdir = Files.createTempDirectory("workdir");
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class CoreTransformTest method testIgnoreNoopWithVerboseFalse.
@Test
public void testIgnoreNoopWithVerboseFalse() throws Exception {
ExplicitReversal t = skylark.eval("x", "x=" + "core.transform([\n" + " core.replace(\n" + " before = 'not found',\n" + " after = 'not important',\n" + " ),\n" + "]," + "ignore_noop=True)");
console = new TestingConsole(false);
options.setConsole(console);
Files.write(checkoutDir.resolve("file.txt"), "foo".getBytes(UTF_8));
t.transform(TransformWorks.of(checkoutDir, "msg", console));
console.assertThat().matchesNext(MessageType.PROGRESS, ".*Replace not found.*").containsNoMoreMessages();
}
Aggregations