Search in sources :

Example 11 with MigrationException

use of io.confluent.ksql.tools.migrations.MigrationException in project ksql by confluentinc.

the class CommandParserTest method shouldThrowOnExplainStatement.

@Test
public void shouldThrowOnExplainStatement() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> parse("explain my_query_id;"));
    // Then:
    assertThat(e.getMessage(), is("'EXPLAIN' statements are not supported."));
}
Also used : MigrationException(io.confluent.ksql.tools.migrations.MigrationException) Test(org.junit.Test)

Example 12 with MigrationException

use of io.confluent.ksql.tools.migrations.MigrationException in project ksql by confluentinc.

the class CommandParserTest method shouldThrowOnSelectStatement.

@Test
public void shouldThrowOnSelectStatement() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> parse("select * from my_stream emit changes;"));
    // Then:
    assertThat(e.getMessage(), is("'SELECT' statements are not supported."));
}
Also used : MigrationException(io.confluent.ksql.tools.migrations.MigrationException) Test(org.junit.Test)

Example 13 with MigrationException

use of io.confluent.ksql.tools.migrations.MigrationException in project ksql by confluentinc.

the class CommandParserTest method shouldThrowOnListStatement.

@Test
public void shouldThrowOnListStatement() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> parse("list queries;"));
    // Then:
    assertThat(e.getMessage(), is("'LIST' statements are not supported."));
}
Also used : MigrationException(io.confluent.ksql.tools.migrations.MigrationException) Test(org.junit.Test)

Example 14 with MigrationException

use of io.confluent.ksql.tools.migrations.MigrationException in project ksql by confluentinc.

the class CommandParserTest method shouldThrowOnPrintStatement.

@Test
public void shouldThrowOnPrintStatement() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> parse("print 'my_topic';"));
    // Then:
    assertThat(e.getMessage(), is("'PRINT' statements are not supported."));
}
Also used : MigrationException(io.confluent.ksql.tools.migrations.MigrationException) Test(org.junit.Test)

Example 15 with MigrationException

use of io.confluent.ksql.tools.migrations.MigrationException in project ksql by confluentinc.

the class CommandParserTest method shouldThrowOnMalformedQuote.

@Test
public void shouldThrowOnMalformedQuote() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> CommandParser.splitSql("select 'unclosed quote;"));
    // Then:
    assertThat(e.getMessage(), is("Invalid sql - failed to find closing token '''"));
}
Also used : MigrationException(io.confluent.ksql.tools.migrations.MigrationException) Test(org.junit.Test)

Aggregations

MigrationException (io.confluent.ksql.tools.migrations.MigrationException)34 Test (org.junit.Test)11 VisibleForTesting (com.google.common.annotations.VisibleForTesting)7 Client (io.confluent.ksql.api.client.Client)7 ExecutionException (java.util.concurrent.ExecutionException)6 IOException (java.io.IOException)4 List (java.util.List)4 Optional (java.util.Optional)4 Collectors (java.util.stream.Collectors)4 BatchedQueryResult (io.confluent.ksql.api.client.BatchedQueryResult)3 Row (io.confluent.ksql.api.client.Row)3 MigrationFile (io.confluent.ksql.tools.migrations.util.MigrationFile)3 File (java.io.File)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 Matcher (java.util.regex.Matcher)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 KsqlObject (io.confluent.ksql.api.client.KsqlObject)2 ServerInfo (io.confluent.ksql.api.client.ServerInfo)2 AstBuilder (io.confluent.ksql.parser.AstBuilder)2