use of com.datastax.oss.simulacron.common.cluster.RequestPrime in project dsbulk by datastax.
the class CSVEndToEndSimulacronIT method full_unload_csv_default_modification.
/**
* This exercises logic which will replace the delimiter and make sure non-standard quoting is
* working.
*/
@Test
void full_unload_csv_default_modification() throws Exception {
primeIpByCountryTable(simulacron);
RequestPrime select = createQueryWithResultSetWithQuotes(SELECT_FROM_IP_BY_COUNTRY, 24);
simulacron.prime(new Prime(select));
String[] args = { "unload", "-header", "false", "--connector.csv.url", quoteJson(unloadDir), "--connector.csv.delimiter", ";", "--connector.csv.quote", "<", "--schema.keyspace", "ks1", "--schema.query", SELECT_FROM_IP_BY_COUNTRY, "--schema.mapping", IP_BY_COUNTRY_MAPPING_INDEXED };
ExitStatus status = new DataStaxBulkLoader(addCommonSettings(args)).run();
assertStatus(status, STATUS_OK);
verifyDelimiterCount(';', 168);
verifyDelimiterCount('<', 96);
validateQueryCount(simulacron, 1, SELECT_FROM_IP_BY_COUNTRY, LOCAL_ONE);
validateOutputFiles(24, unloadDir);
}
use of com.datastax.oss.simulacron.common.cluster.RequestPrime in project dsbulk by datastax.
the class CSVEndToEndSimulacronIT method full_load_crlf.
@Test
void full_load_crlf() {
primeIpByCountryTable(simulacron);
RequestPrime insert = createSimpleParameterizedQuery(INSERT_INTO_IP_BY_COUNTRY);
simulacron.prime(new Prime(insert));
String[] args = { "load", "-header", "false", "--connector.csv.url", StringUtils.quoteJson(CsvUtils.CSV_RECORDS_CRLF), "--schema.keyspace", "ks1", "--schema.query", INSERT_INTO_IP_BY_COUNTRY, "--schema.mapping", IP_BY_COUNTRY_MAPPING_INDEXED };
ExitStatus status = new DataStaxBulkLoader(addCommonSettings(args)).run();
assertStatus(status, STATUS_OK);
validateQueryCount(simulacron, 24, "INSERT INTO ip_by_country", LOCAL_ONE);
}
use of com.datastax.oss.simulacron.common.cluster.RequestPrime in project dsbulk by datastax.
the class CSVEndToEndSimulacronIT method full_load.
@Test
void full_load() {
primeIpByCountryTable(simulacron);
RequestPrime insert = createSimpleParameterizedQuery(INSERT_INTO_IP_BY_COUNTRY);
simulacron.prime(new Prime(insert));
String[] args = { "load", "--log.verbosity", "2", "-header", "false", "--connector.csv.url", StringUtils.quoteJson(CsvUtils.CSV_RECORDS_UNIQUE), "--schema.keyspace", "ks1", "--schema.query", INSERT_INTO_IP_BY_COUNTRY, "--schema.mapping", IP_BY_COUNTRY_MAPPING_INDEXED };
ExitStatus status = new DataStaxBulkLoader(addCommonSettings(args)).run();
assertStatus(status, STATUS_OK);
assertThat(logs.getAllMessagesAsString()).contains("Records: total: 24, successful: 24, failed: 0").contains("Batches: total: 24, size: 1.00 mean, 1 min, 1 max").contains("Writes: total: 24, successful: 24, failed: 0");
validateQueryCount(simulacron, 24, "INSERT INTO ip_by_country", LOCAL_ONE);
}
use of com.datastax.oss.simulacron.common.cluster.RequestPrime in project dsbulk by datastax.
the class CSVEndToEndSimulacronIT method partial_load.
@Test
void partial_load() throws Exception {
primeIpByCountryTable(simulacron);
RequestPrime insert = createSimpleParameterizedQuery(INSERT_INTO_IP_BY_COUNTRY);
simulacron.prime(new Prime(insert));
String[] args = { "load", "-header", "false", "--connector.csv.url", StringUtils.quoteJson(CsvUtils.CSV_RECORDS_PARTIAL_BAD), "--schema.keyspace", "ks1", "--schema.query", INSERT_INTO_IP_BY_COUNTRY, "--schema.mapping", IP_BY_COUNTRY_MAPPING_INDEXED, "--schema.allowMissingFields", "true" };
ExitStatus status = new DataStaxBulkLoader(addCommonSettings(args)).run();
assertStatus(status, STATUS_COMPLETED_WITH_ERRORS);
validateQueryCount(simulacron, 21, "INSERT INTO ip_by_country", LOCAL_ONE);
validateNumberOfBadRecords(3);
validateExceptionsLog(3, "Source:", "mapping-errors.log");
}
use of com.datastax.oss.simulacron.common.cluster.RequestPrime in project dsbulk by datastax.
the class CSVEndToEndSimulacronIT method full_unload.
@Test
void full_unload() throws Exception {
primeIpByCountryTable(simulacron);
RequestPrime select = createQueryWithResultSet(SELECT_FROM_IP_BY_COUNTRY, 24);
simulacron.prime(new Prime(select));
String[] args = { "unload", "--log.verbosity", "2", "-header", "false", "--connector.csv.url", quoteJson(unloadDir), "--schema.keyspace", "ks1", "--schema.query", SELECT_FROM_IP_BY_COUNTRY, "--schema.mapping", IP_BY_COUNTRY_MAPPING_INDEXED };
ExitStatus status = new DataStaxBulkLoader(addCommonSettings(args)).run();
assertStatus(status, STATUS_OK);
assertThat(logs.getAllMessagesAsString()).contains("Records: total: 24, successful: 24, failed: 0").contains("Reads: total: 24, successful: 24, failed: 0");
validateQueryCount(simulacron, 1, SELECT_FROM_IP_BY_COUNTRY, LOCAL_ONE);
validateOutputFiles(24, unloadDir);
}
Aggregations