Search in sources :

Example 6 with MutateRowsBatchingDescriptor

use of com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsBatchingDescriptor in project java-bigtable by googleapis.

the class BigtableBatchingCallSettingsTest method testEmptyBuilder.

@Test
public void testEmptyBuilder() {
    BigtableBatchingCallSettings.Builder builder = BigtableBatchingCallSettings.newBuilder(new MutateRowsBatchingDescriptor());
    assertThat(builder.getBatchingSettings()).isNull();
    assertThat(builder.getRetryableCodes()).isEmpty();
    assertThat(builder.getRetrySettings()).isNotNull();
    assertThat(builder.isLatencyBasedThrottlingEnabled()).isFalse();
    assertThat(builder.getTargetRpcLatencyMs()).isNull();
    assertThat(builder.getDynamicFlowControlSettings()).isNull();
}
Also used : MutateRowsBatchingDescriptor(com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsBatchingDescriptor) Test(org.junit.Test)

Example 7 with MutateRowsBatchingDescriptor

use of com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsBatchingDescriptor in project java-bigtable by googleapis.

the class BigtableBatchingCallSettingsTest method testFlowControlMandatorySettings.

@Test
public void testFlowControlMandatorySettings() {
    Exception actualEx = null;
    try {
        BigtableBatchingCallSettings.newBuilder(new MutateRowsBatchingDescriptor()).setBatchingSettings(BatchingSettings.newBuilder().setFlowControlSettings(FlowControlSettings.newBuilder().setMaxOutstandingElementCount(null).setMaxOutstandingRequestBytes(null).build()).build()).build();
    } catch (Exception ex) {
        actualEx = ex;
    }
    assertThat(actualEx).isInstanceOf(IllegalStateException.class);
    BigtableBatchingCallSettings.newBuilder(new MutateRowsBatchingDescriptor()).setBatchingSettings(BatchingSettings.newBuilder().setFlowControlSettings(FlowControlSettings.newBuilder().setMaxOutstandingElementCount(10L).setMaxOutstandingRequestBytes(10L).build()).setElementCountThreshold(10L).setRequestByteThreshold(10L).build()).build();
    actualEx = null;
    try {
        BigtableBatchingCallSettings.newBuilder(new MutateRowsBatchingDescriptor()).setBatchingSettings(BatchingSettings.newBuilder().setFlowControlSettings(FlowControlSettings.newBuilder().setMaxOutstandingElementCount(10L).setMaxOutstandingRequestBytes(5L).build()).setElementCountThreshold(10L).setRequestByteThreshold(10L).build()).build();
    } catch (Exception ex) {
        actualEx = ex;
    }
    assertThat(actualEx).isInstanceOf(IllegalArgumentException.class);
    actualEx = null;
    try {
        BigtableBatchingCallSettings.newBuilder(new MutateRowsBatchingDescriptor()).setBatchingSettings(BatchingSettings.newBuilder().setFlowControlSettings(FlowControlSettings.newBuilder().setMaxOutstandingElementCount(5L).setMaxOutstandingRequestBytes(10L).build()).setElementCountThreshold(10L).setRequestByteThreshold(10L).build()).build();
    } catch (Exception ex) {
        actualEx = ex;
    }
    assertThat(actualEx).isInstanceOf(IllegalArgumentException.class);
}
Also used : MutateRowsBatchingDescriptor(com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsBatchingDescriptor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 MutateRowsBatchingDescriptor (com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsBatchingDescriptor)4 RowMutationEntry (com.google.cloud.bigtable.data.v2.models.RowMutationEntry)3 RetrySettings (com.google.api.gax.retrying.RetrySettings)2 DeadlineExceededException (com.google.api.gax.rpc.DeadlineExceededException)1 StatusCode (com.google.api.gax.rpc.StatusCode)1 UnavailableException (com.google.api.gax.rpc.UnavailableException)1 BulkMutation (com.google.cloud.bigtable.data.v2.models.BulkMutation)1 MutateRowsException (com.google.cloud.bigtable.data.v2.models.MutateRowsException)1 ExecutionException (java.util.concurrent.ExecutionException)1