use of com.google.bigtable.repackaged.com.google.bigtable.v2.ReadRowsRequest in project java-bigtable by googleapis.
the class QueryTest method limitTest.
@Test
public void limitTest() {
Query query = Query.create(TABLE_ID).limit(10);
Builder expectedProto = expectedProtoBuilder().setRowsLimit(10);
ReadRowsRequest actualProto = query.toProto(requestContext);
assertThat(actualProto).isEqualTo(expectedProto.build());
}
use of com.google.bigtable.repackaged.com.google.bigtable.v2.ReadRowsRequest in project java-bigtable by googleapis.
the class QueryTest method filterTest.
@Test
public void filterTest() {
Query query = Query.create(TABLE_ID).filter(FILTERS.key().regex(".*"));
Builder expectedProto = expectedProtoBuilder().setFilter(RowFilter.newBuilder().setRowKeyRegexFilter(ByteString.copyFromUtf8(".*")));
ReadRowsRequest actualProto = query.toProto(requestContext);
assertThat(actualProto).isEqualTo(expectedProto.build());
}
use of com.google.bigtable.repackaged.com.google.bigtable.v2.ReadRowsRequest in project java-bigtable by googleapis.
the class QueryTest method rowRangeTest.
@Test
public void rowRangeTest() {
Query query = Query.create(TABLE_ID).range("simple-begin", "simple-end").range(ByteString.copyFromUtf8("byte-begin"), ByteString.copyFromUtf8("byte-end")).range(ByteStringRange.create("range-begin", "range-end"));
Builder expectedProto = expectedProtoBuilder();
expectedProto.getRowsBuilder().addRowRanges(RowRange.newBuilder().setStartKeyClosed(ByteString.copyFromUtf8("simple-begin")).setEndKeyOpen(ByteString.copyFromUtf8("simple-end"))).addRowRanges(RowRange.newBuilder().setStartKeyClosed(ByteString.copyFromUtf8("byte-begin")).setEndKeyOpen(ByteString.copyFromUtf8("byte-end"))).addRowRanges(RowRange.newBuilder().setStartKeyClosed(ByteString.copyFromUtf8("range-begin")).setEndKeyOpen(ByteString.copyFromUtf8("range-end")));
ReadRowsRequest actualProto = query.toProto(requestContext);
assertThat(actualProto).isEqualTo(expectedProto.build());
}
use of com.google.bigtable.repackaged.com.google.bigtable.v2.ReadRowsRequest in project java-bigtable by googleapis.
the class ReadRowsBatchingDescriptorTest method requestBuilderTest.
@Test
public void requestBuilderTest() {
BatchingRequestBuilder<ByteString, Query> requestBuilder = underTest.newRequestBuilder(Query.create("table-Id"));
requestBuilder.add(ByteString.copyFromUtf8("row-key-1"));
requestBuilder.add(ByteString.copyFromUtf8("row-key-2"));
Query request = requestBuilder.build();
ReadRowsRequest readRowsRequest = request.toProto(RequestContext.create("project", "instance", "appProfile"));
assertThat(readRowsRequest.getTableName()).contains("table-Id");
assertThat(readRowsRequest.getRows().getRowKeysList()).isEqualTo(ImmutableList.of(ByteString.copyFromUtf8("row-key-1"), ByteString.copyFromUtf8("row-key-2")));
}
use of com.google.bigtable.repackaged.com.google.bigtable.v2.ReadRowsRequest 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));
}
Aggregations