use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldDropMissingSource.
@Test
public void shouldDropMissingSource() {
// Given:
givenDropSourceCommand(STREAM_NAME);
// When:
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, dropSource, false, NO_QUERY_SOURCES);
// Then:
assertThat(result.isSuccess(), is(true));
assertThat(result.getMessage(), equalTo("Source " + STREAM_NAME + " does not exist."));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldAlterTable.
@Test
public void shouldAlterTable() {
// Given:
alterSource = new AlterSourceCommand(EXISTING_TABLE, DataSourceType.KTABLE.getKsqlType(), NEW_COLUMNS);
// When:
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, alterSource, false, NO_QUERY_SOURCES);
// Then:
assertThat(result.isSuccess(), is(true));
assertThat(metaStore.getSource(EXISTING_TABLE).getSchema().columns().size(), is(8));
assertThat(metaStore.getSource(EXISTING_TABLE).getSqlExpression(), is("sqlexpression\nsome ksql"));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldDropExistingType.
@Test
public void shouldDropExistingType() {
// Given:
metaStore.registerType("type", SqlTypes.STRING);
// When:
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, dropType, false, NO_QUERY_SOURCES);
// Then:
assertThat(metaStore.resolveType("type").isPresent(), is(false));
assertThat("Expected successful execution", result.isSuccess());
assertThat(result.getMessage(), is("Dropped type 'type'"));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldWarnAddDuplicateStreamWithoutReplace.
@Test
public void shouldWarnAddDuplicateStreamWithoutReplace() {
// Given:
givenCreateStream();
cmdExec.execute(SQL_TEXT, createStream, false, NO_QUERY_SOURCES);
// When:
givenCreateStream(SCHEMA2, false);
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, createStream, false, NO_QUERY_SOURCES);
// Then:
assertThat("Expected successful execution", result.isSuccess());
assertThat(result.getMessage(), containsString("A stream with the same name already exists"));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldAlterStream.
@Test
public void shouldAlterStream() {
// Given:
alterSource = new AlterSourceCommand(EXISTING_STREAM, DataSourceType.KSTREAM.getKsqlType(), NEW_COLUMNS);
// When:
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, alterSource, false, NO_QUERY_SOURCES);
// Then:
assertThat(result.isSuccess(), is(true));
assertThat(metaStore.getSource(EXISTING_STREAM).getSchema().columns().size(), is(10));
assertThat(metaStore.getSource(EXISTING_STREAM).getSqlExpression(), is("sqlexpression\nsome ksql"));
}
Aggregations