Search in sources :

Example 6 with SimpleConnectorInfo

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

the class ListConnectorsExecutorTest method shouldListInvalidConnectorWithNoInfo.

@Test
public void shouldListInvalidConnectorWithNoInfo() {
    // Given:
    when(connectClient.connectors()).thenReturn(ConnectResponse.success(ImmutableList.of("connector2"), HttpStatus.SC_OK));
    final ConfiguredStatement<ListConnectors> statement = ConfiguredStatement.of(PreparedStatement.of("", new ListConnectors(Optional.empty(), Scope.ALL)), SessionConfig.of(new KsqlConfig(ImmutableMap.of()), ImmutableMap.of()));
    // When:
    final Optional<KsqlEntity> entity = EXECUTOR.execute(statement, mock(SessionProperties.class), engine, serviceContext).getEntity();
    // Then:
    assertThat("expected response!", entity.isPresent());
    final ConnectorList connectorList = (ConnectorList) entity.get();
    assertThat(connectorList, is(new ConnectorList("", ImmutableList.of(new KsqlWarning("Could not describe connector connector2: DANGER WILL ROBINSON.")), ImmutableList.of(new SimpleConnectorInfo("connector2", ConnectorType.UNKNOWN, null, null)))));
}
Also used : SimpleConnectorInfo(io.confluent.ksql.rest.entity.SimpleConnectorInfo) KsqlConfig(io.confluent.ksql.util.KsqlConfig) KsqlWarning(io.confluent.ksql.rest.entity.KsqlWarning) ConnectorList(io.confluent.ksql.rest.entity.ConnectorList) KsqlEntity(io.confluent.ksql.rest.entity.KsqlEntity) ListConnectors(io.confluent.ksql.parser.tree.ListConnectors) Test(org.junit.Test)

Aggregations

ConnectorList (io.confluent.ksql.rest.entity.ConnectorList)6 SimpleConnectorInfo (io.confluent.ksql.rest.entity.SimpleConnectorInfo)6 Test (org.junit.Test)5 ListConnectors (io.confluent.ksql.parser.tree.ListConnectors)4 KsqlEntity (io.confluent.ksql.rest.entity.KsqlEntity)3 KsqlConfig (io.confluent.ksql.util.KsqlConfig)3 KsqlWarning (io.confluent.ksql.rest.entity.KsqlWarning)2 ConnectorInfo (org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo)2 KsqlExecutionContext (io.confluent.ksql.KsqlExecutionContext)1 BaseApiTest (io.confluent.ksql.api.BaseApiTest)1 ConnectorTypeImpl (io.confluent.ksql.api.client.impl.ConnectorTypeImpl)1 Scope (io.confluent.ksql.parser.tree.ListConnectors.Scope)1 SessionProperties (io.confluent.ksql.rest.SessionProperties)1 KsqlEntityList (io.confluent.ksql.rest.entity.KsqlEntityList)1 ConnectClient (io.confluent.ksql.services.ConnectClient)1 ConnectResponse (io.confluent.ksql.services.ConnectClient.ConnectResponse)1 ServiceContext (io.confluent.ksql.services.ServiceContext)1 ConfiguredStatement (io.confluent.ksql.statement.ConfiguredStatement)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1