Search in sources :

Example 11 with ConvertingCodecFactory

use of com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory in project dsbulk by datastax.

the class StringToMapCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL").setFormatNumbers(true);
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec = (StringToMapCodec<Double, List<String>>) codecFactory.<String, Map<Double, List<String>>>createConvertingCodec(DataTypes.mapOf(DataTypes.DOUBLE, DataTypes.listOf(DataTypes.TEXT)), GenericType.STRING, true);
}
Also used : ConvertingCodecFactory(com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) ConversionContext(com.datastax.oss.dsbulk.codecs.api.ConversionContext) List(java.util.List) ImmutableMap(com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with ConvertingCodecFactory

use of com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory in project dsbulk by datastax.

the class StringToSetCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL");
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec1 = (StringToSetCodec<Double>) codecFactory.<String, Set<Double>>createConvertingCodec(DataTypes.setOf(DataTypes.DOUBLE), GenericType.STRING, true);
    codec2 = (StringToSetCodec<String>) codecFactory.<String, Set<String>>createConvertingCodec(DataTypes.setOf(DataTypes.TEXT), GenericType.STRING, true);
}
Also used : ConvertingCodecFactory(com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) Set(java.util.Set) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) ConversionContext(com.datastax.oss.dsbulk.codecs.api.ConversionContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with ConvertingCodecFactory

use of com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory in project dsbulk by datastax.

the class StringToTupleCodecTest method setUp.

@BeforeEach
void setUp() {
    tupleType = DriverUtils.mockTupleType(DefaultProtocolVersion.V4, CodecRegistry.DEFAULT, DataTypes.TIMESTAMP, DataTypes.TEXT);
    ConversionContext context1 = new TextConversionContext().setNullStrings("NULL", "");
    ConversionContext context2 = new TextConversionContext().setAllowExtraFields(true);
    ConversionContext context3 = new TextConversionContext().setAllowMissingFields(true);
    codec1 = (StringToTupleCodec) new ConvertingCodecFactory(context1).<String, TupleValue>createConvertingCodec(tupleType, GenericType.STRING, true);
    codec2 = (StringToTupleCodec) new ConvertingCodecFactory(context2).<String, TupleValue>createConvertingCodec(tupleType, GenericType.STRING, true);
    codec3 = (StringToTupleCodec) new ConvertingCodecFactory(context3).<String, TupleValue>createConvertingCodec(tupleType, GenericType.STRING, true);
}
Also used : ConvertingCodecFactory(com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) ConversionContext(com.datastax.oss.dsbulk.codecs.api.ConversionContext) TupleValue(com.datastax.oss.driver.api.core.data.TupleValue) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 14 with ConvertingCodecFactory

use of com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory in project dsbulk by datastax.

the class StringToBigDecimalCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL").setFormatNumbers(true);
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec = (StringToBigDecimalCodec) codecFactory.<String, BigDecimal>createConvertingCodec(DataTypes.DECIMAL, GenericType.STRING, true);
}
Also used : ConvertingCodecFactory(com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) ConversionContext(com.datastax.oss.dsbulk.codecs.api.ConversionContext) BigDecimal(java.math.BigDecimal) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 15 with ConvertingCodecFactory

use of com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory in project dsbulk by datastax.

the class StringToBigIntegerCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL").setFormatNumbers(true);
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec = (StringToBigIntegerCodec) codecFactory.<String, BigInteger>createConvertingCodec(DataTypes.VARINT, GenericType.STRING, true);
}
Also used : ConvertingCodecFactory(com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) TextConversionContext(com.datastax.oss.dsbulk.codecs.text.TextConversionContext) ConversionContext(com.datastax.oss.dsbulk.codecs.api.ConversionContext) BigInteger(java.math.BigInteger) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ConvertingCodecFactory (com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory)37 TextConversionContext (com.datastax.oss.dsbulk.codecs.text.TextConversionContext)29 BeforeEach (org.junit.jupiter.api.BeforeEach)29 ConversionContext (com.datastax.oss.dsbulk.codecs.api.ConversionContext)28 JsonNode (com.fasterxml.jackson.databind.JsonNode)14 Config (com.typesafe.config.Config)5 Test (org.junit.jupiter.api.Test)5 List (java.util.List)4 CodecSettings (com.datastax.oss.dsbulk.workflow.commons.settings.CodecSettings)3 DriverSettings (com.datastax.oss.dsbulk.workflow.commons.settings.DriverSettings)3 ExecutorSettings (com.datastax.oss.dsbulk.workflow.commons.settings.ExecutorSettings)3 LogSettings (com.datastax.oss.dsbulk.workflow.commons.settings.LogSettings)3 MonitoringSettings (com.datastax.oss.dsbulk.workflow.commons.settings.MonitoringSettings)3 SchemaSettings (com.datastax.oss.dsbulk.workflow.commons.settings.SchemaSettings)3 Instant (java.time.Instant)3 TupleValue (com.datastax.oss.driver.api.core.data.TupleValue)2 UdtValue (com.datastax.oss.driver.api.core.data.UdtValue)2 ImmutableMap (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap)2 ConnectorSettings (com.datastax.oss.dsbulk.workflow.commons.settings.ConnectorSettings)2 EngineSettings (com.datastax.oss.dsbulk.workflow.commons.settings.EngineSettings)2