Search in sources :

Example 1 with DropTypeCommand

use of io.confluent.ksql.execution.ddl.commands.DropTypeCommand in project ksql by confluentinc.

the class DropTypeFactoryTest method shouldCreateDropType.

@Test
public void shouldCreateDropType() {
    // Given:
    final DropType dropType = new DropType(Optional.empty(), EXISTING_TYPE, false);
    // When:
    final DropTypeCommand cmd = factory.create(dropType);
    // Then:
    assertThat(cmd.getTypeName(), equalTo(EXISTING_TYPE));
}
Also used : DropTypeCommand(io.confluent.ksql.execution.ddl.commands.DropTypeCommand) DropType(io.confluent.ksql.parser.DropType) Test(org.junit.Test)

Example 2 with DropTypeCommand

use of io.confluent.ksql.execution.ddl.commands.DropTypeCommand in project ksql by confluentinc.

the class DropTypeFactoryTest method shouldCreateDropTypeForExistingTypeAndIfExistsSet.

@Test
public void shouldCreateDropTypeForExistingTypeAndIfExistsSet() {
    // Given:
    final DropType dropType = new DropType(Optional.empty(), EXISTING_TYPE, true);
    // When:
    final DropTypeCommand cmd = factory.create(dropType);
    // Then:
    assertThat(cmd.getTypeName(), equalTo(EXISTING_TYPE));
}
Also used : DropTypeCommand(io.confluent.ksql.execution.ddl.commands.DropTypeCommand) DropType(io.confluent.ksql.parser.DropType) Test(org.junit.Test)

Example 3 with DropTypeCommand

use of io.confluent.ksql.execution.ddl.commands.DropTypeCommand in project ksql by confluentinc.

the class CommandFactoriesTest method shouldCreateDropType.

@Test
public void shouldCreateDropType() {
    // Given:
    final DropType dropType = new DropType(Optional.empty(), SOME_TYPE_NAME, false);
    // When:
    final DropTypeCommand cmd = (DropTypeCommand) commandFactories.create("sqlExpression", dropType, SessionConfig.of(ksqlConfig, emptyMap()));
    // Then:
    assertThat(cmd, is(dropTypeCommand));
    verify(dropTypeFactory).create(dropType);
}
Also used : DropTypeCommand(io.confluent.ksql.execution.ddl.commands.DropTypeCommand) DropType(io.confluent.ksql.parser.DropType) Test(org.junit.Test)

Example 4 with DropTypeCommand

use of io.confluent.ksql.execution.ddl.commands.DropTypeCommand in project ksql by confluentinc.

the class DdlCommandExecTest method setup.

@Before
public void setup() {
    when(source.getName()).thenReturn(STREAM_NAME);
    when(source.getDataSourceType()).thenReturn(DataSourceType.KSTREAM);
    when(source.getKafkaTopicName()).thenReturn(TOPIC_NAME);
    cmdExec = new DdlCommandExec(metaStore);
    dropType = new DropTypeCommand("type");
    registerType = new RegisterTypeCommand(type, "type");
}
Also used : DropTypeCommand(io.confluent.ksql.execution.ddl.commands.DropTypeCommand) RegisterTypeCommand(io.confluent.ksql.execution.ddl.commands.RegisterTypeCommand) Before(org.junit.Before)

Example 5 with DropTypeCommand

use of io.confluent.ksql.execution.ddl.commands.DropTypeCommand in project ksql by confluentinc.

the class DropTypeFactoryTest method shouldNotFailCreateTypeIfTypeDoesNotExistAndIfExistsSet.

@Test
public void shouldNotFailCreateTypeIfTypeDoesNotExistAndIfExistsSet() {
    // Given:
    final DropType dropType = new DropType(Optional.empty(), NOT_EXISTING_TYPE, true);
    // When:
    final DropTypeCommand cmd = factory.create(dropType);
    // Then:
    assertThat(cmd.getTypeName(), equalTo(NOT_EXISTING_TYPE));
}
Also used : DropTypeCommand(io.confluent.ksql.execution.ddl.commands.DropTypeCommand) DropType(io.confluent.ksql.parser.DropType) Test(org.junit.Test)

Aggregations

DropTypeCommand (io.confluent.ksql.execution.ddl.commands.DropTypeCommand)5 DropType (io.confluent.ksql.parser.DropType)4 Test (org.junit.Test)4 RegisterTypeCommand (io.confluent.ksql.execution.ddl.commands.RegisterTypeCommand)1 Before (org.junit.Before)1