Repository: GoogleCloudPlatform/cloud-bigtable-client
Pull request #1807 (2018-05-04 20:25:42)

Refactorings
- Using ManagedChannel instead of ChannelPool in BigtableSession
- Adding a new BigtableOptions getDefaultOptions() method.

spollapally: LGTM. Looks like "Configuration" class import is missing or something to that effect is failing the build.

Patch:
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableOptions.java b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableOptions.java
index b54c426a4..6b0c1ab53 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableOptions.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableOptions.java
@@ -68,6 +68,10 @@ public class BigtableOptions implements Serializable, Cloneable {
     return (int) Math.min(250, Math.max(1, availableProcessors * 4));
   }
 
+  public static BigtableOptions getDefaultOptions() {
+    return new Builder().build();
+  }
+
   /**
    * A mutable builder for BigtableConnectionOptions.
    */
@@ -94,7 +98,6 @@ public class BigtableOptions implements Serializable, Cloneable {
       // the Google Compute Engine metadata service or gcloud configuration in other environments. A
       // user can also override the default behavior with P12 or JSON configuration.
       options.credentialOptions = CredentialOptions.defaultCredentials();
-
     }
 
     private Builder(BigtableOptions options) {
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceClient.java b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceClient.java
index bbceb0d1e..71a67f76e 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceClient.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceClient.java
@@ -22,6 +22,7 @@ import java.util.concurrent.TimeoutException;
 import com.google.bigtable.admin.v2.AppProfile;
 import com.google.bigtable.admin.v2.Cluster;
 import com.google.bigtable.admin.v2.CreateAppProfileRequest;
+import com.google.bigtable.admin.v2.CreateClusterRequest;
 import com.google.bigtable.admin.v2.CreateInstanceRequest;
 import com.google.bigtable.admin.v2.DeleteAppProfileRequest;
 import com.google.bigtable.admin.v2.DeleteClusterRequest;
@@ -203,8 +204,8 @@ public interface BigtableInstanceClient {
    * production use. It is not subject to any SLA or deprecation policy.
    * Updates an app profile within an instance.
    * 
-   * @param request a {@link com.google.longrunning.Operation} object.
-   * @return a {@link com.google.bigtable.admin.v2.UpdateAppProfileRequest} object.
+   * @param request a {@link com.google.bigtable.admin.v2.UpdateAppProfileRequest} object.
+   * @return a {@link @link com.google.longrunning.Operation} object.
    */
   Operation updateAppProfile(UpdateAppProfileRequest request);
 
@@ -260,4 +261,12 @@ public interface BigtableInstanceClient {
    * @return a {@link com.google.iam.v1.TestIamPermissionsResponse} object.
    */
   TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request);
+  
+  /**
+   * Create an instance within a project.
+   * 
+   * @param request a {@link com.google.bigtable.admin.v2.CreateClusterRequest} object.
+   * @return a {@link com.google.longrunning.Operation} object.
+   */
+  Operation createCluster(CreateClusterRequest request);
 }
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceGrpcClient.java b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceGrpcClient.java
index b67d746d1..f7cd50ec2 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceGrpcClient.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableInstanceGrpcClient.java
@@ -25,6 +25,7 @@ import com.google.bigtable.admin.v2.AppProfile;
 import com.google.bigtable.admin.v2.BigtableInstanceAdminGrpc;
 import com.google.bigtable.admin.v2.Cluster;
 import com.google.bigtable.admin.v2.CreateAppProfileRequest;
+import com.google.bigtable.admin.v2.CreateClusterRequest;
 import com.google.bigtable.admin.v2.CreateInstanceRequest;
 import com.google.bigtable.admin.v2.DeleteAppProfileRequest;
 import com.google.bigtable.admin.v2.DeleteClusterRequest;
@@ -240,4 +241,10 @@ public class BigtableInstanceGrpcClient implements BigtableInstanceClient {
   public TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
       return instanceClient.testIamPermissions(request);
   }
+  
+  /** {@inheritDoc} */
+  @Override
+  public Operation createCluster(CreateClusterRequest request) {
+      return instanceClient.createCluster(request);
+  }
 }
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java
index 11e1da6eb..1ee221196 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java
@@ -81,7 +81,7 @@ public class BigtableSession implements Closeable {
 
   private static final Logger LOG = new Logger(BigtableSession.class);
   // TODO: Consider caching channel pools per instance.
-  private static ChannelPool cachedDataChannelPool;
+  private static ManagedChannel cachedDataChannelPool;
   private static final Map<String, ResourceLimiter> resourceLimiterMap = new HashMap<>();
 
   // 256 MB, server has 256 MB limit.
@@ -238,7 +238,7 @@ public class BigtableSession implements Closeable {
     // Defer the creation of both the tableAdminClient until we need them.
     }
 
-  private ChannelPool getDataChannelPool() throws IOException {
+  private ManagedChannel getDataChannelPool() throws IOException {
     String host = options.getDataHost();
     int channelCount = options.getChannelCount();
     if (options.useCachedChannel()) {
@@ -367,7 +367,7 @@ public class BigtableSession implements Closeable {
    * @return a {@link com.google.cloud.bigtable.grpc.io.ChannelPool} object.
    * @throws java.io.IOException if any.
    */
-  protected ChannelPool createChannelPool(final String hostString, int count) throws IOException {
+  protected ManagedChannel createChannelPool(final String hostString, int count) throws IOException {
     ChannelPool.ChannelFactory channelFactory = new ChannelPool.ChannelFactory() {
       @Override
       public ManagedChannel create() throws IOException {
@@ -378,14 +378,16 @@ public class BigtableSession implements Closeable {
   }
 
   /**
-   * Create a new {@link com.google.cloud.bigtable.grpc.io.ChannelPool}, with auth headers.
+   * Create a new {@link com.google.cloud.bigtable.grpc.io.ChannelPool}, with auth headers.  This
+   * method allows users to override the default implementation with their own.
    *
    * @param channelFactory a {@link ChannelPool.ChannelFactory} object.
    * @param count The number of channels in the pool.
    * @return a {@link com.google.cloud.bigtable.grpc.io.ChannelPool} object.
    * @throws java.io.IOException if any.
    */
-  protected ChannelPool createChannelPool(final ChannelPool.ChannelFactory channelFactory, int count) throws IOException {
+  protected ManagedChannel createChannelPool(final ChannelPool.ChannelFactory channelFactory, int count)
+      throws IOException {
     return new ChannelPool(channelFactory, count);
   }
 
@@ -397,18 +399,27 @@ public class BigtableSession implements Closeable {
    * @return a {@link com.google.cloud.bigtable.grpc.io.ChannelPool} object.
    * @throws java.io.IOException if any.
    */
-  protected ChannelPool createManagedPool(String host, int channelCount) throws IOException {
-    ChannelPool channelPool = createChannelPool(host, channelCount);
+  protected ManagedChannel createManagedPool(String host, int channelCount) throws IOException {
+    ManagedChannel channelPool = createChannelPool(host, channelCount);
     managedChannels.add(channelPool);
     return channelPool;
   }
 
-  public static BigtableInstanceClient createInstanceClient()
+  /**
+   * Create a {@link BigtableInstanceClient}.  {@link BigtableSession} objects assume that
+   * {@link BigtableOptions} have a project and instance.  A {@link BigtableInstanceClient} does not
+   * require project id or instance id, so {@link BigtableOptions#getDefaultOptions()} may be used
+   * if there are no service account credentials settings.
+   *
+   * @return a fully formed {@link BigtableInstanceClient}
+   * @throws IOException
+   * @throws GeneralSecurityException
+   */
+  public static BigtableInstanceClient createInstanceClient(BigtableOptions options)
       throws IOException, GeneralSecurityException {
-    BigtableOptions options = new BigtableOptions.Builder().build();
-    Channel channel = createChannelPool(BigtableOptions.BIGTABLE_ADMIN_HOST_DEFAULT, options);
-    return new BigtableInstanceGrpcClient(channel);
+    return new BigtableInstanceGrpcClient(createChannelPool(options.getAdminHost(), options));
   }
+
   /**
    * Create a new {@link com.google.cloud.bigtable.grpc.io.ChannelPool}, with auth headers.
    *
@@ -418,7 +429,7 @@ public class BigtableSession implements Closeable {
    * @throws IOException if any.
    * @throws GeneralSecurityException
    */
-  public static ChannelPool createChannelPool(final String host, final BigtableOptions options)
+  public static ManagedChannel createChannelPool(final String host, final BigtableOptions options)
       throws IOException, GeneralSecurityException {
     return createChannelPool(host, options, 1);
   }
@@ -433,19 +444,26 @@ public class BigtableSession implements Closeable {
    * @throws IOException if any.
    * @throws GeneralSecurityException
    */
-  public static ChannelPool createChannelPool(final String host, final BigtableOptions options,
+  public static ManagedChannel createChannelPool(final String host, final BigtableOptions options,
       int count) throws IOException, GeneralSecurityException {
     final List<ClientInterceptor> interceptorList = new ArrayList<>();
-    interceptorList.add(CredentialInterceptorCache.getInstance()
-        .getCredentialsInterceptor(options.getCredentialOptions(), options.getRetryOptions()));
+
+    ClientInterceptor credentialsInterceptor = CredentialInterceptorCache.getInstance()
+            .getCredentialsInterceptor(options.getCredentialOptions(), options.getRetryOptions());
+    if (credentialsInterceptor != null) {
+      interceptorList.add(credentialsInterceptor);
+    }
+
     if (options.getInstanceName() != null) {
       interceptorList
           .add(new GoogleCloudResourcePrefixInterceptor(options.getInstanceName().toString()));
     }
     final ClientInterceptor[] interceptors =
         interceptorList.toArray(new ClientInterceptor[interceptorList.size()]);
+
     ChannelPool.ChannelFactory factory = new ChannelPool.ChannelFactory() {
-      @Override public ManagedChannel create() throws IOException {
+      @Override
+      public ManagedChannel create() throws IOException {
         return createNettyChannel(host, options, interceptors);
       }
     };
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java
index 4a0e91018..0210b0c27 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java
@@ -279,7 +279,7 @@ public class OAuthCredentialsCache {
 
         Future<HeaderCacheElement> future = executor.submit(new Callable<HeaderCacheElement>() {
           @Override
-          public HeaderCacheElement call() throws Exception {
+          public HeaderCacheElement call() {
             return updateToken();
           }
         });
diff --git a/bigtable-hbase-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableOptionsFactory.java b/bigtable-hbase-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableOptionsFactory.java
index 36629d3a9..5a6a7fa96 100644
--- a/bigtable-hbase-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableOptionsFactory.java
+++ b/bigtable-hbase-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableOptionsFactory.java
@@ -274,7 +274,7 @@ public class BigtableOptionsFactory {
   /**
    * Allow namespace methods to be no-ops
    */
-  public static final String BIGTABLE_NAMESAPCE_WARNING_KEY = "google.bigtable.namespace.warnings";
+  public static final String BIGTABLE_NAMESPACE_WARNING_KEY = "google.bigtable.namespace.warnings";
 
   /**
    * <p>fromConfiguration.</p>
diff --git a/bigtable-hbase-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java b/bigtable-hbase-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java
index 3c83dda37..edf7e1ac1 100644
--- a/bigtable-hbase-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java
+++ b/bigtable-hbase-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java
@@ -1318,7 +1318,7 @@ public abstract class AbstractBigtableAdmin implements Admin {
   }
 
   private boolean provideWarningsForNamespaces() {
-    return configuration.getBoolean(BigtableOptionsFactory.BIGTABLE_NAMESAPCE_WARNING_KEY, false);
+    return configuration.getBoolean(BigtableOptionsFactory.BIGTABLE_NAMESPACE_WARNING_KEY, false);
   }
 
   /** {@inheritDoc} */


Test patch:
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestBigtableOptions.java b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestBigtableOptions.java
index f17b0eaac..91448be7e 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestBigtableOptions.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/config/TestBigtableOptions.java
@@ -84,7 +84,7 @@ public class TestBigtableOptions {
 
   @Test
   public void testNullStringsDontThrowExceptions() {
-     new BigtableOptions.Builder().build();
+    BigtableOptions.getDefaultOptions();
   }
 
   @Test
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestBigtableSession.java b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestBigtableSession.java
index fd08eaa1d..dc0540d10 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestBigtableSession.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestBigtableSession.java
@@ -19,6 +19,7 @@ package com.google.cloud.bigtable.grpc;
 import java.io.IOException;
 import java.lang.reflect.Field;
 
+import com.google.cloud.bigtable.config.CredentialOptions;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
@@ -84,7 +85,8 @@ public class TestBigtableSession {
   @Test
   public void testCreateInstanceClient() throws Throwable {
     try {
-      BigtableSession.createInstanceClient();
+      BigtableSession.createInstanceClient(new BigtableOptions.Builder().setCredentialOptions(
+          CredentialOptions.nullCredential()).build());
     } catch (IOException e) {
       if (e.getMessage().toLowerCase().contains("credentials")) {
         // ignore;  This is running on a system that doesn't have default credentails,
diff --git a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestWaitForReplication.java b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestWaitForReplication.java
index 1f4a0d5a0..af5b1a184 100644
--- a/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestWaitForReplication.java
+++ b/bigtable-client-core-parent/bigtable-client-core/src/test/java/com/google/cloud/bigtable/grpc/TestWaitForReplication.java
@@ -15,8 +15,13 @@
  */
 package com.google.cloud.bigtable.grpc;
 
-import java.util.concurrent.TimeoutException;
-
+import com.google.api.client.testing.util.MockBackOff;
+import com.google.bigtable.admin.v2.*;
+import com.google.cloud.bigtable.config.BigtableOptions;
+import io.grpc.Status;
+import io.grpc.StatusException;
+import io.grpc.stub.StreamObserver;
+import io.grpc.testing.GrpcServerRule;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
@@ -24,18 +29,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
-import com.google.api.client.testing.util.MockBackOff;
-import com.google.bigtable.admin.v2.BigtableTableAdminGrpc;
-import com.google.bigtable.admin.v2.CheckConsistencyRequest;
-import com.google.bigtable.admin.v2.CheckConsistencyResponse;
-import com.google.bigtable.admin.v2.GenerateConsistencyTokenRequest;
-import com.google.bigtable.admin.v2.GenerateConsistencyTokenResponse;
-import com.google.cloud.bigtable.config.BigtableOptions;
-
-import io.grpc.Status;
-import io.grpc.testing.GrpcServerRule;
-import io.grpc.stub.StreamObserver;
-import io.grpc.StatusException;
+import java.util.concurrent.TimeoutException;
 
 @RunWith(JUnit4.class)
 @SuppressWarnings({"unchecked", "rawtypes"})
@@ -105,9 +99,7 @@ public class TestWaitForReplication {
     service = new ConsistencyServiceImpl();
     grpcServerRule.getServiceRegistry().addService(service);
 
-    BigtableOptions options = new BigtableOptions.Builder().build();
-
-    tableAdminClient = new BigtableTableAdminGrpcClient(grpcServerRule.getChannel(), null, options);
+    tableAdminClient = new BigtableTableAdminGrpcClient(grpcServerRule.getChannel(), null, BigtableOptions.getDefaultOptions());
     backoff = new MockBackOff();
   }
 
diff --git a/bigtable-hbase-2.x-parent/bigtable-hbase-2.x-hadoop/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java b/bigtable-hbase-2.x-parent/bigtable-hbase-2.x-hadoop/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java
index 9ebab01f9..d14fb893e 100644
--- a/bigtable-hbase-2.x-parent/bigtable-hbase-2.x-hadoop/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java
+++ b/bigtable-hbase-2.x-parent/bigtable-hbase-2.x-hadoop/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java
@@ -17,6 +17,7 @@ package com.google.cloud.bigtable.hbase;
 
 import java.io.IOException;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.BufferedMutator;
@@ -45,21 +46,13 @@ public class TestBigtableConnection {
 
   @Test
   public void testTable() throws IOException {
-    try {
-      Connection connection = new BigtableConnection(BigtableConfiguration.configure("projectId", "instanceId"));
-      Admin admin = connection.getAdmin();
-      Table table = connection.getTable(TableName.valueOf("someTable"));
-      BufferedMutator mutator = connection.getBufferedMutator(TableName.valueOf("someTable"));
-      connection.close();
-    } catch (IOException e) {
-      if (e.getMessage().toLowerCase().contains("credentials")) {
-        // ignore;  This is running on a system that doesn't have default credentails,
-        // and this test is to ensure that openssl works well.  Travis isn't sent up with
-        // credentials, so this test should pass in those conditions.
-      } else {
-        throw e;
-      }
-    }
+    Configuration conf = BigtableConfiguration.configure("projectId", "instanceId");
+    conf.set(BigtableOptionsFactory.BIGTABLE_NULL_CREDENTIAL_ENABLE_KEY, "true");
+    conf.set(BigtableOptionsFactory.BIGTABLE_USE_SERVICE_ACCOUNTS_KEY, "false");
+    BigtableConnection connection = new BigtableConnection(conf);
+    Admin admin = connection.getAdmin() ;
+    Table table = connection.getTable(TableName.valueOf("someTable"));
+    BufferedMutator mutator = connection.getBufferedMutator(TableName.valueOf("someTable"));
   }
 
   @Test
diff --git a/bigtable-hbase-2.x-parent/bigtable-hbase-2.x/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java b/bigtable-hbase-2.x-parent/bigtable-hbase-2.x/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java
index 7ebb6fd0c..c524f82f6 100644
--- a/bigtable-hbase-2.x-parent/bigtable-hbase-2.x/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java
+++ b/bigtable-hbase-2.x-parent/bigtable-hbase-2.x/src/test/java/com/google/cloud/bigtable/hbase/TestBigtableConnection.java
@@ -15,6 +15,11 @@
  */
 package com.google.cloud.bigtable.hbase;
 
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.BufferedMutator;
+import org.apache.hadoop.hbase.client.Table;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -22,8 +27,10 @@ import org.junit.runners.JUnit4;
 
 import com.google.cloud.bigtable.hbase2_x.BigtableConnection;
 
+import java.io.IOException;
+
 /**
- * This is a test to ensure that BigtableConnection can find {@link BigtableConnection}
+ * This is a test to ensure that {@link BigtableConfiguration} can find {@link BigtableConnection}
  *
  */
 @RunWith(JUnit4.class)
@@ -33,4 +40,15 @@ public class TestBigtableConnection {
   public void testBigtableConnectionExists() {
     Assert.assertEquals(BigtableConnection.class, BigtableConfiguration.getConnectionClass());
   }
+
+  @Test
+  public void testTable() throws IOException {
+    Configuration conf = BigtableConfiguration.configure("projectId", "instanceId");
+    conf.set(BigtableOptionsFactory.BIGTABLE_NULL_CREDENTIAL_ENABLE_KEY, "true");
+    conf.set(BigtableOptionsFactory.BIGTABLE_USE_SERVICE_ACCOUNTS_KEY, "false");
+    BigtableConnection connection = new BigtableConnection(conf);
+    Admin admin = connection.getAdmin() ;
+    Table table = connection.getTable(TableName.valueOf("someTable"));
+    BufferedMutator mutator = connection.getBufferedMutator(TableName.valueOf("someTable"));
+  }
 }
diff --git a/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/PutMicroBenchmark.java b/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/PutMicroBenchmark.java
index f5c7be246..08f7b2093 100644
--- a/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/PutMicroBenchmark.java
+++ b/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/PutMicroBenchmark.java
@@ -74,7 +74,7 @@ public class PutMicroBenchmark {
     run(hbaseAdapter, put, getChannelPool(useRealConnection), putCount);
   }
 
-  protected static ChannelPool getChannelPool(final boolean useRealConnection)
+  protected static ManagedChannel getChannelPool(final boolean useRealConnection)
       throws IOException, GeneralSecurityException {
     if (useRealConnection) {
       return BigtableSession.createChannelPool(options.getDataHost(), options);
@@ -118,7 +118,7 @@ public class PutMicroBenchmark {
     return put;
   }
 
-  protected static void run(final HBaseRequestAdapter hbaseAdapter, final Put put, ChannelPool cp,
+  protected static void run(final HBaseRequestAdapter hbaseAdapter, final Put put, ManagedChannel cp,
       final int putCount) throws InterruptedException {
     final BigtableDataClient client = new BigtableDataGrpcClient(cp,
         BigtableSessionSharedThreadPools.getInstance().getRetryExecutor(), options);
diff --git a/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/TestBatchExecutor.java b/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/TestBatchExecutor.java
index 3d8f366c0..f54bb56ae 100644
--- a/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/TestBatchExecutor.java
+++ b/bigtable-hbase-parent/bigtable-hbase/src/test/java/com/google/cloud/bigtable/hbase/TestBatchExecutor.java
@@ -84,8 +84,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 @SuppressWarnings({"unchecked", "rawtypes"})
 public class TestBatchExecutor {
 
-  BigtableOptions DEFAULT_OPTIONS = new BigtableOptions.Builder().build();
-
   private static Put randomPut() {
     return new Put(randomBytes(8))
         .addColumn(Bytes.toBytes("cf"), Bytes.toBytes("qual"), Bytes.toBytes("SomeValue"));
@@ -240,7 +238,7 @@ public class TestBatchExecutor {
     Object[] results = new Object[2];
 
     try {
-      createExecutor(DEFAULT_OPTIONS).batch(gets, results);
+      createExecutor(BigtableOptions.getDefaultOptions()).batch(gets, results);
     } catch(RetriesExhaustedWithDetailsException ignored) {
     }
     Assert.assertTrue("first result is a result", results[0] instanceof Result);
@@ -256,7 +254,7 @@ public class TestBatchExecutor {
     setFuture(ImmutableList.of(response));
     final Callback<Result> callback = Mockito.mock(Callback.class);
     List<Get> gets = Arrays.asList(new Get(key));
-    createExecutor(DEFAULT_OPTIONS).batchCallback(gets, new Object[1], callback);
+    createExecutor(BigtableOptions.getDefaultOptions()).batchCallback(gets, new Object[1], callback);
 
     verify(callback, times(1)).update(same(BatchExecutor.NO_REGION), same(key),
       argThat(matchesRow(Adapters.FLAT_ROW_ADAPTER.adaptResponse(response))));
@@ -294,7 +292,7 @@ public class TestBatchExecutor {
         .addCell("family", ByteString.EMPTY, System.nanoTime() / 1000, cellValue).build();
     when(mockFuture.get()).thenReturn(row);
 
-    BatchExecutor underTest = createExecutor(DEFAULT_OPTIONS);
+    BatchExecutor underTest = createExecutor(BigtableOptions.getDefaultOptions());
     Result[] results = underTest.batch(gets);
     verify(mockBulkRead, times(10)).add(any(ReadRowsRequest.class));
     verify(mockBulkRead, times(1)).flush();
@@ -327,6 +325,6 @@ public class TestBatchExecutor {
 
   private Result[] batch(final List<? extends org.apache.hadoop.hbase.client.Row> actions)
       throws Exception {
-    return createExecutor(DEFAULT_OPTIONS).batch(actions);
+    return createExecutor(BigtableOptions.getDefaultOptions()).batch(actions);
   }
 }