use of io.confluent.ksql.execution.expression.tree.StringLiteral in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldThrowOnConstructionOnUnknownWindowType.
@Test
public void shouldThrowOnConstructionOnUnknownWindowType() {
// Given:
final Map<String, Literal> props = ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(CreateConfigs.WINDOW_TYPE_PROPERTY, new StringLiteral("Unknown")).build();
// When:
final Exception e = assertThrows(KsqlException.class, () -> CreateSourceProperties.from(props));
// Then:
assertThat(e.getMessage(), containsString("Invalid value Unknown for property WINDOW_TYPE: " + "String must be one of: SESSION, HOPPING, TUMBLING, null"));
}
use of io.confluent.ksql.execution.expression.tree.StringLiteral in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldThrowOnSessionWindowWithSize.
@Test
public void shouldThrowOnSessionWindowWithSize() {
// When:
final Exception e = assertThrows(KsqlException.class, () -> CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(WINDOW_TYPE_PROPERTY, new StringLiteral("SESSION")).put(WINDOW_SIZE_PROPERTY, new StringLiteral("2 MILLISECONDS")).build()));
// Then:
assertThat(e.getMessage(), containsString("'WINDOW_SIZE' should not be set for SESSION windows."));
}
use of io.confluent.ksql.execution.expression.tree.StringLiteral in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldSetValidSchemaIds.
@Test
public void shouldSetValidSchemaIds() {
// When:
final CreateSourceProperties properties = CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(KEY_SCHEMA_ID, new StringLiteral("1")).put(VALUE_SCHEMA_ID, new StringLiteral("2")).build());
// Then:
assertThat(properties.getKeySchemaId(), is(Optional.of(1)));
assertThat(properties.getValueSchemaId(), is(Optional.of(2)));
}
use of io.confluent.ksql.execution.expression.tree.StringLiteral in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldThrowOnTumblingWindowWithOutSize.
@Test
public void shouldThrowOnTumblingWindowWithOutSize() {
// When:
final Exception e = assertThrows(KsqlException.class, () -> CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(WINDOW_TYPE_PROPERTY, new StringLiteral("tumbling")).build()));
// Then:
assertThat(e.getMessage(), containsString("TUMBLING windows require 'WINDOW_SIZE' to be provided in the WITH clause. " + "For example: 'WINDOW_SIZE'='10 SECONDS'"));
}
use of io.confluent.ksql.execution.expression.tree.StringLiteral in project ksql by confluentinc.
the class CreateSourcePropertiesTest method shouldSetSessionWindow.
@Test
public void shouldSetSessionWindow() {
// When:
final CreateSourceProperties properties = CreateSourceProperties.from(ImmutableMap.<String, Literal>builder().putAll(MINIMUM_VALID_PROPS).put(CreateConfigs.WINDOW_TYPE_PROPERTY, new StringLiteral("SESSION")).build());
// Then:
assertThat(properties.getWindowType(), is(Optional.of(WindowType.SESSION)));
}
Aggregations