use of org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo.ConnectorState in project ksql by confluentinc.
the class ClientTest method shouldSendSessionVariablesWithDescribeConnector.
@Test
public void shouldSendSessionVariablesWithDescribeConnector() throws Exception {
// Given:
javaClient.define("a", "a");
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:
javaClient.describeConnector("name").get();
// Then:
assertThat(testEndpoints.getLastSessionVariables(), is(new JsonObject().put("a", "a")));
}
use of org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo.ConnectorState in project ksql by confluentinc.
the class ClientTest method shouldFailToDescribeConnectorViaExecuteStatement.
@Test
public void shouldFailToDescribeConnectorViaExecuteStatement() {
// 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 Exception e = assertThrows(// thrown from .get() when the future completes exceptionally
ExecutionException.class, () -> javaClient.executeStatement("describe connector;").get());
// Then
assertThat(e.getCause(), instanceOf(KsqlClientException.class));
assertThat(e.getCause().getMessage(), containsString(EXECUTE_STATEMENT_USAGE_DOC));
assertThat(e.getCause().getMessage(), containsString("Use the describeConnector() method instead"));
}
use of org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo.ConnectorState in project ksql by confluentinc.
the class ConsoleTest method testPrintConnectorDescription.
@Test
public void testPrintConnectorDescription() {
// Given:
final KsqlEntityList entityList = new KsqlEntityList(ImmutableList.of(new ConnectorDescription("STATEMENT", "io.confluent.Connector", new ConnectorStateInfo("name", new ConnectorState("state", "worker", "msg"), ImmutableList.of(new TaskState(0, "task", "worker", "task_msg")), ConnectorType.SOURCE), ImmutableList.of(sourceDescription), ImmutableList.of("a-jdbc-topic"), ImmutableList.of())));
// When:
console.printKsqlEntityList(entityList);
// Then:
final String output = terminal.getOutputString();
Approvals.verify(output, approvalOptions);
}
use of org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo.ConnectorState 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"));
}
Aggregations