Search in sources :

Example 6 with BigtableOptions

use of com.google.cloud.bigtable.config.BigtableOptions in project beam by apache.

the class BigtableIOTest method testReadWithBigTableOptionsSetsRetryOptions.

@Test
public void testReadWithBigTableOptionsSetsRetryOptions() {
    final int initialBackoffMillis = -1;
    BigtableOptions.Builder optionsBuilder = BIGTABLE_OPTIONS.toBuilder();
    RetryOptions.Builder retryOptionsBuilder = new RetryOptions.Builder();
    retryOptionsBuilder.setInitialBackoffMillis(initialBackoffMillis);
    optionsBuilder.setRetryOptions(retryOptionsBuilder.build());
    BigtableIO.Read read = BigtableIO.read().withBigtableOptions(optionsBuilder.build());
    BigtableOptions options = read.getBigtableOptions();
    assertEquals(initialBackoffMillis, options.getRetryOptions().getInitialBackoffMillis());
    assertThat(options.getRetryOptions(), Matchers.equalTo(retryOptionsBuilder.build()));
}
Also used : BigtableOptions(com.google.cloud.bigtable.config.BigtableOptions) RetryOptions(com.google.cloud.bigtable.config.RetryOptions) Test(org.junit.Test)

Example 7 with BigtableOptions

use of com.google.cloud.bigtable.config.BigtableOptions in project beam by apache.

the class BigtableServiceImplTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    BigtableOptions options = new BigtableOptions.Builder().setProjectId(PROJECT_ID).setInstanceId(INSTANCE_ID).build();
    when(mockSession.getOptions()).thenReturn(options);
    when(mockSession.createBulkMutation(eq(TABLE_NAME))).thenReturn(mockBulkMutation);
    when(mockSession.getDataClient()).thenReturn(mockBigtableDataClient);
    // Setup the ProcessWideContainer for testing metrics are set.
    MetricsContainerImpl container = new MetricsContainerImpl(null);
    MetricsEnvironment.setProcessWideContainer(container);
}
Also used : MetricsContainerImpl(org.apache.beam.runners.core.metrics.MetricsContainerImpl) BigtableOptions(com.google.cloud.bigtable.config.BigtableOptions) Before(org.junit.Before)

Aggregations

BigtableOptions (com.google.cloud.bigtable.config.BigtableOptions)7 Test (org.junit.Test)4 RetryOptions (com.google.cloud.bigtable.config.RetryOptions)2 BigtableSession (com.google.cloud.bigtable.grpc.BigtableSession)2 TestCredential (org.apache.beam.sdk.extensions.gcp.auth.TestCredential)2 GcpOptions (org.apache.beam.sdk.extensions.gcp.options.GcpOptions)2 Before (org.junit.Before)2 BulkOptions (com.google.cloud.bigtable.config.BulkOptions)1 BigtableDataClient (com.google.cloud.bigtable.grpc.BigtableDataClient)1 BigtableInstanceName (com.google.cloud.bigtable.grpc.BigtableInstanceName)1 BigtableTableAdminClient (com.google.cloud.bigtable.grpc.BigtableTableAdminClient)1 IOException (java.io.IOException)1 MetricsContainerImpl (org.apache.beam.runners.core.metrics.MetricsContainerImpl)1