use of io.confluent.ksql.api.client.ExecuteStatementResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldOnlyWarnForDuplicateIfNotExists.
@Test
public void shouldOnlyWarnForDuplicateIfNotExists() throws Exception {
// When
ExecuteStatementResult result;
client.executeStatement("CREATE STREAM FOO (id INT KEY, bar VARCHAR) WITH(value_format='json', kafka_topic='foo', partitions=6);").get();
client.executeStatement("CREATE STREAM IF NOT EXISTS BAR AS SELECT * FROM FOO EMIT CHANGES;").get();
result = client.executeStatement("CREATE STREAM IF NOT EXISTS BAR AS SELECT * FROM FOO EMIT CHANGES;").get();
// Then
assertThat(result.queryId(), is(Optional.empty()));
}
use of io.confluent.ksql.api.client.ExecuteStatementResult in project ksql by confluentinc.
the class ClientMutationIntegrationTest method shouldExecuteDdlDmlStatements.
@Test
public void shouldExecuteDdlDmlStatements() throws Exception {
// Given
final String streamName = TEST_STREAM + "_COPY";
final String csas = "create stream " + streamName + " as select * from " + TEST_STREAM + " emit changes;";
final int numInitialStreams = 3;
final int numInitialQueries = 1;
verifyNumStreams(numInitialStreams);
verifyNumQueries(numInitialQueries);
// When: create stream, start persistent query
final ExecuteStatementResult csasResult = client.executeStatement(csas).get();
// Then
verifyNumStreams(numInitialStreams + 1);
verifyNumQueries(numInitialQueries + 1);
assertThat(csasResult.queryId(), is(Optional.of(findQueryIdForSink(streamName))));
// When: terminate persistent query
final String queryId = csasResult.queryId().get();
final ExecuteStatementResult terminateResult = client.executeStatement("terminate " + queryId + ";").get();
// Then
verifyNumQueries(numInitialQueries);
assertThat(terminateResult.queryId(), is(Optional.empty()));
// When: drop stream
final ExecuteStatementResult dropStreamResult = client.executeStatement("drop stream " + streamName + ";").get();
// Then
verifyNumStreams(numInitialStreams);
assertThat(dropStreamResult.queryId(), is(Optional.empty()));
}
Aggregations