Search in sources :

Example 1 with WindowKeyQuery

use of org.apache.kafka.streams.query.WindowKeyQuery in project ksql by confluentinc.

the class KsMaterializedWindowTableIQv2Test method shouldSupportRangeAll.

@Test
public void shouldSupportRangeAll() {
    // When:
    final StateQueryResult partitionResult = new StateQueryResult();
    final QueryResult result = QueryResult.forResult(fetchIterator);
    result.setPosition(POSITION);
    partitionResult.addResult(PARTITION, result);
    when(kafkaStreams.query(any())).thenReturn(partitionResult);
    table.get(A_KEY, PARTITION, Range.all(), Range.all());
    // Then:
    verify(kafkaStreams).query(queryTypeCaptor.capture());
    StateQueryRequest request = queryTypeCaptor.getValue();
    assertThat(request.getQuery(), instanceOf(WindowKeyQuery.class));
    WindowKeyQuery keyQuery = (WindowKeyQuery) request.getQuery();
    assertThat(keyQuery.getKey(), is(A_KEY));
}
Also used : StateQueryResult(org.apache.kafka.streams.query.StateQueryResult) QueryResult(org.apache.kafka.streams.query.QueryResult) StateQueryResult(org.apache.kafka.streams.query.StateQueryResult) WindowKeyQuery(org.apache.kafka.streams.query.WindowKeyQuery) StateQueryRequest(org.apache.kafka.streams.query.StateQueryRequest) Test(org.junit.Test)

Aggregations

QueryResult (org.apache.kafka.streams.query.QueryResult)1 StateQueryRequest (org.apache.kafka.streams.query.StateQueryRequest)1 StateQueryResult (org.apache.kafka.streams.query.StateQueryResult)1 WindowKeyQuery (org.apache.kafka.streams.query.WindowKeyQuery)1 Test (org.junit.Test)1