use of io.confluent.ksql.rest.entity.PropertiesList.Property 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.rest.entity.PropertiesList.Property in project ksql by confluentinc.
the class ListPropertiesExecutor method execute.
public static StatementExecutorResponse execute(final ConfiguredStatement<ListProperties> statement, final SessionProperties sessionProperties, final KsqlExecutionContext executionContext, final ServiceContext serviceContext) {
final KsqlConfigResolver resolver = new KsqlConfigResolver();
final Map<String, String> engineProperties = statement.getSessionConfig().getConfig(false).getAllConfigPropsWithSecretsObfuscated();
final List<Property> mergedProperties = mergedProperties(statement);
final List<String> overwritten = mergedProperties.stream().filter(property -> !Objects.equals(engineProperties.get(property.getName()), property.getValue())).map(Property::getName).collect(Collectors.toList());
final List<String> defaultProps = mergedProperties.stream().filter(property -> resolver.resolve(property.getName(), false).map(resolved -> resolved.isDefaultValue(property.getValue())).orElse(false)).map(Property::getName).collect(Collectors.toList());
return StatementExecutorResponse.handled(Optional.of(new PropertiesList(statement.getStatementText(), mergedProperties, overwritten, defaultProps)));
}
use of io.confluent.ksql.rest.entity.PropertiesList.Property in project ksql by confluentinc.
the class PropertiesListTableBuilderTest method shouldHandleClientOverwrittenProperties.
@Test
public void shouldHandleClientOverwrittenProperties() {
// Given:
final PropertiesList propList = new PropertiesList("list properties;", ImmutableList.of(new Property(SOME_KEY, "KSQL", "earliest")), ImmutableList.of(SOME_KEY), Collections.emptyList());
// When:
final Table table = builder.buildTable(propList);
// Then:
assertThat(getRows(table), contains(row(SOME_KEY, "KSQL", "SESSION", "earliest")));
}
use of io.confluent.ksql.rest.entity.PropertiesList.Property in project ksql by confluentinc.
the class PropertiesListTableBuilderTest method shouldHandleDefaultProperties.
@Test
public void shouldHandleDefaultProperties() {
// Given:
final PropertiesList propList = new PropertiesList("list properties;", ImmutableList.of(new Property(SOME_KEY, "KSQL", "earliest")), Collections.emptyList(), ImmutableList.of(SOME_KEY));
// When:
final Table table = builder.buildTable(propList);
// Then:
assertThat(getRows(table), contains(row(SOME_KEY, "KSQL", "", "earliest")));
}
use of io.confluent.ksql.rest.entity.PropertiesList.Property in project ksql by confluentinc.
the class ConsoleTest method testPrintPropertyList.
@Test
public void testPrintPropertyList() {
// Given:
final List<Property> properties = new ArrayList<>();
properties.add(new Property("k1", "KSQL", "1"));
properties.add(new Property("k2", "KSQL", "v2"));
properties.add(new Property("k3", "KSQL", "true"));
final KsqlEntityList entityList = new KsqlEntityList(ImmutableList.of(new PropertiesList("e", properties, Collections.emptyList(), Collections.emptyList())));
// When:
console.printKsqlEntityList(entityList);
// Then:
final String output = terminal.getOutputString();
Approvals.verify(output, approvalOptions);
}
Aggregations