use of com.google.cloud.bigtable.hbase.wrappers.BulkMutationWrapper in project java-bigtable-hbase by googleapis.
the class TestBulkMutationVeneerApi method testWhenBatcherIsClosed.
@Test
public void testWhenBatcherIsClosed() throws IOException {
BatchingSettings batchingSettings = mock(BatchingSettings.class);
FlowControlSettings flowControlSettings = FlowControlSettings.newBuilder().setLimitExceededBehavior(LimitExceededBehavior.Ignore).build();
when(batchingSettings.getFlowControlSettings()).thenReturn(flowControlSettings);
@SuppressWarnings("unchecked") Batcher<RowMutationEntry, Void> actualBatcher = new BatcherImpl(mock(BatchingDescriptor.class), mock(UnaryCallable.class), new Object(), batchingSettings, mock(ScheduledExecutorService.class));
BulkMutationWrapper underTest = new BulkMutationVeneerApi(actualBatcher);
underTest.close();
Exception actualEx = null;
try {
underTest.add(rowMutation);
fail("batcher should throw exception");
} catch (Exception e) {
actualEx = e;
}
assertTrue(actualEx instanceof IllegalStateException);
}
use of com.google.cloud.bigtable.hbase.wrappers.BulkMutationWrapper in project java-bigtable-hbase by googleapis.
the class TestDataClientVeneerApi method testCreateBulkMutation.
@Test
public void testCreateBulkMutation() throws Exception {
RowMutationEntry entry = RowMutationEntry.create(ROW_KEY);
when(mockDataClient.newBulkMutationBatcher(TABLE_ID)).thenReturn(mockMutationBatcher);
when(mockMutationBatcher.add(entry)).thenReturn(ApiFutures.<Void>immediateFuture(null));
BulkMutationWrapper mutationWrapper = dataClientWrapper.createBulkMutation(TABLE_ID);
mutationWrapper.add(entry).get();
verify(mockDataClient).newBulkMutationBatcher(TABLE_ID);
verify(mockMutationBatcher).add(entry);
}
Aggregations