use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListPropertiesExecutorTest method shouldListProperties.
@Test
public void shouldListProperties() {
// When:
final PropertiesList properties = (PropertiesList) CUSTOM_EXECUTORS.listProperties().execute((ConfiguredStatement<ListProperties>) engine.configure("LIST PROPERTIES;"), mock(SessionProperties.class), engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(toStringMap(properties), equalTo(engine.getKsqlConfig().getAllConfigPropsWithSecretsObfuscated()));
assertThat(properties.getOverwrittenProperties(), is(empty()));
}
use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListPropertiesExecutorTest method shouldListUnresolvedStreamsTopicProperties.
@Test
public void shouldListUnresolvedStreamsTopicProperties() {
// When:
final PropertiesList properties = (PropertiesList) CUSTOM_EXECUTORS.listProperties().execute((ConfiguredStatement<ListProperties>) engine.configure("LIST PROPERTIES;").withConfig(new KsqlConfig(ImmutableMap.of("ksql.streams.topic.min.insync.replicas", "2"))), mock(SessionProperties.class), engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(properties.getProperties(), hasItem(new Property("ksql.streams.topic.min.insync.replicas", "KSQL", "2")));
}
use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListSourceExecutorTest method shouldShowStreams.
@Test
public void shouldShowStreams() {
// Given:
final KsqlStream<?> stream1 = engine.givenSource(DataSourceType.KSTREAM, "stream1");
final KsqlStream<?> stream2 = engine.givenSource(DataSourceType.KSTREAM, "stream2");
engine.givenSource(DataSourceType.KTABLE, "table");
// When:
final StreamsList descriptionList = (StreamsList) CUSTOM_EXECUTORS.listStreams().execute((ConfiguredStatement<ListStreams>) engine.configure("SHOW STREAMS;"), SESSION_PROPERTIES, engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(descriptionList.getStreams(), containsInAnyOrder(new SourceInfo.Stream(stream1.getName().toString(FormatOptions.noEscape()), stream1.getKafkaTopicName(), stream1.getKsqlTopic().getKeyFormat().getFormat(), stream1.getKsqlTopic().getValueFormat().getFormat(), stream1.getKsqlTopic().getKeyFormat().isWindowed()), new SourceInfo.Stream(stream2.getName().toString(FormatOptions.noEscape()), stream2.getKafkaTopicName(), stream2.getKsqlTopic().getKeyFormat().getFormat(), stream2.getKsqlTopic().getValueFormat().getFormat(), stream1.getKsqlTopic().getKeyFormat().isWindowed())));
}
use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListSourceExecutorTest method shouldDescribeTables.
@Test
public void shouldDescribeTables() {
// Given:
final KsqlTable<?> table1 = engine.givenSource(DataSourceType.KTABLE, "table1");
final KsqlTable<?> table2 = engine.givenSource(DataSourceType.KTABLE, "table2", ImmutableSet.of(SourceName.of("table1")));
engine.givenSource(DataSourceType.KSTREAM, "stream");
// When:
final SourceDescriptionList descriptionList = (SourceDescriptionList) CUSTOM_EXECUTORS.describeTables().execute((ConfiguredStatement<DescribeTables>) engine.configure("DESCRIBE TABLES;"), SESSION_PROPERTIES, engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(table1, false, ImmutableList.of(), ImmutableList.of(), Optional.of(topicWith1PartitionAndRfOf1), ImmutableList.of(), ImmutableList.of("table2"), new MetricCollectors()), SourceDescriptionFactory.create(table2, false, ImmutableList.of(), ImmutableList.of(), Optional.of(topicWith1PartitionAndRfOf1), ImmutableList.of(), ImmutableList.of(), new MetricCollectors())));
}
use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListSourceExecutorTest method shouldThrowOnDescribeMissingSource.
@Test
public void shouldThrowOnDescribeMissingSource() {
// When:
final Exception e = assertThrows(KsqlStatementException.class, () -> CUSTOM_EXECUTORS.showColumns().execute((ConfiguredStatement<ShowColumns>) engine.configure("DESCRIBE S;"), SESSION_PROPERTIES, engine.getEngine(), engine.getServiceContext()));
// Then:
assertThat(e.getMessage(), containsString("Could not find STREAM/TABLE 'S' in the Metastore"));
}
Aggregations