Search in sources :

Example 1 with Options

use of com.google.copybara.Options 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("/"));
}
Also used : WorkflowOptions(com.google.copybara.WorkflowOptions) Options(com.google.copybara.Options) TestingConsole(com.google.copybara.util.console.testing.TestingConsole) JCommander(com.beust.jcommander.JCommander) ModuleSupplier(com.google.copybara.ModuleSupplier)

Example 2 with Options

use of com.google.copybara.Options 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);
}
Also used : GeneralOptions(com.google.copybara.GeneralOptions) Options(com.google.copybara.Options) TestingConsole(com.google.copybara.util.console.testing.TestingConsole) GeneralOptions(com.google.copybara.GeneralOptions) JCommander(com.beust.jcommander.JCommander) ModuleSupplier(com.google.copybara.ModuleSupplier)

Aggregations

JCommander (com.beust.jcommander.JCommander)2 ModuleSupplier (com.google.copybara.ModuleSupplier)2 Options (com.google.copybara.Options)2 TestingConsole (com.google.copybara.util.console.testing.TestingConsole)2 GeneralOptions (com.google.copybara.GeneralOptions)1 WorkflowOptions (com.google.copybara.WorkflowOptions)1