use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListPropertiesExecutorTest method shouldNotListSslProperties.
@Test
public void shouldNotListSslProperties() {
// 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(toMap(properties), not(hasKey(isIn(KsqlConfig.SSL_CONFIG_NAMES))));
}
use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListPropertiesExecutorTest method shouldListPropertiesWithOverrides.
@Test
public void shouldListPropertiesWithOverrides() {
// When:
final PropertiesList properties = (PropertiesList) CUSTOM_EXECUTORS.listProperties().execute((ConfiguredStatement<ListProperties>) engine.configure("LIST PROPERTIES;").withConfigOverrides(ImmutableMap.of("ksql.streams.auto.offset.reset", "latest")), mock(SessionProperties.class), engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(properties.getProperties(), hasItem(new Property("ksql.streams.auto.offset.reset", "KSQL", "latest")));
assertThat(properties.getOverwrittenProperties(), hasItem("ksql.streams.auto.offset.reset"));
}
use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListSourceExecutorTest method shouldShowTables.
@Test
public void shouldShowTables() {
// Given:
final KsqlTable<?> table1 = engine.givenSource(DataSourceType.KTABLE, "table1");
final KsqlTable<?> table2 = engine.givenSource(DataSourceType.KTABLE, "table2");
engine.givenSource(DataSourceType.KSTREAM, "stream");
// When:
final TablesList descriptionList = (TablesList) CUSTOM_EXECUTORS.listTables().execute((ConfiguredStatement<ListTables>) engine.configure("LIST TABLES;"), SESSION_PROPERTIES, engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(descriptionList.getTables(), containsInAnyOrder(new SourceInfo.Table(table1.getName().toString(FormatOptions.noEscape()), table1.getKsqlTopic().getKafkaTopicName(), table2.getKsqlTopic().getKeyFormat().getFormat(), table1.getKsqlTopic().getValueFormat().getFormat(), table1.getKsqlTopic().getKeyFormat().isWindowed()), new SourceInfo.Table(table2.getName().toString(FormatOptions.noEscape()), table2.getKsqlTopic().getKafkaTopicName(), table2.getKsqlTopic().getKeyFormat().getFormat(), table2.getKsqlTopic().getValueFormat().getFormat(), table2.getKsqlTopic().getKeyFormat().isWindowed())));
}
use of io.confluent.ksql.statement.ConfiguredStatement in project ksql by confluentinc.
the class ListSourceExecutorTest method shouldDescribeStreams.
@Test
public void shouldDescribeStreams() {
// Given:
final KsqlStream<?> stream1 = engine.givenSource(DataSourceType.KSTREAM, "stream1");
final KsqlStream<?> stream2 = engine.givenSource(DataSourceType.KSTREAM, "stream2", ImmutableSet.of(SourceName.of("stream1")));
engine.givenSource(DataSourceType.KTABLE, "table");
// When:
final SourceDescriptionList descriptionList = (SourceDescriptionList) CUSTOM_EXECUTORS.describeStreams().execute((ConfiguredStatement<DescribeStreams>) engine.configure("DESCRIBE STREAMS;"), SESSION_PROPERTIES, engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(stream1, false, ImmutableList.of(), ImmutableList.of(), Optional.of(topicWith1PartitionAndRfOf1), ImmutableList.of(), ImmutableList.of("stream2"), new MetricCollectors()), SourceDescriptionFactory.create(stream2, 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 shouldShowStreamsExtended.
@Test
public void shouldShowStreamsExtended() {
// Given:
final KsqlStream<?> stream1 = engine.givenSource(DataSourceType.KSTREAM, "stream1");
final KsqlStream<?> stream2 = engine.givenSource(DataSourceType.KSTREAM, "stream2", ImmutableSet.of(SourceName.of("stream1")));
engine.givenSource(DataSourceType.KTABLE, "table");
// When:
final SourceDescriptionList descriptionList = (SourceDescriptionList) CUSTOM_EXECUTORS.listStreams().execute((ConfiguredStatement<ListStreams>) engine.configure("SHOW STREAMS EXTENDED;"), SESSION_PROPERTIES, engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
// Then:
assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(stream1, true, ImmutableList.of(), ImmutableList.of(), Optional.of(topicWith1PartitionAndRfOf1), ImmutableList.of(), ImmutableList.of("stream2"), new MetricCollectors()), SourceDescriptionFactory.create(stream2, true, ImmutableList.of(), ImmutableList.of(), Optional.of(topicWith1PartitionAndRfOf1), ImmutableList.of(), ImmutableList.of(), new MetricCollectors())));
}
Aggregations