Search in sources :

Example 11 with CommandLineParser

use of com.datastax.oss.dsbulk.runner.cli.CommandLineParser in project dsbulk by datastax.

the class DataStaxBulkLoaderTest method should_process_json_short_options.

@ParameterizedTest
@MethodSource
void should_process_json_short_options(String shortOptionName, String shortOptionValue, String setting, Object expected) throws Exception {
    Config result = new CommandLineParser("load", "-c", "json", shortOptionName, shortOptionValue).parse().getConfig();
    assertThat(result.getAnyRef(setting)).isEqualTo(expected);
}
Also used : Config(com.typesafe.config.Config) CommandLineParser(com.datastax.oss.dsbulk.runner.cli.CommandLineParser) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 12 with CommandLineParser

use of com.datastax.oss.dsbulk.runner.cli.CommandLineParser in project dsbulk by datastax.

the class DataStaxBulkLoaderTest method should_accept_escaped_backslash.

@Test
void should_accept_escaped_backslash() throws Exception {
    // backslashes should be provided escaped as valid HOCON
    Config result = new CommandLineParser("load", "--connector.csv.url", "C:\\\\Users").parse().getConfig();
    assertThat(result.getString("dsbulk.connector.csv.url")).isEqualTo("C:\\Users");
}
Also used : Config(com.typesafe.config.Config) CommandLineParser(com.datastax.oss.dsbulk.runner.cli.CommandLineParser) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 13 with CommandLineParser

use of com.datastax.oss.dsbulk.runner.cli.CommandLineParser in project dsbulk by datastax.

the class DataStaxBulkLoaderTest method should_propagate_references.

@Test
void should_propagate_references() throws Exception {
    Config result = new CommandLineParser("load", "--driver.basic.request.timeout", "10 minutes", "--driver.basic.request.page-size", "1234").parse().getConfig();
    assertThat(result.getString("datastax-java-driver.basic.request.timeout")).isEqualTo("10 minutes");
    assertThat(result.getString("datastax-java-driver.advanced.metadata.schema.request-timeout")).isEqualTo("10 minutes");
    assertThat(result.getString("datastax-java-driver.basic.request.page-size")).isEqualTo("1234");
    assertThat(result.getString("datastax-java-driver.advanced.metadata.schema.request-page-size")).isEqualTo("1234");
}
Also used : Config(com.typesafe.config.Config) CommandLineParser(com.datastax.oss.dsbulk.runner.cli.CommandLineParser) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 14 with CommandLineParser

use of com.datastax.oss.dsbulk.runner.cli.CommandLineParser in project dsbulk by datastax.

the class DataStaxBulkLoaderTest method should_accept_escaped_control_char.

@Test
void should_accept_escaped_control_char() throws Exception {
    // control chars should be provided escaped as valid HOCON
    Config result = new CommandLineParser("load", "--connector.csv.delimiter", "\\t").parse().getConfig();
    assertThat(result.getString("dsbulk.connector.csv.delimiter")).isEqualTo("\t");
}
Also used : Config(com.typesafe.config.Config) CommandLineParser(com.datastax.oss.dsbulk.runner.cli.CommandLineParser) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

CommandLineParser (com.datastax.oss.dsbulk.runner.cli.CommandLineParser)14 Config (com.typesafe.config.Config)13 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 Test (org.junit.jupiter.api.Test)7 MethodSource (org.junit.jupiter.params.provider.MethodSource)6 GlobalHelpRequestException (com.datastax.oss.dsbulk.runner.cli.GlobalHelpRequestException)1 ParseException (com.datastax.oss.dsbulk.runner.cli.ParseException)1 ParsedCommandLine (com.datastax.oss.dsbulk.runner.cli.ParsedCommandLine)1 SectionHelpRequestException (com.datastax.oss.dsbulk.runner.cli.SectionHelpRequestException)1 VersionRequestException (com.datastax.oss.dsbulk.runner.cli.VersionRequestException)1 Workflow (com.datastax.oss.dsbulk.workflow.api.Workflow)1 NonNull (edu.umd.cs.findbugs.annotations.NonNull)1 BufferedWriter (java.io.BufferedWriter)1 OutputStreamWriter (java.io.OutputStreamWriter)1 PrintWriter (java.io.PrintWriter)1