Search in sources :

Example 1 with KsqlSchemaRegistryNotConfiguredException

use of io.confluent.ksql.util.KsqlSchemaRegistryNotConfiguredException in project ksql by confluentinc.

the class SchemaRegisterInjectorTest method shouldNotRegisterSchemaForSchemaRegistryDisabledFormatCreateAsSelect.

@Test
public void shouldNotRegisterSchemaForSchemaRegistryDisabledFormatCreateAsSelect() {
    // Given:
    config = new KsqlConfig(ImmutableMap.of());
    givenStatement("CREATE STREAM sink WITH(value_format='DELIMITED') AS SELECT * FROM SOURCE;");
    // When:
    final KsqlSchemaRegistryNotConfiguredException e = assertThrows(KsqlSchemaRegistryNotConfiguredException.class, () -> injector.inject(statement));
    // Then:
    assertThat(e.getMessage(), containsString("Cannot create topic 'SINK' with format AVRO without configuring"));
}
Also used : KsqlConfig(io.confluent.ksql.util.KsqlConfig) KsqlSchemaRegistryNotConfiguredException(io.confluent.ksql.util.KsqlSchemaRegistryNotConfiguredException) Test(org.junit.Test)

Example 2 with KsqlSchemaRegistryNotConfiguredException

use of io.confluent.ksql.util.KsqlSchemaRegistryNotConfiguredException in project ksql by confluentinc.

the class ErrorsTest method shouldReturnSchemaRegistryNotConfiguredResponseIfRootCauseKsqlSchemaRegistryConfigException.

@Test
public void shouldReturnSchemaRegistryNotConfiguredResponseIfRootCauseKsqlSchemaRegistryConfigException() {
    final EndpointResponse response = errorHandler.generateResponse(new KsqlException(new KsqlSchemaRegistryNotConfiguredException("error")), Errors.badRequest("bad"));
    assertThat(response.getStatus(), is(428));
    assertThat(response.getEntity(), is(instanceOf(KsqlErrorMessage.class)));
    assertThat(((KsqlErrorMessage) response.getEntity()).getMessage(), is(SOME_SR_ERROR));
}
Also used : KsqlException(io.confluent.ksql.util.KsqlException) KsqlSchemaRegistryNotConfiguredException(io.confluent.ksql.util.KsqlSchemaRegistryNotConfiguredException) Test(org.junit.Test)

Example 3 with KsqlSchemaRegistryNotConfiguredException

use of io.confluent.ksql.util.KsqlSchemaRegistryNotConfiguredException in project ksql by confluentinc.

the class SchemaRegisterInjectorTest method shouldNotRegisterSchemaIfSchemaRegistryIsDisabled.

@Test
public void shouldNotRegisterSchemaIfSchemaRegistryIsDisabled() {
    // Given:
    config = new KsqlConfig(ImmutableMap.of());
    givenStatement("CREATE STREAM sink (f1 VARCHAR) WITH(kafka_topic='expectedName', key_format='AVRO', value_format='AVRO', partitions=1);");
    // When:
    final KsqlSchemaRegistryNotConfiguredException e = assertThrows(KsqlSchemaRegistryNotConfiguredException.class, () -> injector.inject(statement));
    // Then:
    assertThat(e.getMessage(), containsString("Cannot create topic 'expectedName' with format AVRO without configuring"));
}
Also used : KsqlConfig(io.confluent.ksql.util.KsqlConfig) KsqlSchemaRegistryNotConfiguredException(io.confluent.ksql.util.KsqlSchemaRegistryNotConfiguredException) Test(org.junit.Test)

Aggregations

KsqlSchemaRegistryNotConfiguredException (io.confluent.ksql.util.KsqlSchemaRegistryNotConfiguredException)3 Test (org.junit.Test)3 KsqlConfig (io.confluent.ksql.util.KsqlConfig)2 KsqlException (io.confluent.ksql.util.KsqlException)1