Search in sources :

Example 11 with ConditionalRowMutation

use of com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation in project java-bigtable by googleapis.

the class BigtableDataClientTests method checkAndMutateRowTest.

@Test
public void checkAndMutateRowTest() {
    Mockito.when(mockStub.checkAndMutateRowCallable()).thenReturn(mockCheckAndMutateRowCallable);
    Mockito.when(mockCheckAndMutateRowCallable.futureCall(ArgumentMatchers.any(ConditionalRowMutation.class))).thenReturn(ApiFutures.immediateFuture(Boolean.TRUE));
    ConditionalRowMutation mutation = ConditionalRowMutation.create("fake-table", "fake-key").then(Mutation.create().setCell("fake-family", "fake-qualifier", "fake-value"));
    bigtableDataClient.checkAndMutateRow(mutation);
    Mockito.verify(mockCheckAndMutateRowCallable).futureCall(mutation);
}
Also used : ConditionalRowMutation(com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation) Test(org.junit.Test)

Example 12 with ConditionalRowMutation

use of com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation in project java-bigtable by googleapis.

the class BigtableDataClientTest method proxyCheckAndMutateRowTest.

@Test
public void proxyCheckAndMutateRowTest() {
    Mockito.when(mockStub.checkAndMutateRowCallable()).thenReturn(mockCheckAndMutateRowCallable);
    ConditionalRowMutation mutation = ConditionalRowMutation.create("fake-table", "fake-key").then(Mutation.create().setCell("fake-family", "fake-qualifier", "fake-value"));
    bigtableDataClient.checkAndMutateRowAsync(mutation);
    Mockito.verify(mockCheckAndMutateRowCallable).futureCall(mutation);
}
Also used : ConditionalRowMutation(com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation) Test(org.junit.Test)

Aggregations

ConditionalRowMutation (com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation)11 Test (org.junit.Test)6 CheckAndMutateRowRequest (com.google.bigtable.v2.CheckAndMutateRowRequest)1 CheckAndMutateRowResponse (com.google.bigtable.v2.CheckAndMutateRowResponse)1 BigtableDataClient (com.google.cloud.bigtable.data.v2.BigtableDataClient)1 Filter (com.google.cloud.bigtable.data.v2.models.Filters.Filter)1 Mutation (com.google.cloud.bigtable.data.v2.models.Mutation)1 HeaderTracerUnaryCallable (com.google.cloud.bigtable.data.v2.stub.metrics.HeaderTracerUnaryCallable)1 StatsHeadersUnaryCallable (com.google.cloud.bigtable.data.v2.stub.metrics.StatsHeadersUnaryCallable)1 CheckAndMutateUtil (com.google.cloud.bigtable.hbase.adapters.CheckAndMutateUtil)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ByteString (com.google.protobuf.ByteString)1 IOException (java.io.IOException)1 Map (java.util.Map)1 CompareOperator (org.apache.hadoop.hbase.CompareOperator)1 Delete (org.apache.hadoop.hbase.client.Delete)1 Put (org.apache.hadoop.hbase.client.Put)1 RowMutations (org.apache.hadoop.hbase.client.RowMutations)1 TimeRange (org.apache.hadoop.hbase.io.TimeRange)1