use of com.google.firestore.v1.RunQueryRequest in project beam by apache.
the class PartitionQueryResponseToRunQueryRequestTest method ensureCursorPairingWorks_emptyCursorsInResponse.
@Test
public void ensureCursorPairingWorks_emptyCursorsInResponse() {
StructuredQuery query = StructuredQuery.newBuilder().addFrom(CollectionSelector.newBuilder().setAllDescendants(true).setCollectionId("c1").build()).build();
List<StructuredQuery> expectedQueries = newArrayList(query);
PartitionQueryPair partitionQueryPair = new PartitionQueryPair(PartitionQueryRequest.newBuilder().setStructuredQuery(query).build(), PartitionQueryResponse.newBuilder().build());
ArgumentCaptor<RunQueryRequest> captor = ArgumentCaptor.forClass(RunQueryRequest.class);
when(processContext.element()).thenReturn(partitionQueryPair);
doNothing().when(processContext).output(captor.capture());
PartitionQueryResponseToRunQueryRequest fn = new PartitionQueryResponseToRunQueryRequest();
fn.processElement(processContext);
List<StructuredQuery> actualQueries = captor.getAllValues().stream().map(RunQueryRequest::getStructuredQuery).collect(Collectors.toList());
assertEquals(expectedQueries, actualQueries);
}
Aggregations