Search in sources :

Example 1 with DropConnectorEntity

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

the class ClientTest method shouldDropConnector.

@Test
public void shouldDropConnector() throws Exception {
    // Given
    final DropConnectorEntity entity = new DropConnectorEntity("drop connector;", "name");
    testEndpoints.setKsqlEndpointResponse(Collections.singletonList(entity));
    // When:
    javaClient.dropConnector("name").get();
    // Then:
    assertThat(testEndpoints.getLastSql(), is("drop connector name;"));
}
Also used : DropConnectorEntity(io.confluent.ksql.rest.entity.DropConnectorEntity) BaseApiTest(io.confluent.ksql.api.BaseApiTest) Test(org.junit.Test)

Example 2 with DropConnectorEntity

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

the class ClientTest method shouldSendSessionVariablesWithDropConnector.

@Test
public void shouldSendSessionVariablesWithDropConnector() throws Exception {
    // Given:
    javaClient.define("a", "a");
    final DropConnectorEntity entity = new DropConnectorEntity("drop connector;", "name");
    testEndpoints.setKsqlEndpointResponse(Collections.singletonList(entity));
    // When:
    javaClient.dropConnector("name").get();
    // Then:
    assertThat(testEndpoints.getLastSessionVariables(), is(new JsonObject().put("a", "a")));
}
Also used : DropConnectorEntity(io.confluent.ksql.rest.entity.DropConnectorEntity) JsonObject(io.vertx.core.json.JsonObject) BaseApiTest(io.confluent.ksql.api.BaseApiTest) Test(org.junit.Test)

Example 3 with DropConnectorEntity

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

the class ClientTest method shouldFailToDropConnectorViaExecuteStatement.

@Test
public void shouldFailToDropConnectorViaExecuteStatement() {
    // Given
    final DropConnectorEntity entity = new DropConnectorEntity("drop connector;", "name");
    testEndpoints.setKsqlEndpointResponse(Collections.singletonList(entity));
    // When
    final Exception e = assertThrows(// thrown from .get() when the future completes exceptionally
    ExecutionException.class, () -> javaClient.executeStatement("drop connector;").get());
    // Then
    assertThat(e.getCause(), instanceOf(KsqlClientException.class));
    assertThat(e.getCause().getMessage(), containsString(EXECUTE_STATEMENT_REQUEST_ACCEPTED_DOC));
    assertThat(e.getCause().getMessage(), containsString(EXECUTE_STATEMENT_USAGE_DOC));
    assertThat(e.getCause().getMessage(), containsString("Use the dropConnector() method instead"));
}
Also used : KsqlClientException(io.confluent.ksql.api.client.exception.KsqlClientException) DropConnectorEntity(io.confluent.ksql.rest.entity.DropConnectorEntity) KafkaResponseGetFailedException(io.confluent.ksql.exception.KafkaResponseGetFailedException) KsqlClientException(io.confluent.ksql.api.client.exception.KsqlClientException) KsqlApiException(io.confluent.ksql.api.server.KsqlApiException) ExecutionException(java.util.concurrent.ExecutionException) ParseFailedException(io.confluent.ksql.parser.exception.ParseFailedException) KsqlException(io.confluent.ksql.api.client.exception.KsqlException) BaseApiTest(io.confluent.ksql.api.BaseApiTest) Test(org.junit.Test)

Example 4 with DropConnectorEntity

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

the class ConsoleTest method shouldPrintDropConnector.

@Test
public void shouldPrintDropConnector() {
    // Given:
    final KsqlEntity entity = new DropConnectorEntity("statementText", "connectorName");
    // When:
    console.printKsqlEntityList(ImmutableList.of(entity));
    // Then:
    final String output = terminal.getOutputString();
    Approvals.verify(output, approvalOptions);
}
Also used : DropConnectorEntity(io.confluent.ksql.rest.entity.DropConnectorEntity) Matchers.containsString(org.hamcrest.Matchers.containsString) KsqlEntity(io.confluent.ksql.rest.entity.KsqlEntity) Test(org.junit.Test)

Aggregations

DropConnectorEntity (io.confluent.ksql.rest.entity.DropConnectorEntity)4 Test (org.junit.Test)4 BaseApiTest (io.confluent.ksql.api.BaseApiTest)3 KsqlClientException (io.confluent.ksql.api.client.exception.KsqlClientException)1 KsqlException (io.confluent.ksql.api.client.exception.KsqlException)1 KsqlApiException (io.confluent.ksql.api.server.KsqlApiException)1 KafkaResponseGetFailedException (io.confluent.ksql.exception.KafkaResponseGetFailedException)1 ParseFailedException (io.confluent.ksql.parser.exception.ParseFailedException)1 KsqlEntity (io.confluent.ksql.rest.entity.KsqlEntity)1 JsonObject (io.vertx.core.json.JsonObject)1 ExecutionException (java.util.concurrent.ExecutionException)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1