Search in sources :

Example 6 with ServerStreamingStashCallable

use of com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable in project java-bigtable by googleapis.

the class FilterMarkerRowsCallableTest method testRealRow.

@Test
public void testRealRow() {
    Row row = buildRealRow();
    ServerStreamingStashCallable<ReadRowsRequest, Row> innerCallable = new ServerStreamingStashCallable<>(Lists.newArrayList(row));
    FilterMarkerRowsCallable<Row> filterCallable = new FilterMarkerRowsCallable<>(innerCallable, rowAdapter);
    ServerStream<Row> results = filterCallable.call(ReadRowsRequest.getDefaultInstance());
    assertThat(results).containsExactly(row);
}
Also used : ServerStreamingStashCallable(com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable) ReadRowsRequest(com.google.bigtable.v2.ReadRowsRequest) Row(com.google.cloud.bigtable.data.v2.models.Row) Test(org.junit.Test)

Example 7 with ServerStreamingStashCallable

use of com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable in project java-bigtable by googleapis.

the class FilterMarkerRowsCallableTest method testMixed.

@Test
public void testMixed() {
    Row row = buildRealRow();
    Row markerRow = buildScanMarker();
    ServerStreamingStashCallable<ReadRowsRequest, Row> innerCallable = new ServerStreamingStashCallable<>(Lists.newArrayList(row, markerRow));
    FilterMarkerRowsCallable<Row> filterCallable = new FilterMarkerRowsCallable<>(innerCallable, rowAdapter);
    ServerStream<Row> results = filterCallable.call(ReadRowsRequest.getDefaultInstance());
    assertThat(results).containsExactly(row);
}
Also used : ServerStreamingStashCallable(com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable) ReadRowsRequest(com.google.bigtable.v2.ReadRowsRequest) Row(com.google.cloud.bigtable.data.v2.models.Row) Test(org.junit.Test)

Example 8 with ServerStreamingStashCallable

use of com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable in project java-bigtable by googleapis.

the class ReadRowsUserCallableTest method testFirstIsLimited.

@Test
public void testFirstIsLimited() {
    ServerStreamingStashCallable<ReadRowsRequest, Row> innerCallable = new ServerStreamingStashCallable<>();
    ReadRowsUserCallable<Row> callable = new ReadRowsUserCallable<>(innerCallable, REQUEST_CONTEXT);
    Query query = Query.create("fake-table");
    callable.first().call(query);
    Truth.assertThat(innerCallable.getActualRequest()).isEqualTo(query.limit(1).toProto(REQUEST_CONTEXT));
}
Also used : Query(com.google.cloud.bigtable.data.v2.models.Query) ServerStreamingStashCallable(com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable) ReadRowsRequest(com.google.bigtable.v2.ReadRowsRequest) Row(com.google.cloud.bigtable.data.v2.models.Row) Test(org.junit.Test)

Aggregations

ServerStreamingStashCallable (com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi.ServerStreamingStashCallable)8 Test (org.junit.Test)8 ReadRowsRequest (com.google.bigtable.v2.ReadRowsRequest)7 Row (com.google.cloud.bigtable.data.v2.models.Row)7 ReadRowsResponse (com.google.bigtable.v2.ReadRowsResponse)3 DefaultRowAdapter (com.google.cloud.bigtable.data.v2.models.DefaultRowAdapter)3 Query (com.google.cloud.bigtable.data.v2.models.Query)2 RowCell (com.google.cloud.bigtable.data.v2.models.RowCell)2 FakeStreamingApi (com.google.cloud.bigtable.gaxx.testing.FakeStreamingApi)2 CellChunk (com.google.bigtable.v2.ReadRowsResponse.CellChunk)1 MockResponseObserver (com.google.cloud.bigtable.gaxx.testing.MockStreamingApi.MockResponseObserver)1 ReadRowsTest (com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest)1 IOException (java.io.IOException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1