Search in sources :

Example 31 with MigrationException

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

the class CommandParserTest method shouldThrowOnInvalidInsertValues.

@Test
public void shouldThrowOnInvalidInsertValues() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> parse("insert into foo values (this_should_not_here) ('val');"));
    // Then:
    assertThat(e.getMessage(), containsString("Failed to parse INSERT VALUES statement"));
}
Also used : MigrationException(io.confluent.ksql.tools.migrations.MigrationException) Test(org.junit.Test)

Example 32 with MigrationException

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

the class CommandParserTest method shouldThrowOnMalformedComment.

@Test
public void shouldThrowOnMalformedComment() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> CommandParser.splitSql("/* Comment "));
    // 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)

Example 33 with MigrationException

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

the class CommandParserTest method shouldThrowOnShowStatement.

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

Example 34 with MigrationException

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

the class CommandParserTest method shouldThrowOnRunScriptStatement.

@Test
public void shouldThrowOnRunScriptStatement() {
    // When:
    final MigrationException e = assertThrows(MigrationException.class, () -> parse("RUN SCRIPT 'my_script.sql';"));
    // Then:
    assertThat(e.getMessage(), is("'RUN SCRIPT' statements are not supported."));
}
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