use of io.confluent.ksql.tools.migrations.util.CommandParser.SqlDefineVariableCommand in project ksql by confluentinc.
the class CommandParserTest method shouldDefineStatementWithVariable.
@Test
public void shouldDefineStatementWithVariable() {
// Given:
final String defineVar = "DEFiNe word = 'walk${suffix}';";
// When:
List<SqlCommand> commands = parse(defineVar, ImmutableMap.of("suffix", "ing"));
// Then:
assertThat(commands.size(), is(1));
assertThat(commands.get(0), instanceOf(SqlDefineVariableCommand.class));
assertThat(((SqlDefineVariableCommand) commands.get(0)).getVariable(), is("word"));
assertThat(((SqlDefineVariableCommand) commands.get(0)).getValue(), is("walking"));
}
use of io.confluent.ksql.tools.migrations.util.CommandParser.SqlDefineVariableCommand in project ksql by confluentinc.
the class CommandParserTest method shouldParseDefineStatement.
@Test
public void shouldParseDefineStatement() {
// Given:
final String defineVar = "DEFINE var = 'foo';";
// When:
List<SqlCommand> commands = parse(defineVar);
// Then:
assertThat(commands.size(), is(1));
assertThat(commands.get(0).getCommand(), is(defineVar));
assertThat(commands.get(0), instanceOf(SqlDefineVariableCommand.class));
assertThat(((SqlDefineVariableCommand) commands.get(0)).getVariable(), is("var"));
assertThat(((SqlDefineVariableCommand) commands.get(0)).getValue(), is("foo"));
}
Aggregations