Search in sources :

Example 1 with Property

use of io.confluent.ksql.rest.entity.PropertiesList.Property in project ksql by confluentinc.

the class KsqlResourceTest method shouldListPropertiesWithOverrides.

@Test
public void shouldListPropertiesWithOverrides() {
    // Given:
    final Map<String, Object> overrides = Collections.singletonMap("auto.offset.reset", "latest");
    // When:
    final PropertiesList props = makeSingleRequest(new KsqlRequest("list properties;", overrides, emptyMap(), null), PropertiesList.class);
    // Then:
    assertThat(props.getProperties(), hasItem(new Property("ksql.streams.auto.offset.reset", "KSQL", "latest")));
    assertThat(props.getOverwrittenProperties(), hasItem("ksql.streams.auto.offset.reset"));
}
Also used : KsqlRequest(io.confluent.ksql.rest.entity.KsqlRequest) PropertiesList(io.confluent.ksql.rest.entity.PropertiesList) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Property(io.confluent.ksql.rest.entity.PropertiesList.Property) Test(org.junit.Test)

Example 2 with Property

use of io.confluent.ksql.rest.entity.PropertiesList.Property in project ksql by confluentinc.

the class PropertiesListTableBuilderTest method shouldHandlePropertiesWithNullValue.

@Test
public void shouldHandlePropertiesWithNullValue() {
    // Given:
    final PropertiesList propList = new PropertiesList("list properties;", Collections.singletonList(new Property(SOME_KEY, "KSQL", null)), Collections.emptyList(), ImmutableList.of(SOME_KEY));
    // When:
    final Table table = builder.buildTable(propList);
    // Then:
    assertThat(getRows(table), contains(row(SOME_KEY, "KSQL", "", "NULL")));
}
Also used : Table(io.confluent.ksql.cli.console.table.Table) PropertiesList(io.confluent.ksql.rest.entity.PropertiesList) Property(io.confluent.ksql.rest.entity.PropertiesList.Property) Test(org.junit.Test)

Example 3 with Property

use of io.confluent.ksql.rest.entity.PropertiesList.Property 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")));
}
Also used : ConfiguredStatement(io.confluent.ksql.statement.ConfiguredStatement) PropertiesList(io.confluent.ksql.rest.entity.PropertiesList) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Property(io.confluent.ksql.rest.entity.PropertiesList.Property) Test(org.junit.Test)

Example 4 with Property

use of io.confluent.ksql.rest.entity.PropertiesList.Property in project ksql by confluentinc.

the class KsqlResourceTest method shouldNotIncludeSslPropertiesInListPropertiesOutput.

@Test
public void shouldNotIncludeSslPropertiesInListPropertiesOutput() {
    // When:
    final PropertiesList props = makeSingleRequest("list properties;", PropertiesList.class);
    // Then:
    assertThat(props.getProperties().stream().map(Property::getName).collect(Collectors.toList()), not(hasItems(KsqlConfig.SSL_CONFIG_NAMES.toArray(new String[0]))));
}
Also used : PropertiesList(io.confluent.ksql.rest.entity.PropertiesList) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Property(io.confluent.ksql.rest.entity.PropertiesList.Property) Test(org.junit.Test)

Example 5 with Property

use of io.confluent.ksql.rest.entity.PropertiesList.Property in project ksql by confluentinc.

the class ListPropertiesExecutorTest method shouldNotListUnrecognizedConnectProps.

@Test
public void shouldNotListUnrecognizedConnectProps() throws Exception {
    // Given:
    givenConnectWorkerProperties("group.id=list_properties_unit_test\n" + "key.converter=io.confluent.connect.avro.AvroConverter\n" + "value.converter=io.confluent.connect.avro.AvroConverter\n" + "offset.storage.topic=topic1\n" + "config.storage.topic=topic2\n" + "status.storage.topic=topic3\n" + "other.config=<potentially sensitive data that should not be shown>\n" + "sasl.jaas.config=<potentially sensitive data that should not be shown even though it's a recognized config>\n");
    // When:
    final PropertiesList properties = (PropertiesList) CUSTOM_EXECUTORS.listProperties().execute((ConfiguredStatement<ListProperties>) engine.configure("LIST PROPERTIES;").withConfig(new KsqlConfig(ImmutableMap.of("ksql.connect.worker.config", connectPropsFile))), mock(SessionProperties.class), engine.getEngine(), engine.getServiceContext()).getEntity().orElseThrow(IllegalStateException::new);
    // Then:
    assertThat(properties.getProperties(), hasItem(new Property("ksql.connect.worker.config", "KSQL", connectPropsFile)));
    assertThat(properties.getProperties(), hasItem(new Property("value.converter", "EMBEDDED CONNECT WORKER", "io.confluent.connect.avro.AvroConverter")));
    assertThat(toMap(properties), not(hasKey("other.config")));
    assertThat(toMap(properties), not(hasKey("sasl.jaas.config")));
}
Also used : ConfiguredStatement(io.confluent.ksql.statement.ConfiguredStatement) PropertiesList(io.confluent.ksql.rest.entity.PropertiesList) KsqlConfig(io.confluent.ksql.util.KsqlConfig) Property(io.confluent.ksql.rest.entity.PropertiesList.Property) Test(org.junit.Test)

Aggregations

PropertiesList (io.confluent.ksql.rest.entity.PropertiesList)11 Property (io.confluent.ksql.rest.entity.PropertiesList.Property)11 Test (org.junit.Test)10 Table (io.confluent.ksql.cli.console.table.Table)4 ConfiguredStatement (io.confluent.ksql.statement.ConfiguredStatement)3 KsqlConfig (io.confluent.ksql.util.KsqlConfig)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 KsqlConfigResolver (io.confluent.ksql.config.KsqlConfigResolver)1 KsqlEntityList (io.confluent.ksql.rest.entity.KsqlEntityList)1 KsqlRequest (io.confluent.ksql.rest.entity.KsqlRequest)1 ArrayList (java.util.ArrayList)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1