use of io.confluent.ksql.execution.ddl.commands.DdlCommand in project ksql by confluentinc.
the class CommandFactoriesTest method shouldCreateTableCommandWithSingleValueWrappingFromOverridesNotConfig.
@Test
public void shouldCreateTableCommandWithSingleValueWrappingFromOverridesNotConfig() {
// Given:
givenCommandFactories();
ksqlConfig = new KsqlConfig(ImmutableMap.of(KsqlConfig.KSQL_WRAP_SINGLE_VALUES, true));
final ImmutableMap<String, Object> overrides = ImmutableMap.of(KsqlConfig.KSQL_WRAP_SINGLE_VALUES, false);
final DdlStatement statement = new CreateTable(SOME_NAME, ELEMENTS_WITH_PK, false, true, withProperties, false);
// When:
final DdlCommand cmd = commandFactories.create(sqlExpression, statement, SessionConfig.of(ksqlConfig, overrides));
// Then:
assertThat(cmd, is(instanceOf(CreateTableCommand.class)));
assertThat(((CreateTableCommand) cmd).getFormats().getValueFeatures().all(), contains(SerdeFeature.UNWRAP_SINGLES));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommand in project ksql by confluentinc.
the class CommandFactoriesTest method shouldCreateCommandForCreateTable.
@Test
public void shouldCreateCommandForCreateTable() {
// Given:
final CreateTable statement = new CreateTable(SOME_NAME, TableElements.of(tableElement("COL1", new Type(SqlTypes.BIGINT)), tableElement("COL2", new Type(SqlTypes.STRING))), false, true, withProperties, false);
// When:
final DdlCommand result = commandFactories.create(sqlExpression, statement, SessionConfig.of(ksqlConfig, emptyMap()));
// Then:
assertThat(result, is(createTableCommand));
verify(createSourceFactory).createTableCommand(statement, ksqlConfig);
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommand in project ksql by confluentinc.
the class CommandFactoriesTest method shouldCreateCommandForDropTable.
@Test
public void shouldCreateCommandForDropTable() {
// Given:
final DropTable ddlStatement = new DropTable(TABLE_NAME, true, true);
// When:
final DdlCommand result = commandFactories.create(sqlExpression, ddlStatement, SessionConfig.of(ksqlConfig, emptyMap()));
// Then:
assertThat(result, is(dropSourceCommand));
verify(dropSourceFactory).create(ddlStatement);
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommand in project ksql by confluentinc.
the class CommandFactoriesTest method shouldCreateCommandForCreateStream.
@Test
public void shouldCreateCommandForCreateStream() {
// Given:
final CreateStream statement = new CreateStream(SOME_NAME, SOME_ELEMENTS, false, true, withProperties, false);
// When:
final DdlCommand result = commandFactories.create(sqlExpression, statement, SessionConfig.of(ksqlConfig, emptyMap()));
assertThat(result, is(createStreamCommand));
verify(createSourceFactory).createStreamCommand(statement, ksqlConfig);
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommand in project ksql by confluentinc.
the class DropSourceFactoryTest method shouldCreateCommandForDropTable.
@Test
public void shouldCreateCommandForDropTable() {
// Given:
final DropTable ddlStatement = new DropTable(TABLE_NAME, true, true);
// When:
final DdlCommand result = dropSourceFactory.create(ddlStatement);
// Then:
assertThat(result, instanceOf(DropSourceCommand.class));
}
Aggregations