/** * * * <pre> * A Row containing the new contents of all cells modified by the request. * </pre> * * <code>.google.bigtable.v2.Row row = 1;</code> */ public Builder setRow(com.google.bigtable.v2.Row.Builder builderForValue) { if (rowBuilder_ == null) { row_ = builderForValue.build(); onChanged(); } else { rowBuilder_.setMessage(builderForValue.build()); } return this; } /**
/** * * * <pre> * A Row containing the new contents of all cells modified by the request. * </pre> * * <code>.google.bigtable.v2.Row row = 1;</code> */ public Builder setRow(com.google.bigtable.v2.Row.Builder builderForValue) { if (rowBuilder_ == null) { row_ = builderForValue.build(); onChanged(); } else { rowBuilder_.setMessage(builderForValue.build()); } return this; } /**
/** * <pre> * A Row containing the new contents of all cells modified by the request. * </pre> * * <code>.google.bigtable.v2.Row row = 1;</code> */ public Builder setRow( com.google.bigtable.v2.Row.Builder builderForValue) { if (rowBuilder_ == null) { row_ = builderForValue.build(); onChanged(); } else { rowBuilder_.setMessage(builderForValue.build()); } return this; } /**
return rowBuilder.build();
/** * 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(); }