use of com.google.copybara.testing.SkylarkTestExecutor in project copybara by google.
the class GithubArchiveTest method setup.
@Before
public void setup() throws IOException {
httpTransport = new MockHttpTransport() {
@Override
public LowLevelHttpRequest buildRequest(String method, String url) {
String requestString = method + " " + url;
MockLowLevelHttpRequest request = new MockLowLevelHttpRequest();
MockLowLevelHttpResponse response = new MockLowLevelHttpResponse();
request.setResponse(response);
response.setStatusCode(200);
response.setContent(responseContent);
if (!url.equals(expectedRequest)) {
response.setStatusCode(404);
response.setContent(String.format("UNEXPECTED REQUEST (Returning 404) REQUEST: %s, expected: %s", requestString, expectedRequest));
}
return request;
}
};
RemoteFileOptions options = new RemoteFileOptions();
options.transport = () -> new GclientHttpStreamFactory(httpTransport, Duration.ofSeconds(20));
Console console = new TestingConsole();
OptionsBuilder optionsBuilder = new OptionsBuilder().setConsole(console);
optionsBuilder.remoteFile = options;
skylark = new SkylarkTestExecutor(optionsBuilder);
}
use of com.google.copybara.testing.SkylarkTestExecutor in project copybara by google.
the class RemoteFileModuleTest method setUp.
@Before
public void setUp() throws Exception {
console = new TestingConsole();
workdir = Files.createTempDirectory("workdir");
RemoteFileOptions options = new RemoteFileOptions();
options.transport = () -> transport;
OptionsBuilder optionsBuilder = new OptionsBuilder().setConsole(console);
optionsBuilder.remoteFile = options;
skylark = new SkylarkTestExecutor(optionsBuilder);
}
use of com.google.copybara.testing.SkylarkTestExecutor in project copybara by google.
the class FilterReplaceTest method setup.
@Before
public void setup() throws IOException {
fs = Jimfs.newFileSystem();
checkoutDir = fs.getPath("/");
Files.createDirectories(checkoutDir);
console = new TestingConsole();
options = new OptionsBuilder().setConsole(console);
skylark = new SkylarkTestExecutor(options);
}
use of com.google.copybara.testing.SkylarkTestExecutor 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 SkylarkTestExecutor(options);
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.testing.SkylarkTestExecutor in project copybara by google.
the class QuiltTransformationTest method setUp.
@Before
public void setUp() throws IOException {
checkoutDir = Files.createTempDirectory("workdir");
Files.createDirectories(checkoutDir);
console = new TestingConsole();
// QuiltTransformation needs to write and read from to real temp directory.
options = new OptionsBuilder().setWorkdirToRealTempDir();
// GeneralOptions.getDirFactory() requires $HOME to be set. We set --output-root instead.
options.setOutputRootToTmpDir();
patchingOptions = options.build().get(PatchingOptions.class);
patchingOptions.quiltBin = setUpQuiltBin(patchingOptions.getGeneralOptions());
skylark = new SkylarkTestExecutor(options);
ImmutableMap<String, byte[]> configFiles = ImmutableMap.of("patches/diff.patch", OLDDIFF.getBytes(UTF_8), "patches/series", SERIES.getBytes(UTF_8));
patchFile = new MapConfigFile(configFiles, "patches/diff.patch");
seriesFile = new MapConfigFile(configFiles, "patches/series");
}
Aggregations