public Builder mergeFrom(com.google.bigtable.v2.Row other) { if (other == com.google.bigtable.v2.Row.getDefaultInstance()) return this; if (other.getKey() != com.google.protobuf.ByteString.EMPTY) { setKey(other.getKey());
public Builder mergeFrom(com.google.bigtable.v2.Row other) { if (other == com.google.bigtable.v2.Row.getDefaultInstance()) return this; if (other.getKey() != com.google.protobuf.ByteString.EMPTY) { setKey(other.getKey());
public Builder mergeFrom(com.google.bigtable.v2.Row other) { if (other == com.google.bigtable.v2.Row.getDefaultInstance()) return this; if (other.getKey() != com.google.protobuf.ByteString.EMPTY) { setKey(other.getKey());
return null; Row.Builder rowBuilder = Row.newBuilder().setKey(row.getRowKey()); String prevFamily = null; Family.Builder familyBuilder = null;
/** * This test ensures that protobuf creation and interactions with {@link BigtableDataClient} work * as expected. * * @throws IOException * @throws InterruptedException */ @Test public void testRead() throws IOException { ByteKey start = ByteKey.copyFrom("a".getBytes(StandardCharsets.UTF_8)); ByteKey end = ByteKey.copyFrom("b".getBytes(StandardCharsets.UTF_8)); when(mockBigtableSource.getRanges()).thenReturn(Arrays.asList(ByteKeyRange.of(start, end))); when(mockBigtableSource.getTableId()).thenReturn(StaticValueProvider.of("table_name")); @SuppressWarnings("unchecked") ResultScanner<Row> mockResultScanner = Mockito.mock(ResultScanner.class); Row expectedRow = Row.newBuilder().setKey(ByteString.copyFromUtf8("a")).build(); when(mockResultScanner.next()).thenReturn(expectedRow).thenReturn(null); when(mockBigtableDataClient.readRows(any(ReadRowsRequest.class))).thenReturn(mockResultScanner); BigtableService.Reader underTest = new BigtableServiceImpl.BigtableReaderImpl(mockSession, mockBigtableSource); underTest.start(); Assert.assertEquals(expectedRow, underTest.getCurrentRow()); Assert.assertFalse(underTest.advance()); underTest.close(); verify(mockResultScanner, times(1)).close(); }
/** Helper function that builds a {@link Row} in a test table that could be returned by read. */ private static Row makeRow(ByteString key, ByteString value) { // Build the currentRow and return true. Column.Builder newColumn = TEST_COLUMN.toBuilder().addCells(Cell.newBuilder().setValue(value)); return Row.newBuilder() .setKey(key) .addFamilies(TEST_FAMILY.toBuilder().addColumns(newColumn)) .build(); }