use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-bigtable-hbase by googleapis.
the class TestDeleteAdapter method adapt.
private MutateRowRequest adapt(Delete delete) {
RowMutation rowMutation = RowMutation.create(TABLE_ID, ByteString.copyFrom(delete.getRow()));
deleteAdapter.adapt(delete, rowMutation);
return rowMutation.toProto(REQUEST_CONTEXT);
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-bigtable-hbase by googleapis.
the class TestDataClientVeneerApi method testMutateRowAsync.
@Test
public void testMutateRowAsync() throws Exception {
RowMutation rowMutation = RowMutation.create(TABLE_ID, ROW_KEY);
when(mockDataClient.mutateRowAsync(rowMutation)).thenReturn(ApiFutures.<Void>immediateFuture(null));
dataClientWrapper.mutateRowAsync(rowMutation).get();
verify(mockDataClient).mutateRowAsync(rowMutation);
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-bigtable by googleapis.
the class EnhancedBigtableStub method createMutateRowCallable.
/**
* Creates a callable chain to handle MutateRow RPCs. The chain will:
*
* <ul>
* <li>Convert a {@link RowMutation} into a {@link com.google.bigtable.v2.MutateRowRequest}.
* <li>Add tracing & metrics.
* </ul>
*/
private UnaryCallable<RowMutation, Void> createMutateRowCallable() {
String methodName = "MutateRow";
UnaryCallable<MutateRowRequest, MutateRowResponse> base = GrpcRawCallableFactory.createUnaryCallable(GrpcCallSettings.<MutateRowRequest, MutateRowResponse>newBuilder().setMethodDescriptor(BigtableGrpc.getMutateRowMethod()).setParamsExtractor(new RequestParamsExtractor<MutateRowRequest>() {
@Override
public Map<String, String> extract(MutateRowRequest mutateRowRequest) {
return ImmutableMap.of("table_name", mutateRowRequest.getTableName(), "app_profile_id", mutateRowRequest.getAppProfileId());
}
}).build(), settings.mutateRowSettings().getRetryableCodes());
UnaryCallable<MutateRowRequest, MutateRowResponse> withStatsHeaders = new StatsHeadersUnaryCallable<>(base);
UnaryCallable<MutateRowRequest, MutateRowResponse> withHeaderTracer = new HeaderTracerUnaryCallable<>(withStatsHeaders);
UnaryCallable<MutateRowRequest, MutateRowResponse> retrying = Callables.retrying(withHeaderTracer, settings.mutateRowSettings(), clientContext);
return createUserFacingUnaryCallable(methodName, new MutateRowCallable(retrying, requestContext));
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-bigtable by googleapis.
the class BigtableDataClientTest method proxyMutateRowTest.
@Test
public void proxyMutateRowTest() {
Mockito.when(mockStub.mutateRowCallable()).thenReturn(mockMutateRowCallable);
RowMutation request = RowMutation.create("fake-table", "some-key").setCell("some-family", "fake-qualifier", "fake-value");
bigtableDataClient.mutateRowAsync(request);
Mockito.verify(mockMutateRowCallable).futureCall(request);
}
use of com.google.cloud.bigtable.data.v2.models.RowMutation in project java-bigtable by googleapis.
the class MutateRowCallableTest method testRequestConversion.
@Test
public void testRequestConversion() {
MutateRowCallable callable = new MutateRowCallable(innerCallable, REQUEST_CONTEXT);
RowMutation outerRequest = RowMutation.create("fake-table", "fake-key").setCell("fake-family", "fake-qualifier", 1_000, "fake-value");
innerResult.set(MutateRowResponse.getDefaultInstance());
callable.call(outerRequest);
Truth.assertThat(innerMutation.getValue()).isEqualTo(outerRequest.toProto(REQUEST_CONTEXT));
}
Aggregations