Search in sources :

Example 26 with ConversionContext

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

the class JsonNodeToBigIntegerCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL").setFormatNumbers(true);
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec = (JsonNodeToBigIntegerCodec) codecFactory.<JsonNode, BigInteger>createConvertingCodec(DataTypes.VARINT, JSON_NODE_TYPE, 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) JsonNode(com.fasterxml.jackson.databind.JsonNode) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 27 with ConversionContext

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

the class JsonNodeToLongCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL").setFormatNumbers(true);
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec = (JsonNodeToLongCodec) codecFactory.<JsonNode, Long>createConvertingCodec(DataTypes.BIGINT, JSON_NODE_TYPE, 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) JsonNode(com.fasterxml.jackson.databind.JsonNode) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 28 with ConversionContext

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

the class StringToIntegerCodecTest method setUpCodec2.

@BeforeEach
void setUpCodec2() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL", "NADA").setFormatNumbers(true);
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec2 = (StringToIntegerCodec) codecFactory.<String, Integer>createConvertingCodec(DataTypes.INT, 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) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 29 with ConversionContext

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

the class StringToListCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL");
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec1 = (StringToListCodec<Double>) codecFactory.<String, List<Double>>createConvertingCodec(DataTypes.listOf(DataTypes.DOUBLE), GenericType.STRING, true);
    codec2 = (StringToListCodec<Instant>) codecFactory.<String, List<Instant>>createConvertingCodec(DataTypes.listOf(DataTypes.TIMESTAMP), GenericType.STRING, true);
    codec3 = (StringToListCodec<String>) codecFactory.<String, List<String>>createConvertingCodec(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) Instant(java.time.Instant) List(java.util.List) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 30 with ConversionContext

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

the class StringToLongCodecTest method setUp.

@BeforeEach
void setUp() {
    ConversionContext context = new TextConversionContext().setNullStrings("NULL").setFormatNumbers(true);
    ConvertingCodecFactory codecFactory = new ConvertingCodecFactory(context);
    codec = (StringToLongCodec) codecFactory.<String, Long>createConvertingCodec(DataTypes.BIGINT, 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) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ConversionContext (com.datastax.oss.dsbulk.codecs.api.ConversionContext)32 ConvertingCodecFactory (com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory)28 TextConversionContext (com.datastax.oss.dsbulk.codecs.text.TextConversionContext)28 BeforeEach (org.junit.jupiter.api.BeforeEach)28 JsonNode (com.fasterxml.jackson.databind.JsonNode)15 List (java.util.List)5 Instant (java.time.Instant)4 ImmutableMap (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap)3 TupleValue (com.datastax.oss.driver.api.core.data.TupleValue)2 UdtValue (com.datastax.oss.driver.api.core.data.UdtValue)2 CustomType (com.datastax.oss.driver.api.core.type.CustomType)2 CodecNotFoundException (com.datastax.oss.driver.api.core.type.codec.CodecNotFoundException)2 CodecRegistry (com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry)2 ImmutableList (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableList)2 ConvertingCodec (com.datastax.oss.dsbulk.codecs.api.ConvertingCodec)2 JdkCodecUtils.isUUID (com.datastax.oss.dsbulk.codecs.jdk.JdkCodecUtils.isUUID)2 NonNull (edu.umd.cs.findbugs.annotations.NonNull)2 Nullable (edu.umd.cs.findbugs.annotations.Nullable)2 BigDecimal (java.math.BigDecimal)2 BigInteger (java.math.BigInteger)2