use of com.google.copybara.config.SkylarkParser in project copybara by google.
the class ReadConfigFromChangeWorkflowTest method setup.
@Before
public void setup() {
options = new OptionsBuilder();
origin = new DummyOrigin();
destination = new RecordsProcessCallDestination();
options.testingOptions.origin = origin;
options.testingOptions.destination = destination;
skylark = new SkylarkParser(ImmutableSet.of(Core.class, Authoring.Module.class, TestingModule.class));
}
use of com.google.copybara.config.SkylarkParser in project copybara by google.
the class MetadataModuleTest method setup.
@Before
public void setup() throws Exception {
options = new OptionsBuilder();
authoring = "authoring.overwrite('" + DEFAULT_AUTHOR + "')";
workdir = Files.createTempDirectory("workdir");
Files.createDirectories(workdir);
origin = new DummyOrigin().setAuthor(ORIGINAL_AUTHOR);
destination = new RecordsProcessCallDestination();
options.setConsole(new TestingConsole());
options.testingOptions.origin = origin;
options.testingOptions.destination = destination;
skylark = new SkylarkParser(ImmutableSet.of(Core.class, Authoring.Module.class, TestingModule.class, MetadataModule.class));
skylarkExecutor = new SkylarkTestExecutor(options, MetadataModule.class);
origin.addSimpleChange(0, "first commit\n\nExtended text").setAuthor(FOO_BAR).addSimpleChange(1, "second commit\n\nExtended text").setAuthor(FOO_BAZ).addSimpleChange(2, "third commit\n\nExtended text");
options.setLastRevision("0");
// We don't care about already migrated code
options.setForce(true);
testingConsole = new TestingConsole();
options.setConsole(testingConsole);
}
use of com.google.copybara.config.SkylarkParser in project copybara by google.
the class GithubPrOriginTest method setup.
@Before
public void setup() throws Exception {
repoGitDir = Files.createTempDirectory("GithubPrDestinationTest-repoGitDir");
workdir = Files.createTempDirectory("workdir");
localHub = Files.createTempDirectory("localHub");
git("init", "--bare", repoGitDir.toString());
console = new TestingConsole();
options = new OptionsBuilder().setConsole(console).setOutputRootToTmpDir();
options.git = new TestGitOptions(localHub, () -> this.options.general, new Validator() {
@Override
public void validateFetch(String url, boolean prune, boolean force, Iterable<String> refspecs) {
for (String refspec : refspecs) {
// WARNING! This check is important. While using short names like
// 'master' in git fetch works for local git invocations, other
// implementations of GitRepository might have problems if we don't
// pass the whole reference.
assertThat(refspec).startsWith("refs/");
assertThat(refspec).contains(":refs/");
}
}
});
options.github = new GithubOptions(() -> options.general, options.git) {
@Override
public GithubApi getApi(String project) throws RepoException {
assertThat(project).isEqualTo(expectedProject);
return super.getApi(project);
}
@Override
protected HttpTransport getHttpTransport() {
return gitApiMockHttpTransport;
}
};
Path credentialsFile = Files.createTempFile("credentials", "test");
Files.write(credentialsFile, "https://user:SECRET@github.com".getBytes(UTF_8));
options.git.credentialHelperStorePath = credentialsFile.toString();
skylark = new SkylarkTestExecutor(options, GitModule.class);
skylarkParser = new SkylarkParser(ImmutableSet.of(Core.class, Authoring.Module.class, FolderModule.class, GitModule.class));
}
use of com.google.copybara.config.SkylarkParser 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.config.SkylarkParser 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);
}
Aggregations