use of io.confluent.ksql.api.client.StreamedQueryResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldStreamPullQueryOnTableAsync.
@Test
public void shouldStreamPullQueryOnTableAsync() throws Exception {
// When
final StreamedQueryResult streamedQueryResult = client.streamQuery(PULL_QUERY_ON_TABLE).get();
// Then
assertThat(streamedQueryResult.columnNames(), is(PULL_QUERY_COLUMN_NAMES));
assertThat(streamedQueryResult.columnTypes(), is(PULL_QUERY_COLUMN_TYPES));
assertThat(streamedQueryResult.queryID(), is(notNullValue()));
shouldReceiveRows(streamedQueryResult, 1, ClientIntegrationTest::verifyPullQueryRows, true);
assertThatEventually(streamedQueryResult::isComplete, is(true));
}
use of io.confluent.ksql.api.client.StreamedQueryResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldStreamPushQueryWithLimitAsync.
@Test
public void shouldStreamPushQueryWithLimitAsync() throws Exception {
// When
final StreamedQueryResult streamedQueryResult = client.streamQuery(PUSH_QUERY_WITH_LIMIT).get();
// Then
assertThat(streamedQueryResult.columnNames(), is(TEST_COLUMN_NAMES));
assertThat(streamedQueryResult.columnTypes(), is(TEST_COLUMN_TYPES));
assertThat(streamedQueryResult.queryID(), is(notNullValue()));
shouldReceiveStreamRows(streamedQueryResult, true, PUSH_QUERY_LIMIT_NUM_ROWS);
assertThat(streamedQueryResult.isComplete(), is(true));
}
use of io.confluent.ksql.api.client.StreamedQueryResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldStreamPullQueryOnTruncatedStreamSync.
@Test
public void shouldStreamPullQueryOnTruncatedStreamSync() throws Exception {
// double-check to make sure it's really truncated
truncateTopic(TRUNCATED_TEST_TOPIC);
// When
final StreamedQueryResult streamedQueryResult = client.streamQuery("SELECT * FROM " + TRUNCATED_TEST_STREAM + ";").get();
// Then
assertThat(streamedQueryResult.columnNames(), is(TEST_COLUMN_NAMES));
assertThat(streamedQueryResult.columnTypes(), is(TEST_COLUMN_TYPES));
assertThat(streamedQueryResult.queryID(), is(notNullValue()));
final List<Row> results = new LinkedList<>();
Row row;
while (true) {
row = streamedQueryResult.poll();
if (row == null) {
break;
} else {
results.add(row);
}
}
verifyStreamRows(results, 0);
assertThatEventually(streamedQueryResult::isComplete, is(true));
}
use of io.confluent.ksql.api.client.StreamedQueryResult in project ksql by confluentinc.
the class ConsistencyOffsetVectorFunctionalTest method shouldRoundTripCVWhenPullQueryOnTableAsync.
@Test
public void shouldRoundTripCVWhenPullQueryOnTableAsync() throws Exception {
// When
final StreamedQueryResult streamedQueryResult = consistencClient.streamQuery(PULL_QUERY_ON_TABLE).get();
// Then
shouldReceiveRows(streamedQueryResult, 1, // do nothing
(v) -> {
}, true);
assertThatEventually(streamedQueryResult::isComplete, is(true));
assertThat(((ClientImpl) consistencClient).getSerializedConsistencyVector(), is(notNullValue()));
final String serializedCV = ((ClientImpl) consistencClient).getSerializedConsistencyVector();
verifyConsistencyVector(serializedCV);
}
use of io.confluent.ksql.api.client.StreamedQueryResult in project ksql by confluentinc.
the class ClientIntegrationTest method shouldStreamPullQueryOnEmptyStreamSync.
@Test
public void shouldStreamPullQueryOnEmptyStreamSync() throws Exception {
// When
final StreamedQueryResult streamedQueryResult = client.streamQuery("SELECT * FROM " + EMPTY_TEST_STREAM + ";").get();
// Then
assertThat(streamedQueryResult.columnNames(), is(TEST_COLUMN_NAMES));
assertThat(streamedQueryResult.columnTypes(), is(TEST_COLUMN_TYPES));
assertThat(streamedQueryResult.queryID(), is(notNullValue()));
final List<Row> results = new LinkedList<>();
Row row;
while (true) {
row = streamedQueryResult.poll();
if (row == null) {
break;
} else {
results.add(row);
}
}
verifyStreamRows(results, 0);
assertThatEventually(streamedQueryResult::isComplete, is(true));
}
Aggregations