use of io.confluent.ksql.execution.expression.tree.Literal in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldSetValidTimestampFormat.
@Test
public void shouldSetValidTimestampFormat() {
// When:
final CreateSourceProperties properties = CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(CommonCreateConfigs.TIMESTAMP_FORMAT_PROPERTY, new StringLiteral("yyyy-MM-dd'T'HH:mm:ss.SSS")).build());
// Then:
assertThat(properties.getTimestampFormat(), is(Optional.of("yyyy-MM-dd'T'HH:mm:ss.SSS")));
}
use of io.confluent.ksql.execution.expression.tree.Literal in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldSetWrapSingleValues.
@Test
public void shouldSetWrapSingleValues() {
// When:
final CreateSourceProperties properties = CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(CommonCreateConfigs.WRAP_SINGLE_VALUE, new BooleanLiteral("true")).build());
// Then:
assertThat(properties.getValueSerdeFeatures(), is(SerdeFeatures.of(SerdeFeature.WRAP_SINGLES)));
}
use of io.confluent.ksql.execution.expression.tree.Literal in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldSetValidTimestampName.
@Test
public void shouldSetValidTimestampName() {
// When:
final CreateSourceProperties properties = CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(CommonCreateConfigs.TIMESTAMP_NAME_PROPERTY, new StringLiteral("ts")).build());
// Then:
assertThat(properties.getTimestampColumnName(), is(Optional.of(ColumnName.of("TS"))));
}
use of io.confluent.ksql.execution.expression.tree.Literal in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldFailIfNoKafkaTopicName.
@Test
public void shouldFailIfNoKafkaTopicName() {
// Given:
final HashMap<String, Literal> props = new HashMap<>(MINIMUM_VALID_PROPS);
props.remove(KAFKA_TOPIC_NAME_PROPERTY);
// When:
final Exception e = assertThrows(KsqlException.class, () -> CreateSourceProperties.from(props));
// Then:
assertThat(e.getMessage(), containsString("Missing required property \"KAFKA_TOPIC\" which has no default value."));
}
use of io.confluent.ksql.execution.expression.tree.Literal in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldSetBooleanPropertyFromStringLiteral.
@Test
public void shouldSetBooleanPropertyFromStringLiteral() {
// When:
final CreateSourceProperties properties = CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(CommonCreateConfigs.WRAP_SINGLE_VALUE, new StringLiteral("true")).build());
// Then:
assertThat(properties.getValueSerdeFeatures(), is(SerdeFeatures.of(SerdeFeature.WRAP_SINGLES)));
}
Aggregations