Search in sources :

Example 1 with ClientImpl

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

the class ConsistencyOffsetVectorFunctionalTest method shouldRoundTripCVWhenPullQueryOnTableSync.

@Test
public void shouldRoundTripCVWhenPullQueryOnTableSync() throws Exception {
    // When
    final StreamedQueryResult streamedQueryResult = consistencClient.streamQuery(PULL_QUERY_ON_TABLE).get();
    streamedQueryResult.poll();
    // Then
    assertThatEventually(streamedQueryResult::isComplete, is(true));
    assertThatEventually(() -> ((ClientImpl) consistencClient).getSerializedConsistencyVector(), is(notNullValue()));
    final String serializedCV = ((ClientImpl) consistencClient).getSerializedConsistencyVector();
    verifyConsistencyVector(serializedCV);
}
Also used : ClientImpl(io.confluent.ksql.api.client.impl.ClientImpl) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) StreamedQueryResult(io.confluent.ksql.api.client.StreamedQueryResult) Test(org.junit.Test)

Example 2 with ClientImpl

use of io.confluent.ksql.api.client.impl.ClientImpl 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);
}
Also used : ClientImpl(io.confluent.ksql.api.client.impl.ClientImpl) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) StreamedQueryResult(io.confluent.ksql.api.client.StreamedQueryResult) Test(org.junit.Test)

Example 3 with ClientImpl

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

the class ConsistencyOffsetVectorFunctionalTest method shouldRoundTripCVWhenExecutePullQuery.

@Test
public void shouldRoundTripCVWhenExecutePullQuery() throws Exception {
    // When
    final BatchedQueryResult batchedQueryResult = consistencClient.executeQuery(PULL_QUERY_ON_TABLE);
    final List<Row> rows = batchedQueryResult.get();
    // Then
    assertThat(rows, hasSize(1));
    assertThat(batchedQueryResult.queryID().get(), is(notNullValue()));
    assertThatEventually(() -> ((ClientImpl) consistencClient).getSerializedConsistencyVector(), is(notNullValue()));
    final String serializedCV = ((ClientImpl) consistencClient).getSerializedConsistencyVector();
    verifyConsistencyVector(serializedCV);
}
Also used : ClientImpl(io.confluent.ksql.api.client.impl.ClientImpl) Row(io.confluent.ksql.api.client.Row) StreamedRow(io.confluent.ksql.rest.entity.StreamedRow) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) BatchedQueryResult(io.confluent.ksql.api.client.BatchedQueryResult) Test(org.junit.Test)

Aggregations

ClientImpl (io.confluent.ksql.api.client.impl.ClientImpl)3 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)3 Test (org.junit.Test)3 StreamedQueryResult (io.confluent.ksql.api.client.StreamedQueryResult)2 BatchedQueryResult (io.confluent.ksql.api.client.BatchedQueryResult)1 Row (io.confluent.ksql.api.client.Row)1 StreamedRow (io.confluent.ksql.rest.entity.StreamedRow)1