Search in sources :

Example 1 with ConnectorTypeImpl

use of io.confluent.ksql.api.client.impl.ConnectorTypeImpl in project ksql by confluentinc.

the class ClientTest method shouldListConnectors.

@Test
public void shouldListConnectors() throws Exception {
    // Given:
    final ConnectorList entity = new ConnectorList("list connectors;", Collections.emptyList(), Collections.singletonList(new SimpleConnectorInfo("name", SOURCE_TYPE, "class", "state")));
    testEndpoints.setKsqlEndpointResponse(Collections.singletonList(entity));
    // When:
    final List<io.confluent.ksql.api.client.ConnectorInfo> connectors = javaClient.listConnectors().get();
    // Then:
    assertThat(connectors.size(), is(1));
    assertThat(connectors.get(0).state(), is("state"));
    assertThat(connectors.get(0).name(), is("name"));
    assertThat(connectors.get(0).type(), is(new ConnectorTypeImpl("SOURCE")));
}
Also used : SimpleConnectorInfo(io.confluent.ksql.rest.entity.SimpleConnectorInfo) ConnectorTypeImpl(io.confluent.ksql.api.client.impl.ConnectorTypeImpl) ConnectorInfo(org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo) SimpleConnectorInfo(io.confluent.ksql.rest.entity.SimpleConnectorInfo) ConnectorList(io.confluent.ksql.rest.entity.ConnectorList) BaseApiTest(io.confluent.ksql.api.BaseApiTest) Test(org.junit.Test)

Example 2 with ConnectorTypeImpl

use of io.confluent.ksql.api.client.impl.ConnectorTypeImpl in project ksql by confluentinc.

the class ClientTest method shouldDescribeConnector.

@Test
public void shouldDescribeConnector() throws Exception {
    // Given:
    final ConnectorDescription entity = new ConnectorDescription("describe connector;", "connectorClass", new ConnectorStateInfo("name", new ConnectorState("state", "worker", "msg"), Collections.emptyList(), SOURCE_TYPE), Collections.emptyList(), Collections.singletonList("topic"), Collections.emptyList());
    testEndpoints.setKsqlEndpointResponse(Collections.singletonList(entity));
    // When:
    final io.confluent.ksql.api.client.ConnectorDescription connector = javaClient.describeConnector("name").get();
    // Then:
    assertThat(connector.state(), is("state"));
    assertThat(connector.className(), is("connectorClass"));
    assertThat(connector.type(), is(new ConnectorTypeImpl("SOURCE")));
    assertThat(connector.sources().size(), is(0));
    assertThat(connector.topics().size(), is(1));
    assertThat(connector.topics().get(0), is("topic"));
}
Also used : ConnectorTypeImpl(io.confluent.ksql.api.client.impl.ConnectorTypeImpl) ConnectorState(org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo.ConnectorState) ConnectorDescription(io.confluent.ksql.rest.entity.ConnectorDescription) ConnectorStateInfo(org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo) BaseApiTest(io.confluent.ksql.api.BaseApiTest) Test(org.junit.Test)

Aggregations

BaseApiTest (io.confluent.ksql.api.BaseApiTest)2 ConnectorTypeImpl (io.confluent.ksql.api.client.impl.ConnectorTypeImpl)2 Test (org.junit.Test)2 ConnectorDescription (io.confluent.ksql.rest.entity.ConnectorDescription)1 ConnectorList (io.confluent.ksql.rest.entity.ConnectorList)1 SimpleConnectorInfo (io.confluent.ksql.rest.entity.SimpleConnectorInfo)1 ConnectorInfo (org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo)1 ConnectorStateInfo (org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo)1 ConnectorState (org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo.ConnectorState)1