Search in sources :

Example 1 with ListConnectorPlugins

use of io.confluent.ksql.parser.tree.ListConnectorPlugins in project ksql by confluentinc.

the class SqlFormatterTest method shouldFormatShowConnectorPlugins.

@Test
public void shouldFormatShowConnectorPlugins() {
    // Given:
    final ListConnectorPlugins listConnectorPlugins = new ListConnectorPlugins(Optional.empty());
    // When:
    final String formatted = SqlFormatter.formatSql(listConnectorPlugins);
    // Then:
    assertThat(formatted, is("SHOW CONNECTOR PLUGINS"));
}
Also used : ListConnectorPlugins(io.confluent.ksql.parser.tree.ListConnectorPlugins) StringContains.containsString(org.hamcrest.core.StringContains.containsString) Test(org.junit.Test)

Example 2 with ListConnectorPlugins

use of io.confluent.ksql.parser.tree.ListConnectorPlugins in project ksql by confluentinc.

the class ListConnectorPluginsTest method shouldListValidConnectorPlugins.

@Test
public void shouldListValidConnectorPlugins() {
    // Given:
    when(connectClient.connectorPlugins()).thenReturn(ConnectClient.ConnectResponse.success(ImmutableList.of(INFO), HttpStatus.SC_OK));
    final KsqlConfig ksqlConfig = new KsqlConfig(ImmutableMap.of());
    final ConfiguredStatement<ListConnectorPlugins> statement = ConfiguredStatement.of(KsqlParser.PreparedStatement.of("", new ListConnectorPlugins(Optional.empty())), SessionConfig.of(ksqlConfig, ImmutableMap.of()));
    // When:
    final Optional<KsqlEntity> entity = EXECUTOR.execute(statement, mock(SessionProperties.class), engine, serviceContext).getEntity();
    // Then:
    assertThat("expected response!", entity.isPresent());
    final ConnectorPluginsList connectorPluginsList = (ConnectorPluginsList) entity.get();
    assertThat(connectorPluginsList, is(new ConnectorPluginsList("", ImmutableList.of(), ImmutableList.of(new SimpleConnectorPluginInfo("org.apache.kafka.connect.file.FileStreamSinkConnector", ConnectorType.SOURCE, "2.1")))));
}
Also used : SimpleConnectorPluginInfo(io.confluent.ksql.rest.entity.SimpleConnectorPluginInfo) KsqlConfig(io.confluent.ksql.util.KsqlConfig) ListConnectorPlugins(io.confluent.ksql.parser.tree.ListConnectorPlugins) ConnectorPluginsList(io.confluent.ksql.rest.entity.ConnectorPluginsList) KsqlEntity(io.confluent.ksql.rest.entity.KsqlEntity) Test(org.junit.Test)

Aggregations

ListConnectorPlugins (io.confluent.ksql.parser.tree.ListConnectorPlugins)2 Test (org.junit.Test)2 ConnectorPluginsList (io.confluent.ksql.rest.entity.ConnectorPluginsList)1 KsqlEntity (io.confluent.ksql.rest.entity.KsqlEntity)1 SimpleConnectorPluginInfo (io.confluent.ksql.rest.entity.SimpleConnectorPluginInfo)1 KsqlConfig (io.confluent.ksql.util.KsqlConfig)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1