use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class SkylarkTransformationTest method setup.
@Before
public void setup() throws IOException {
FileSystem fs = Jimfs.newFileSystem();
checkoutDir = fs.getPath("/test-checkoutDir");
Files.createDirectories(checkoutDir);
console = new TestingConsole();
options = new OptionsBuilder().setConsole(console);
skylark = new SkylarkTestExecutor(options);
transformWork = TransformWorks.of(checkoutDir, "testmsg", console);
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class VerifyMatchTest method setup.
@Before
public void setup() throws IOException {
FileSystem 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.util.console.testing.TestingConsole in project copybara by google.
the class ConsoleProfilerListenerTest method testConsoleProfilerListener.
@Test
public void testConsoleProfilerListener() {
TestingConsole console = new TestingConsole();
profiler.init(ImmutableList.of(new ConsoleProfilerListener(console)));
try (ProfilerTask ignore = profiler.start("iterative")) {
ticker.advance(10, TimeUnit.MILLISECONDS);
try (ProfilerTask ignore2 = profiler.start("origin.checkout")) {
ticker.advance(5, TimeUnit.MILLISECONDS);
}
try (ProfilerTask ignore3 = profiler.start("transforms")) {
ticker.advance(20, TimeUnit.MILLISECONDS);
}
try (ProfilerTask ignore4 = profiler.start("destination.write")) {
ticker.advance(3, TimeUnit.MILLISECONDS);
}
}
profiler.stop();
console.assertThat().matchesNextSkipAhead(VERBOSE, "PROFILE:.*6 //copybara/iterative/origin.checkout").matchesNextSkipAhead(VERBOSE, "PROFILE:.*21 //copybara/iterative/transforms").matchesNextSkipAhead(VERBOSE, "PROFILE:.*4 //copybara/iterative/destination.write").matchesNextSkipAhead(VERBOSE, "PROFILE:.*45 //copybara/iterative").matchesNextSkipAhead(VERBOSE, "PROFILE:.*47 //copybara");
}
use of com.google.copybara.util.console.testing.TestingConsole 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.util.console.testing.TestingConsole 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);
}
Aggregations