use of org.apache.kafka.streams.query.RangeQuery in project ksql by confluentinc.
the class KsMaterializedTableIQv2Test method shouldRangeQueryWithCorrectParams_noBounds.
@Test
public void shouldRangeQueryWithCorrectParams_noBounds() {
// Given:
when(kafkaStreams.query(any())).thenReturn(getIteratorResult());
// When:
table.get(PARTITION, null, null);
// Then:
verify(kafkaStreams).query(queryTypeCaptor.capture());
StateQueryRequest request = queryTypeCaptor.getValue();
assertThat(request.getQuery(), instanceOf(RangeQuery.class));
RangeQuery rangeQuery = (RangeQuery) request.getQuery();
assertThat(rangeQuery.getLowerBound(), is(Optional.empty()));
assertThat(rangeQuery.getUpperBound(), is(Optional.empty()));
}
use of org.apache.kafka.streams.query.RangeQuery in project ksql by confluentinc.
the class KsMaterializedTableIQv2Test method shouldRangeQueryWithCorrectParams_bothBounds.
@Test
public void shouldRangeQueryWithCorrectParams_bothBounds() {
// Given:
when(kafkaStreams.query(any())).thenReturn(getIteratorResult());
// When:
table.get(PARTITION, A_KEY, A_KEY2);
// Then:
verify(kafkaStreams).query(queryTypeCaptor.capture());
StateQueryRequest request = queryTypeCaptor.getValue();
assertThat(request.getQuery(), instanceOf(RangeQuery.class));
RangeQuery rangeQuery = (RangeQuery) request.getQuery();
assertThat(rangeQuery.getLowerBound(), is(Optional.of(A_KEY)));
assertThat(rangeQuery.getUpperBound(), is(Optional.of(A_KEY2)));
}
use of org.apache.kafka.streams.query.RangeQuery in project ksql by confluentinc.
the class KsMaterializedTableIQv2Test method shouldRangeQueryWithCorrectParams_upperBound.
@Test
public void shouldRangeQueryWithCorrectParams_upperBound() {
// Given:
when(kafkaStreams.query(any())).thenReturn(getIteratorResult());
// When:
table.get(PARTITION, null, A_KEY2);
// Then:
verify(kafkaStreams).query(queryTypeCaptor.capture());
StateQueryRequest request = queryTypeCaptor.getValue();
assertThat(request.getQuery(), instanceOf(RangeQuery.class));
RangeQuery rangeQuery = (RangeQuery) request.getQuery();
assertThat(rangeQuery.getLowerBound(), is(Optional.empty()));
assertThat(rangeQuery.getUpperBound(), is(Optional.of(A_KEY2)));
}
use of org.apache.kafka.streams.query.RangeQuery in project ksql by confluentinc.
the class KsMaterializedTableIQv2Test method shouldRangeQueryWithCorrectParams_lowerBound.
@Test
public void shouldRangeQueryWithCorrectParams_lowerBound() {
// Given:
when(kafkaStreams.query(any())).thenReturn(getIteratorResult());
// When:
table.get(PARTITION, A_KEY, null);
// Then:
verify(kafkaStreams).query(queryTypeCaptor.capture());
StateQueryRequest request = queryTypeCaptor.getValue();
assertThat(request.getQuery(), instanceOf(RangeQuery.class));
RangeQuery rangeQuery = (RangeQuery) request.getQuery();
assertThat(rangeQuery.getLowerBound(), is(Optional.of(A_KEY)));
assertThat(rangeQuery.getUpperBound(), is(Optional.empty()));
}
use of org.apache.kafka.streams.query.RangeQuery in project ksql by confluentinc.
the class KsMaterializedTableIQv2Test method shouldRangeQueryWithCorrectParams_fullTableScan.
@Test
public void shouldRangeQueryWithCorrectParams_fullTableScan() {
// Given:
when(kafkaStreams.query(any())).thenReturn(getIteratorResult());
// When:
table.get(PARTITION);
// Then:
verify(kafkaStreams).query(queryTypeCaptor.capture());
StateQueryRequest request = queryTypeCaptor.getValue();
assertThat(request.getQuery(), instanceOf(RangeQuery.class));
RangeQuery rangeQuery = (RangeQuery) request.getQuery();
assertThat(rangeQuery.getLowerBound(), is(Optional.empty()));
assertThat(rangeQuery.getUpperBound(), is(Optional.empty()));
}
Aggregations