Search in sources :

Example 11 with DefaultMappedField

use of com.datastax.oss.dsbulk.connectors.api.DefaultMappedField in project dsbulk by datastax.

the class RecordUtils method mappedCSV.

public static Record mappedCSV(String... tokens) {
    int counter = COUNTER.incrementAndGet();
    DefaultRecord record = DefaultRecord.indexed("source" + counter, URI.create("file://file" + counter + ".csv"), counter - 1);
    for (int i = 0; i < tokens.length; i += 2) {
        record.put(new DefaultMappedField(tokens[i]), tokens[i + 1]);
        record.put(new DefaultIndexedField(i % 2), tokens[i + 1]);
    }
    return record;
}
Also used : DefaultIndexedField(com.datastax.oss.dsbulk.connectors.api.DefaultIndexedField) DefaultMappedField(com.datastax.oss.dsbulk.connectors.api.DefaultMappedField) DefaultRecord(com.datastax.oss.dsbulk.connectors.api.DefaultRecord)

Aggregations

DefaultMappedField (com.datastax.oss.dsbulk.connectors.api.DefaultMappedField)11 DefaultRecord (com.datastax.oss.dsbulk.connectors.api.DefaultRecord)7 Record (com.datastax.oss.dsbulk.connectors.api.Record)6 DefaultIndexedField (com.datastax.oss.dsbulk.connectors.api.DefaultIndexedField)5 Field (com.datastax.oss.dsbulk.connectors.api.Field)5 Test (org.junit.jupiter.api.Test)5 Config (com.typesafe.config.Config)4 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)3 ErrorRecord (com.datastax.oss.dsbulk.connectors.api.ErrorRecord)3 ArrayList (java.util.ArrayList)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 DataStaxBulkLoader (com.datastax.oss.dsbulk.runner.DataStaxBulkLoader)2 ExitStatus (com.datastax.oss.dsbulk.runner.ExitStatus)2 Path (java.nio.file.Path)2 CqlSession (com.datastax.oss.driver.api.core.CqlSession)1 ImmutableSetMultimap (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableSetMultimap)1 SetMultimap (com.datastax.oss.driver.shaded.guava.common.collect.SetMultimap)1 CQLWord (com.datastax.oss.dsbulk.mapping.CQLWord)1 STATUS_OK (com.datastax.oss.dsbulk.runner.ExitStatus.STATUS_OK)1 EndToEndUtils.assertStatus (com.datastax.oss.dsbulk.runner.tests.EndToEndUtils.assertStatus)1