use of com.google.copybara.ModuleSupplier in project copybara by google.
the class GlobConverterTest method parseGlob.
private PathMatcher parseGlob(String value) throws IOException {
ImmutableMap<String, String> envWithHome = ImmutableMap.of("HOME", Files.createTempDirectory("foo").toString());
ModuleSupplier moduleSupplier = new ModuleSupplier(envWithHome, FileSystems.getDefault(), new TestingConsole());
Options options = moduleSupplier.create().getOptions();
JCommander jCommander = new JCommander(options.getAll());
jCommander.parse("--read-config-from-head-paths", value);
return options.get(WorkflowOptions.class).readConfigFromChangePaths.relativeTo(Paths.get("/"));
}
use of com.google.copybara.ModuleSupplier in project copybara by google.
the class DurationConverterTest method checkFetchTimeout.
private void checkFetchTimeout(String flagValue, Duration expected) throws IOException {
ImmutableMap<String, String> envWithHome = ImmutableMap.of("HOME", Files.createTempDirectory("foo").toString());
ModuleSupplier moduleSupplier = new ModuleSupplier(envWithHome, FileSystems.getDefault(), new TestingConsole());
Options options = moduleSupplier.create().getOptions();
JCommander jCommander = new JCommander(options.getAll());
jCommander.parse("--fetch-timeout", flagValue);
assertThat(options.get(GeneralOptions.class).fetchTimeout).isEquivalentAccordingToCompareTo(expected);
}
Aggregations