AbstractBigtableConnection implements Connection, CommonConnection, Closeable { @Override public RegionLocator getRegionLocator(TableName tableName) throws IOException { RegionLocator locator = getCachedLocator(tableName); if (locator == null) { locator = new BigtableRegionLocator(tableName, settings, bigtableApi.getDataClient()) { @Override public SampledRowKeysAdapter getSampledRowKeysAdapter( TableName tableName, ServerName serverName) { return createSampledRowKeysAdapter(tableName, serverName); } }; locatorCache.add(locator); } return locator; } AbstractBigtableConnection(Configuration conf); protected  AbstractBigtableConnection(
      Configuration conf, boolean managed, ExecutorService pool, User user); @Override Configuration getConfiguration(); @Override Table getTable(TableName tableName); @Override BufferedMutator getBufferedMutator(BufferedMutatorParams params); HBaseRequestAdapter createAdapter(TableName tableName); @Override BufferedMutator getBufferedMutator(TableName tableName); @Deprecated Table getTable(String tableName); @Override RegionLocator getRegionLocator(TableName tableName); @Override void abort(final String msg, Throwable t); @Override boolean isClosed(); @Override boolean isAborted(); @Override void close(); @Override String toString(); @Override abstract Admin getAdmin(); BigtableOptions getOptions(); @Override BigtableHBaseSettings getBigtableSettings(); Set<TableName> getDisabledTables(); BigtableApi getBigtableApi();  }
@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, port, 0))); when(mockSampledAdapter.adaptResponse(Mockito.<List<KeyOffset>>any())) .thenReturn(expectedRegionLocations); RegionLocator regionLocator = connection.getRegionLocator(TABLE_NAME); assertEquals(expectedRegionLocations, regionLocator.getAllRegionLocations()); }