Search in sources :

Example 11 with KeyOffset

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

the class TestAbstractBigtableConnection method testRegionLocator.

@Test
public void testRegionLocator() throws IOException {
    assertEquals(1, connection.getAllRegionInfos(TABLE_NAME).size());
    assertEquals(regionInfo, connection.getAllRegionInfos(TABLE_NAME).get(0));
    List<HRegionLocation> expectedRegionLocations = ImmutableList.of(new HRegionLocation(regionInfo, ServerName.valueOf(HOST_NAME, server.getPort(), 0)));
    when(mockSampledAdapter.adaptResponse(Mockito.<List<KeyOffset>>any())).thenReturn(expectedRegionLocations);
    RegionLocator regionLocator = connection.getRegionLocator(TABLE_NAME);
    assertEquals(expectedRegionLocations, regionLocator.getAllRegionLocations());
}
Also used : HRegionLocation(org.apache.hadoop.hbase.HRegionLocation) KeyOffset(com.google.cloud.bigtable.data.v2.models.KeyOffset) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)9 KeyOffset (com.google.cloud.bigtable.data.v2.models.KeyOffset)8 HRegionLocation (org.apache.hadoop.hbase.HRegionLocation)6 ArrayList (java.util.ArrayList)5 KeyOffset (com.google.bigtable.repackaged.com.google.cloud.bigtable.data.v2.models.KeyOffset)3 BoundedSource (org.apache.beam.sdk.io.BoundedSource)3 TableName (org.apache.hadoop.hbase.TableName)2 Admin (org.apache.hadoop.hbase.client.Admin)2 Put (org.apache.hadoop.hbase.client.Put)2 Result (org.apache.hadoop.hbase.client.Result)2 ApiFuture (com.google.api.core.ApiFuture)1 SampleRowKeysRequest (com.google.bigtable.v2.SampleRowKeysRequest)1 AbstractSource (com.google.cloud.bigtable.beam.CloudBigtableIO.AbstractSource)1 Source (com.google.cloud.bigtable.beam.CloudBigtableIO.Source)1 SourceWithKeys (com.google.cloud.bigtable.beam.CloudBigtableIO.SourceWithKeys)1 BigtableDataClient (com.google.cloud.bigtable.data.v2.BigtableDataClient)1 IOException (java.io.IOException)1 List (java.util.List)1 ExecutorService (java.util.concurrent.ExecutorService)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1