use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldDropSource.
@Test
public void shouldDropSource() {
// Given:
metaStore.putSource(source, false);
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(String.format("Source %s (topic: %s) was dropped.", STREAM_NAME, TOPIC_NAME)));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldWarnAddDuplicateTableWithoutReplace.
@Test
public void shouldWarnAddDuplicateTableWithoutReplace() {
// Given:
givenCreateTable();
cmdExec.execute(SQL_TEXT, createTable, false, NO_QUERY_SOURCES);
// When:
givenCreateTable();
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, createTable, false, NO_QUERY_SOURCES);
// Then:
assertThat("Expected successful execution", result.isSuccess());
assertThat(result.getMessage(), containsString("A table with the same name already exists"));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldRegisterType.
@Test
public void shouldRegisterType() {
// When:
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, registerType, false, NO_QUERY_SOURCES);
// Then:
assertThat("Expected successful resolution", result.isSuccess());
assertThat(result.getMessage(), is("Registered custom type with name 'type' and SQL type " + type));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldDropStreamIfConstraintExistsAndRestoreIsInProgress.
@Test
public void shouldDropStreamIfConstraintExistsAndRestoreIsInProgress() {
// Given:
final CreateStreamCommand stream1 = buildCreateStream(SourceName.of("s1"), SCHEMA, false, false);
final CreateStreamCommand stream2 = buildCreateStream(SourceName.of("s2"), SCHEMA, false, false);
final CreateStreamCommand stream3 = buildCreateStream(SourceName.of("s3"), SCHEMA, false, false);
cmdExec.execute(SQL_TEXT, stream1, true, Collections.emptySet());
cmdExec.execute(SQL_TEXT, stream2, true, Collections.singleton(SourceName.of("s1")));
cmdExec.execute(SQL_TEXT, stream3, true, Collections.singleton(SourceName.of("s1")));
// When:
final DropSourceCommand dropStream = buildDropSourceCommand(SourceName.of("s1"));
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, dropStream, false, Collections.emptySet(), true);
// Then
assertThat(result.isSuccess(), is(true));
assertThat(result.getMessage(), equalTo(String.format("Source %s (topic: %s) was dropped.", STREAM_NAME, TOPIC_NAME)));
}
use of io.confluent.ksql.execution.ddl.commands.DdlCommandResult in project ksql by confluentinc.
the class DdlCommandExecTest method shouldNotRegisterExistingType.
@Test
public void shouldNotRegisterExistingType() {
// Given:
metaStore.registerType("type", SqlTypes.STRING);
// When:
final DdlCommandResult result = cmdExec.execute(SQL_TEXT, registerType, false, NO_QUERY_SOURCES);
// Then:
assertThat("Expected successful resolution", result.isSuccess());
assertThat(result.getMessage(), is("type is already registered with type STRING"));
}
Aggregations