Search in sources :

Example 21 with PersistenceSchema

use of io.confluent.ksql.schema.ksql.PersistenceSchema in project ksql by confluentinc.

the class KafkaSerdeFactoryTest method shouldThrowIfDecimal.

@Test
public void shouldThrowIfDecimal() {
    // Given:
    final PersistenceSchema schema = schemaWithFieldOfType(SqlTypes.decimal(1, 1));
    // When:
    final Exception e = assertThrows(KsqlException.class, () -> KafkaSerdeFactory.createSerde(schema));
    // Then:
    assertThat(e.getMessage(), containsString("The 'KAFKA' format does not support type 'DECIMAL'"));
}
Also used : PersistenceSchema(io.confluent.ksql.schema.ksql.PersistenceSchema) KsqlException(io.confluent.ksql.util.KsqlException) Test(org.junit.Test)

Example 22 with PersistenceSchema

use of io.confluent.ksql.schema.ksql.PersistenceSchema in project ksql by confluentinc.

the class KafkaSerdeFactoryTest method shouldThrowIfMap.

@Test
public void shouldThrowIfMap() {
    // Given:
    final PersistenceSchema schema = schemaWithFieldOfType(SqlTypes.map(SqlTypes.STRING, SqlTypes.STRING));
    // When:
    final Exception e = assertThrows(KsqlException.class, () -> KafkaSerdeFactory.createSerde(schema));
    // Then:
    assertThat(e.getMessage(), containsString("The 'KAFKA' format does not support type 'MAP'"));
}
Also used : PersistenceSchema(io.confluent.ksql.schema.ksql.PersistenceSchema) KsqlException(io.confluent.ksql.util.KsqlException) Test(org.junit.Test)

Example 23 with PersistenceSchema

use of io.confluent.ksql.schema.ksql.PersistenceSchema in project ksql by confluentinc.

the class KsqlDelimitedSerializerTest method givenSingleColumnSerializer.

private void givenSingleColumnSerializer(final SqlType columnType) {
    final PersistenceSchema schema = givenSingleColumnPersistenceSchema(columnType);
    serializer = new KsqlDelimitedSerializer(schema, CSV_FORMAT);
}
Also used : PersistenceSchema(io.confluent.ksql.schema.ksql.PersistenceSchema)

Aggregations

PersistenceSchema (io.confluent.ksql.schema.ksql.PersistenceSchema)23 Test (org.junit.Test)20 KsqlException (io.confluent.ksql.util.KsqlException)10 ImmutableList (com.google.common.collect.ImmutableList)5 BigDecimal (java.math.BigDecimal)5 List (java.util.List)5 SerializationException (org.apache.kafka.common.errors.SerializationException)3 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)2 SerdeFeature (io.confluent.ksql.serde.SerdeFeature)1 SerdeFeatures (io.confluent.ksql.serde.SerdeFeatures)1