kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From granthe...@apache.org
Subject [2/6] kudu git commit: [test] Move BaseKuduTest to a Junit Rule
Date Tue, 02 Oct 2018 19:01:53 GMT
http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestLeaderFailover.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestLeaderFailover.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestLeaderFailover.java
index bb2b954..ba108c9 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestLeaderFailover.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestLeaderFailover.java
@@ -19,24 +19,29 @@ package org.apache.kudu.client;
 import static org.apache.kudu.util.ClientTestUtil.countRowsInScan;
 import static org.apache.kudu.util.ClientTestUtil.createBasicSchemaInsert;
 import static org.apache.kudu.util.ClientTestUtil.getBasicCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getBasicSchema;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import org.apache.kudu.test.KuduTestHarness;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
-public class TestLeaderFailover extends BaseKuduTest {
+public class TestLeaderFailover {
 
   private static final String TABLE_NAME =
       TestLeaderFailover.class.getName() + "-" + System.currentTimeMillis();
   private static KuduTable table;
 
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
   @Before
   public void setUp() throws Exception {
     CreateTableOptions builder = getBasicCreateTableOptions();
-    createTable(TABLE_NAME, basicSchema, builder);
-
-    table = openTable(TABLE_NAME);
+    harness.getClient().createTable(TABLE_NAME, getBasicSchema(), builder);
+    table = harness.getClient().openTable(TABLE_NAME);
   }
 
   /**
@@ -47,16 +52,16 @@ public class TestLeaderFailover extends BaseKuduTest {
    */
   @Test(timeout = 100000)
   public void testFailover() throws Exception {
-    KuduSession session = syncClient.newSession();
+    KuduSession session = harness.getClient().newSession();
     for (int i = 0; i < 3; i++) {
       session.apply(createBasicSchemaInsert(table, i));
     }
 
     // Make sure the rows are in there before messing things up.
-    AsyncKuduScanner scanner = client.newScannerBuilder(table).build();
+    AsyncKuduScanner scanner = harness.getAsyncClient().newScannerBuilder(table).build();
     assertEquals(3, countRowsInScan(scanner));
 
-    killTabletLeader(table);
+    harness.killTabletLeader(table);
 
     for (int i = 3; i < 6; i++) {
       OperationResponse resp = session.apply(createBasicSchemaInsert(table, i));
@@ -65,7 +70,7 @@ public class TestLeaderFailover extends BaseKuduTest {
       }
     }
 
-    scanner = client.newScannerBuilder(table).build();
+    scanner = harness.getAsyncClient().newScannerBuilder(table).build();
     assertEquals(6, countRowsInScan(scanner));
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestMasterFailover.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMasterFailover.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMasterFailover.java
index 7b9a8ec..7c3237f 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMasterFailover.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMasterFailover.java
@@ -18,14 +18,17 @@ package org.apache.kudu.client;
 
 import static org.apache.kudu.util.ClientTestUtil.countRowsInScan;
 import static org.apache.kudu.util.ClientTestUtil.getBasicCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getBasicSchema;
 import static org.junit.Assert.assertEquals;
 
+import org.apache.kudu.test.KuduTestHarness;
+import org.junit.Rule;
 import org.junit.Test;
 
 /**
  * Tests {@link AsyncKuduClient} with multiple masters.
  */
-public class TestMasterFailover extends BaseKuduTest {
+public class TestMasterFailover {
   enum KillBefore {
     CREATE_CLIENT,
     CREATE_TABLE,
@@ -33,6 +36,9 @@ public class TestMasterFailover extends BaseKuduTest {
     SCAN_TABLE
   }
 
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
   @Test(timeout = 30000)
   public void testKillLeaderBeforeCreateClient() throws Exception {
     doTestKillLeader(KillBefore.CREATE_CLIENT);
@@ -52,33 +58,35 @@ public class TestMasterFailover extends BaseKuduTest {
 
   private void doTestKillLeader(KillBefore killBefore) throws Exception {
     String tableName = "TestMasterFailover-killBefore=" + killBefore;
-    int countMasters = getMasterServers().size();
+    int countMasters = harness.getMasterServers().size();
     if (countMasters < 3) {
       throw new Exception("This test requires at least 3 master servers, but only "
         + countMasters + " are specified.");
     }
 
     if (killBefore == KillBefore.CREATE_CLIENT) {
-      killLeaderMasterServer();
+      harness.killLeaderMasterServer();
     }
-    try (KuduClient c = new KuduClient.KuduClientBuilder(getMasterAddressesAsString()).build()) {
+    try (KuduClient c =
+             new KuduClient.KuduClientBuilder(harness.getMasterAddressesAsString()).build()) {
       if (killBefore == KillBefore.CREATE_TABLE) {
-        killLeaderMasterServer();
+        harness.killLeaderMasterServer();
       }
 
-      createTable(tableName, basicSchema, getBasicCreateTableOptions());
+      harness.getClient().createTable(tableName, getBasicSchema(), getBasicCreateTableOptions());
 
       if (killBefore == KillBefore.OPEN_TABLE) {
-        killLeaderMasterServer();
+        harness.killLeaderMasterServer();
       }
 
       // Test that we can open a previously created table after killing the leader master.
-      KuduTable table = openTable(tableName);
+      KuduTable table = harness.getClient().openTable(tableName);
 
       if (killBefore == KillBefore.SCAN_TABLE) {
-        killLeaderMasterServer();
+        harness.killLeaderMasterServer();
       }
-      assertEquals(0, countRowsInScan(client.newScannerBuilder(table).build()));
+      assertEquals(0,
+          countRowsInScan(harness.getAsyncClient().newScannerBuilder(table).build()));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKuduCluster.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKuduCluster.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKuduCluster.java
index c445379..bc03d3d 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKuduCluster.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKuduCluster.java
@@ -23,6 +23,8 @@ import java.io.IOException;
 import java.net.Socket;
 
 import org.apache.kudu.client.KuduClient.KuduClientBuilder;
+import org.apache.kudu.junit.RetryRule;
+import org.junit.Rule;
 import org.junit.Test;
 
 public class TestMiniKuduCluster {
@@ -31,11 +33,14 @@ public class TestMiniKuduCluster {
   private static final int NUM_MASTERS = 1;
   private static final long SLEEP_TIME_MS = 10000;
 
+  @Rule
+  public RetryRule retryRule = new RetryRule();
+
   @Test(timeout = 50000)
   public void test() throws Exception {
     try (MiniKuduCluster cluster = new MiniKuduCluster.MiniKuduClusterBuilder()
-                                                      .numMasters(NUM_MASTERS)
-                                                      .numTservers(NUM_TABLET_SERVERS)
+                                                      .numMasterServers(NUM_MASTERS)
+                                                      .numTabletServers(NUM_TABLET_SERVERS)
                                                       .build()) {
       assertEquals(NUM_MASTERS, cluster.getMasterServers().size());
       assertEquals(NUM_TABLET_SERVERS, cluster.getTabletServers().size());
@@ -75,8 +80,8 @@ public class TestMiniKuduCluster {
   public void testKerberos() throws Exception {
     FakeDNS.getInstance().install();
     try (MiniKuduCluster cluster = new MiniKuduCluster.MiniKuduClusterBuilder()
-                                                      .numMasters(NUM_MASTERS)
-                                                      .numTservers(NUM_TABLET_SERVERS)
+                                                      .numMasterServers(NUM_MASTERS)
+                                                      .numTabletServers(NUM_TABLET_SERVERS)
                                                       .enableKerberos()
                                                       .build()) {
       KuduClient client = new KuduClientBuilder(cluster.getMasterAddressesAsString()).build();
@@ -89,8 +94,8 @@ public class TestMiniKuduCluster {
   @Test(timeout = 50000)
   public void testHiveMetastoreIntegration() throws Exception {
     try (MiniKuduCluster cluster = new MiniKuduCluster.MiniKuduClusterBuilder()
-                                                      .numMasters(NUM_MASTERS)
-                                                      .numTservers(NUM_TABLET_SERVERS)
+                                                      .numMasterServers(NUM_MASTERS)
+                                                      .numTabletServers(NUM_TABLET_SERVERS)
                                                       .enableHiveMetastoreIntegration()
                                                       .build()) {
       KuduClient client = new KuduClientBuilder(cluster.getMasterAddressesAsString()).build();

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestMultipleLeaderFailover.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMultipleLeaderFailover.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMultipleLeaderFailover.java
index a9f5cd8..3152c33 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMultipleLeaderFailover.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMultipleLeaderFailover.java
@@ -16,18 +16,26 @@
 // under the License.
 package org.apache.kudu.client;
 
+import static org.apache.kudu.test.KuduTestHarness.DEFAULT_SLEEP;
 import static org.apache.kudu.util.AssertHelpers.assertEventuallyTrue;
 import static org.apache.kudu.util.ClientTestUtil.countRowsInScan;
 import static org.apache.kudu.util.ClientTestUtil.createBasicSchemaInsert;
 import static org.apache.kudu.util.ClientTestUtil.getBasicCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getBasicSchema;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import java.util.List;
+
+import org.apache.kudu.test.KuduTestHarness;
 import org.apache.kudu.util.AssertHelpers.BooleanExpression;
+import org.junit.Rule;
 import org.junit.Test;
 
-public class TestMultipleLeaderFailover extends BaseKuduTest {
+public class TestMultipleLeaderFailover {
+
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
 
   private void waitUntilRowCount(final KuduTable table, final int rowCount, long timeoutMs)
       throws Exception {
@@ -35,7 +43,7 @@ public class TestMultipleLeaderFailover extends BaseKuduTest {
         new BooleanExpression() {
           @Override
           public boolean get() throws Exception {
-            AsyncKuduScanner scanner = client.newScannerBuilder(table).build();
+            AsyncKuduScanner scanner = harness.getAsyncClient().newScannerBuilder(table).build();
             int read_count = countRowsInScan(scanner);
             return read_count == rowCount;
           }
@@ -53,10 +61,10 @@ public class TestMultipleLeaderFailover extends BaseKuduTest {
     CreateTableOptions builder = getBasicCreateTableOptions();
     String tableName =
         TestMultipleLeaderFailover.class.getName() + "-" + System.currentTimeMillis();
-    createTable(tableName, basicSchema, builder);
+    harness.getClient().createTable(tableName, getBasicSchema(), builder);
 
-    table = openTable(tableName);
-    KuduSession session = syncClient.newSession();
+    table = harness.getClient().openTable(tableName);
+    KuduSession session = harness.getClient().newSession();
     final int ROWS_PER_ITERATION = 3;
     final int NUM_ITERATIONS = 10;
     final int TOTAL_ROWS_TO_INSERT = ROWS_PER_ITERATION + NUM_ITERATIONS * ROWS_PER_ITERATION;
@@ -71,7 +79,7 @@ public class TestMultipleLeaderFailover extends BaseKuduTest {
     for (int i = 0; i < NUM_ITERATIONS; i++) {
       List<LocatedTablet> tablets = table.getTabletsLocations(DEFAULT_SLEEP);
       assertEquals(1, tablets.size());
-      killTabletLeader(tablets.get(0));
+      harness.killTabletLeader(tablets.get(0));
 
       for (int j = 0; j < ROWS_PER_ITERATION; j++) {
         OperationResponse resp = session.apply(createBasicSchemaInsert(table, currentRows));
@@ -81,7 +89,7 @@ public class TestMultipleLeaderFailover extends BaseKuduTest {
         currentRows++;
       }
 
-      startAllTabletServers();
+      harness.startAllTabletServers();
       // Read your writes hasn't been enabled, so we need to use a helper function to poll.
       waitUntilRowCount(table, currentRows, DEFAULT_SLEEP);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestNegotiation.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestNegotiation.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestNegotiation.java
index 9d01e37..91f8273 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestNegotiation.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestNegotiation.java
@@ -17,7 +17,9 @@
 
 package org.apache.kudu.client;
 
+import org.apache.kudu.junit.RetryRule;
 import org.apache.kudu.util.CapturingLogAppender;
+import org.junit.Rule;
 import org.junit.Test;
 
 import java.io.Closeable;
@@ -26,6 +28,9 @@ import static junit.framework.TestCase.assertTrue;
 
 public class TestNegotiation {
 
+  @Rule
+  public RetryRule retryRule = new RetryRule();
+
   /**
    * Test that a non-Kerberized client will use SASL PLAIN to connect to a
    * Kerberized server which doesn't require authentication. Regression test for
@@ -37,12 +42,12 @@ public class TestNegotiation {
     MiniKuduCluster.MiniKuduClusterBuilder clusterBuilder =
         new MiniKuduCluster.MiniKuduClusterBuilder();
 
-    clusterBuilder.numMasters(1)
-                  .numTservers(0)
+    clusterBuilder.numMasterServers(1)
+                  .numTabletServers(0)
                   .enableKerberos()
-                  .addMasterFlag("--rpc-authentication=optional")
-                  .addMasterFlag("--rpc-trace-negotiation")
-                  .addMasterFlag("--user-acl=*");
+                  .addMasterServerFlag("--rpc-authentication=optional")
+                  .addMasterServerFlag("--rpc-trace-negotiation")
+                  .addMasterServerFlag("--user-acl=*");
 
     CapturingLogAppender cla = new CapturingLogAppender();
     try (MiniKuduCluster cluster = clusterBuilder.build()) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
index 1e7605b..34a83ed 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestPartitionPruner.java
@@ -22,6 +22,9 @@ import java.util.ArrayList;
 import java.util.List;
 
 import com.google.common.collect.ImmutableList;
+import org.apache.kudu.test.KuduTestHarness;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.kudu.ColumnSchema;
@@ -29,7 +32,17 @@ import org.apache.kudu.Schema;
 import org.apache.kudu.Type;
 import org.apache.kudu.client.KuduPredicate.ComparisonOp;
 
-public class TestPartitionPruner extends BaseKuduTest {
+public class TestPartitionPruner {
+
+  private KuduClient client;
+
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
+  @Before
+  public void setUp() {
+    client = harness.getClient();
+  }
 
   /**
    * Counts the partitions touched by a scan with optional primary key bounds.
@@ -46,7 +59,7 @@ public class TestPartitionPruner extends BaseKuduTest {
                                          List<Partition> partitions,
                                          byte[] lowerBoundPrimaryKey,
                                          byte[] upperBoundPrimaryKey) throws Exception {
-    KuduScanToken.KuduScanTokenBuilder scanBuilder = syncClient.newScanTokenBuilder(table);
+    KuduScanToken.KuduScanTokenBuilder scanBuilder = client.newScanTokenBuilder(table);
 
     if (lowerBoundPrimaryKey != null) {
       PartialRow lower = table.getSchema().newPartialRow();
@@ -120,7 +133,7 @@ public class TestPartitionPruner extends BaseKuduTest {
                                byte[] upperBoundPartitionKey,
                                KuduPredicate... predicates) {
     // Partition key bounds can't be applied to the ScanTokenBuilder.
-    KuduScanner.KuduScannerBuilder scanBuilder = syncClient.newScannerBuilder(table);
+    KuduScanner.KuduScannerBuilder scanBuilder = client.newScannerBuilder(table);
 
     for (KuduPredicate predicate : predicates) {
       scanBuilder.addPredicate(predicate);
@@ -146,7 +159,7 @@ public class TestPartitionPruner extends BaseKuduTest {
     // Check that the scan token builder comes up with the same amount.
     // The scan token builder does not allow for upper/lower partition keys.
     if (lowerBoundPartitionKey == null && upperBoundPartitionKey == null) {
-      KuduScanToken.KuduScanTokenBuilder tokenBuilder = syncClient.newScanTokenBuilder(table);
+      KuduScanToken.KuduScanTokenBuilder tokenBuilder = client.newScanTokenBuilder(table);
 
       for (KuduPredicate predicate : predicates) {
         tokenBuilder.addPredicate(predicate);
@@ -165,7 +178,7 @@ public class TestPartitionPruner extends BaseKuduTest {
    */
   private List<Partition> getTablePartitions(KuduTable table) {
     List<Partition> partitions = new ArrayList<>();
-    for (KuduScanToken token : syncClient.newScanTokenBuilder(table).build()) {
+    for (KuduScanToken token : client.newScanTokenBuilder(table).build()) {
       partitions.add(token.getTablet().getPartition());
     }
     return partitions;
@@ -202,8 +215,8 @@ public class TestPartitionPruner extends BaseKuduTest {
 
     String tableName = "testPrimaryKeyRangePruning-" + System.currentTimeMillis();
 
-    syncClient.createTable(tableName, schema, tableBuilder);
-    KuduTable table = syncClient.openTable(tableName);
+    client.createTable(tableName, schema, tableBuilder);
+    KuduTable table = client.openTable(tableName);
     List<Partition> partitions = getTablePartitions(table);
 
     byte min = Byte.MIN_VALUE;
@@ -289,8 +302,8 @@ public class TestPartitionPruner extends BaseKuduTest {
 
     String tableName = "testPrimaryKeyPrefixRangePruning-" + System.currentTimeMillis();
 
-    syncClient.createTable(tableName, schema, tableBuilder);
-    KuduTable table = syncClient.openTable(tableName);
+    client.createTable(tableName, schema, tableBuilder);
+    KuduTable table = client.openTable(tableName);
     List<Partition> partitions = getTablePartitions(table);
 
     byte min = Byte.MIN_VALUE;
@@ -372,8 +385,8 @@ public class TestPartitionPruner extends BaseKuduTest {
     tableBuilder.addSplitRow(split);
 
     String tableName = "testRangePartitionPruning-" + System.currentTimeMillis();
-    syncClient.createTable(tableName, schema, tableBuilder);
-    KuduTable table = syncClient.openTable(tableName);
+    client.createTable(tableName, schema, tableBuilder);
+    KuduTable table = client.openTable(tableName);
     List<Partition> partitions = getTablePartitions(table);
 
     // No Predicates
@@ -560,8 +573,8 @@ public class TestPartitionPruner extends BaseKuduTest {
     tableBuilder.addHashPartitions(ImmutableList.of("b", "c"), 2);
 
     String tableName = "testHashPartitionPruning-" + System.currentTimeMillis();
-    syncClient.createTable(tableName, schema, tableBuilder);
-    KuduTable table = syncClient.openTable(tableName);
+    client.createTable(tableName, schema, tableBuilder);
+    KuduTable table = client.openTable(tableName);
     List<Partition> partitions = getTablePartitions(table);
 
     // No Predicates
@@ -630,8 +643,8 @@ public class TestPartitionPruner extends BaseKuduTest {
     tableBuilder.addHashPartitions(ImmutableList.of("c"), 3);
 
     String tableName = "testInListHashPartitionPruning-" + System.currentTimeMillis();
-    syncClient.createTable(tableName, schema, tableBuilder);
-    KuduTable table = syncClient.openTable(tableName);
+    client.createTable(tableName, schema, tableBuilder);
+    KuduTable table = client.openTable(tableName);
     List<Partition> partitions = getTablePartitions(table);
 
     // a in [0, 1];
@@ -680,8 +693,8 @@ public class TestPartitionPruner extends BaseKuduTest {
     tableBuilder.addHashPartitions(ImmutableList.of("b", "c"), 3);
 
     String tableName = "testMultiColumnInListHashPartitionPruning-" + System.currentTimeMillis();
-    syncClient.createTable(tableName, schema, tableBuilder);
-    KuduTable table = syncClient.openTable(tableName);
+    client.createTable(tableName, schema, tableBuilder);
+    KuduTable table = client.openTable(tableName);
     List<Partition> partitions = getTablePartitions(table);
 
     // a in [0, 1];
@@ -753,8 +766,8 @@ public class TestPartitionPruner extends BaseKuduTest {
     tableBuilder.addHashPartitions(ImmutableList.of("host", "metric"), 2);
 
     String tableName = "testPruning-" + System.currentTimeMillis();
-    syncClient.createTable(tableName, schema, tableBuilder);
-    KuduTable table = syncClient.openTable(tableName);
+    client.createTable(tableName, schema, tableBuilder);
+    KuduTable table = client.openTable(tableName);
     List<Partition> partitions = getTablePartitions(table);
 
     // No Predicates

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowErrors.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowErrors.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowErrors.java
index 4d9c41f..3290bea 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowErrors.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowErrors.java
@@ -16,26 +16,36 @@
 // under the License.
 package org.apache.kudu.client;
 
+import static org.apache.kudu.test.KuduTestHarness.DEFAULT_SLEEP;
 import static org.apache.kudu.util.ClientTestUtil.createBasicSchemaInsert;
 import static org.apache.kudu.util.ClientTestUtil.createFourTabletsTableWithNineRows;
 import static org.apache.kudu.util.ClientTestUtil.getBasicCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getBasicSchema;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 
+import org.apache.kudu.Schema;
+import org.apache.kudu.test.KuduTestHarness;
+import org.junit.Rule;
 import org.junit.Test;
 
-public class TestRowErrors extends BaseKuduTest {
+public class TestRowErrors {
+
+  private static final Schema basicSchema = getBasicSchema();
 
   private static KuduTable table;
 
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
   @Test(timeout = 100000)
   public void singleTabletTest() throws Exception {
     String tableName = TestRowErrors.class.getName() + "-" + System.currentTimeMillis();
-    createTable(tableName, basicSchema, getBasicCreateTableOptions());
-    table = openTable(tableName);
-    AsyncKuduSession session = client.newSession();
+    harness.getClient().createTable(tableName, basicSchema, getBasicCreateTableOptions());
+    table = harness.getClient().openTable(tableName);
+    AsyncKuduSession session = harness.getAsyncClient().newSession();
 
     // Insert 3 rows to play with.
     for (int i = 0; i < 3; i++) {
@@ -70,9 +80,9 @@ public class TestRowErrors extends BaseKuduTest {
   @Test(timeout = 100000)
   public void multiTabletTest() throws Exception {
     String tableName = TestRowErrors.class.getName() + "-" + System.currentTimeMillis();
-    createFourTabletsTableWithNineRows(client, tableName, DEFAULT_SLEEP);
-    table = openTable(tableName);
-    KuduSession session = syncClient.newSession();
+    createFourTabletsTableWithNineRows(harness.getAsyncClient(), tableName, DEFAULT_SLEEP);
+    table = harness.getClient().openTable(tableName);
+    KuduSession session = harness.getClient().newSession();
     session.setFlushMode(KuduSession.FlushMode.AUTO_FLUSH_BACKGROUND);
 
     int dupRows = 3;

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowResult.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowResult.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowResult.java
index 47fa15e..f64a1d4 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowResult.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestRowResult.java
@@ -18,6 +18,7 @@ package org.apache.kudu.client;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.kudu.util.ClientTestUtil.getAllTypesCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getSchemaWithAllTypes;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -26,23 +27,31 @@ import java.math.BigDecimal;
 import java.nio.ByteBuffer;
 import java.sql.Timestamp;
 
+import org.apache.kudu.Schema;
+import org.apache.kudu.test.KuduTestHarness;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.kudu.Type;
 
-public class TestRowResult extends BaseKuduTest {
+public class TestRowResult {
 
   // Generate a unique table name
   private static final String TABLE_NAME =
       TestRowResult.class.getName() + "-" + System.currentTimeMillis();
 
+  private static final Schema allTypesSchema = getSchemaWithAllTypes();
+
   private static KuduTable table;
 
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
   @Before
   public void setUp() throws Exception {
-    createTable(TABLE_NAME, allTypesSchema, getAllTypesCreateTableOptions());
-    table = openTable(TABLE_NAME);
+    harness.getClient().createTable(TABLE_NAME, allTypesSchema, getAllTypesCreateTableOptions());
+    table = harness.getClient().openTable(TABLE_NAME);
   }
 
   @Test(timeout = 10000)
@@ -66,10 +75,11 @@ public class TestRowResult extends BaseKuduTest {
     row.addTimestamp(11, new Timestamp(11));
     row.addDecimal(12, BigDecimal.valueOf(12345, 3));
 
-    KuduSession session = syncClient.newSession();
+    KuduClient client = harness.getClient();
+    KuduSession session = client.newSession();
     session.apply(insert);
 
-    KuduScanner scanner = syncClient.newScannerBuilder(table).build();
+    KuduScanner scanner = client.newScannerBuilder(table).build();
     while (scanner.hasMoreRows()) {
       RowResultIterator it = scanner.nextRows();
       assertTrue(it.hasNext());

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanPredicate.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanPredicate.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanPredicate.java
index 7682d6d..1ec209d 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanPredicate.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanPredicate.java
@@ -25,7 +25,10 @@ import java.util.TreeSet;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSortedSet;
+import org.apache.kudu.test.KuduTestHarness;
 import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.kudu.ColumnSchema;
@@ -34,7 +37,19 @@ import org.apache.kudu.Type;
 import org.apache.kudu.client.KuduPredicate.ComparisonOp;
 import org.apache.kudu.util.DecimalUtil;
 
-public class TestScanPredicate extends BaseKuduTest {
+public class TestScanPredicate {
+
+  private KuduClient client;
+  private AsyncKuduClient asyncClient;
+
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
+  @Before
+  public void setUp() {
+    client = harness.getClient();
+    asyncClient = harness.getAsyncClient();
+  }
 
   private Schema createTableSchema(Type type) {
     ColumnSchema key = new ColumnSchema.ColumnSchemaBuilder("key", Type.INT64).key(true).build();
@@ -47,7 +62,7 @@ public class TestScanPredicate extends BaseKuduTest {
   }
 
   private int countRows(KuduTable table, KuduPredicate... predicates) throws Exception {
-    KuduScanner.KuduScannerBuilder scanBuilder =  new KuduScanner.KuduScannerBuilder(client, table);
+    KuduScanner.KuduScannerBuilder scanBuilder =  new KuduScanner.KuduScannerBuilder(asyncClient, table);
     for (KuduPredicate predicate : predicates) {
       scanBuilder.addPredicate(predicate);
     }
@@ -255,11 +270,11 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testBoolPredicates() throws Exception {
     Schema schema = createTableSchema(Type.BOOL);
-    syncClient.createTable("bool-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("bool-table");
+    client.createTable("bool-table", schema, createTableOptions());
+    KuduTable table = client.openTable("bool-table");
 
     NavigableSet<Boolean> values = ImmutableSortedSet.of(false, true);
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (boolean value : values) {
@@ -307,11 +322,11 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testBytePredicates() throws Exception {
     Schema schema = createTableSchema(Type.INT8);
-    syncClient.createTable("byte-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("byte-table");
+    client.createTable("byte-table", schema, createTableOptions());
+    KuduTable table = client.openTable("byte-table");
 
     NavigableSet<Long> values = createIntegerValues(Type.INT8);
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (long value : values) {
@@ -332,13 +347,13 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testShortPredicates() throws Exception {
     Schema schema = createTableSchema(Type.INT16);
-    syncClient.createTable("short-table", schema,
+    client.createTable("short-table", schema,
                            new CreateTableOptions().setRangePartitionColumns(
                                ImmutableList.<String>of()));
-    KuduTable table = syncClient.openTable("short-table");
+    KuduTable table = client.openTable("short-table");
 
     NavigableSet<Long> values = createIntegerValues(Type.INT16);
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (long value : values) {
@@ -359,11 +374,11 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testIntPredicates() throws Exception {
     Schema schema = createTableSchema(Type.INT32);
-    syncClient.createTable("int-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("int-table");
+    client.createTable("int-table", schema, createTableOptions());
+    KuduTable table = client.openTable("int-table");
 
     NavigableSet<Long> values = createIntegerValues(Type.INT32);
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (long value : values) {
@@ -384,13 +399,13 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testLongPredicates() throws Exception {
     Schema schema = createTableSchema(Type.INT64);
-    syncClient.createTable("long-table", schema,
+    client.createTable("long-table", schema,
                            new CreateTableOptions().setRangePartitionColumns(
                                ImmutableList.<String>of()));
-    KuduTable table = syncClient.openTable("long-table");
+    KuduTable table = client.openTable("long-table");
 
     NavigableSet<Long> values = createIntegerValues(Type.INT64);
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (long value : values) {
@@ -411,11 +426,11 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testTimestampPredicate() throws Exception {
     Schema schema = createTableSchema(Type.INT64);
-    syncClient.createTable("timestamp-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("timestamp-table");
+    client.createTable("timestamp-table", schema, createTableOptions());
+    KuduTable table = client.openTable("timestamp-table");
 
     NavigableSet<Long> values = createIntegerValues(Type.INT64);
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (long value : values) {
@@ -436,12 +451,12 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testFloatPredicates() throws Exception {
     Schema schema = createTableSchema(Type.FLOAT);
-    syncClient.createTable("float-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("float-table");
+    client.createTable("float-table", schema, createTableOptions());
+    KuduTable table = client.openTable("float-table");
 
     NavigableSet<Float> values = createFloatValues();
     List<Float> testValues = createFloatTestValues();
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (float value : values) {
@@ -495,12 +510,12 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testDoublePredicates() throws Exception {
     Schema schema = createTableSchema(Type.DOUBLE);
-    syncClient.createTable("double-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("double-table");
+    client.createTable("double-table", schema, createTableOptions());
+    KuduTable table = client.openTable("double-table");
 
     NavigableSet<Double> values = createDoubleValues();
     List<Double> testValues = createDoubleTestValues();
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (double value : values) {
@@ -558,12 +573,12 @@ public class TestScanPredicate extends BaseKuduTest {
         .typeAttributes(DecimalUtil.typeAttributes(4, 2)).nullable(true).build();
     Schema schema = new Schema(ImmutableList.of(key, val));
 
-    syncClient.createTable("decimal-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("decimal-table");
+    client.createTable("decimal-table", schema, createTableOptions());
+    KuduTable table = client.openTable("decimal-table");
 
     NavigableSet<BigDecimal> values = createDecimalValues();
     List<BigDecimal> testValues = createDecimalTestValues();
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (BigDecimal value : values) {
@@ -617,12 +632,12 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testStringPredicates() throws Exception {
     Schema schema = createTableSchema(Type.STRING);
-    syncClient.createTable("string-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("string-table");
+    client.createTable("string-table", schema, createTableOptions());
+    KuduTable table = client.openTable("string-table");
 
     NavigableSet<String> values = createStringValues();
     List<String> testValues = createStringTestValues();
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (String value : values) {
@@ -676,12 +691,12 @@ public class TestScanPredicate extends BaseKuduTest {
   @Test
   public void testBinaryPredicates() throws Exception {
     Schema schema = createTableSchema(Type.BINARY);
-    syncClient.createTable("binary-table", schema, createTableOptions());
-    KuduTable table = syncClient.openTable("binary-table");
+    client.createTable("binary-table", schema, createTableOptions());
+    KuduTable table = client.openTable("binary-table");
 
     NavigableSet<String> values = createStringValues();
     List<String> testValues = createStringTestValues();
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     long i = 0;
     for (String value : values) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanToken.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanToken.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanToken.java
index 0e3794f..55f6f78 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanToken.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestScanToken.java
@@ -21,8 +21,12 @@ import com.google.common.collect.ImmutableList;
 import org.apache.kudu.ColumnSchema;
 import org.apache.kudu.Schema;
 import org.apache.kudu.Type;
+import org.apache.kudu.test.KuduTestHarness;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.List;
@@ -35,10 +39,23 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-public class TestScanToken extends BaseKuduTest {
+public class TestScanToken {
+  private static final Logger LOG = LoggerFactory.getLogger(TestKuduClient.class);
 
   private static final String testTableName = "TestScanToken";
 
+  private KuduClient client;
+  private AsyncKuduClient asyncClient;
+
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
+  @Before
+  public void setUp() {
+    client = harness.getClient();
+    asyncClient = harness.getAsyncClient();
+  }
+
   /**
    * Tests scan tokens by creating a set of scan tokens, serializing them, and
    * then executing them in parallel with separate client instances. This
@@ -61,11 +78,11 @@ public class TestScanToken extends BaseKuduTest {
       splitRow.addString("key", "key_50");
       createOptions.addSplitRow(splitRow);
 
-      syncClient.createTable(testTableName, schema, createOptions);
+      client.createTable(testTableName, schema, createOptions);
 
-      KuduSession session = syncClient.newSession();
+      KuduSession session = client.newSession();
       session.setFlushMode(SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND);
-      KuduTable table = syncClient.openTable(testTableName);
+      KuduTable table = client.openTable(testTableName);
       for (int i = 0; i < 100; i++) {
         Insert insert = table.newInsert();
         PartialRow row = insert.getRow();
@@ -76,7 +93,7 @@ public class TestScanToken extends BaseKuduTest {
       }
       session.flush();
 
-      KuduScanToken.KuduScanTokenBuilder tokenBuilder = syncClient.newScanTokenBuilder(table);
+      KuduScanToken.KuduScanTokenBuilder tokenBuilder = client.newScanTokenBuilder(table);
       tokenBuilder.batchSizeBytes(0);
       tokenBuilder.setProjectedColumnIndexes(ImmutableList.<Integer>of());
       List<KuduScanToken> tokens = tokenBuilder.build();
@@ -86,13 +103,13 @@ public class TestScanToken extends BaseKuduTest {
       // the first call to the tablet server won't return
       // any data.
       {
-        KuduScanner scanner = tokens.get(0).intoScanner(syncClient);
+        KuduScanner scanner = tokens.get(0).intoScanner(client);
         assertEquals(0, scanner.nextRows().getNumRows());
       }
 
       for (KuduScanToken token : tokens) {
         // Sanity check to make sure the debug printing does not throw.
-        LOG.debug(KuduScanToken.stringifySerializedToken(token.serialize(), syncClient));
+        LOG.debug(KuduScanToken.stringifySerializedToken(token.serialize(), client));
       }
     } finally {
       AsyncKuduClient.FETCH_TABLETS_PER_RANGE_LOOKUP = saveFetchTablets;
@@ -124,11 +141,11 @@ public class TestScanToken extends BaseKuduTest {
     split.addString("key", "k");
     createOptions.addSplitRow(split);
 
-    syncClient.createTable(testTableName, schema, createOptions);
+    client.createTable(testTableName, schema, createOptions);
 
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND);
-    KuduTable table = syncClient.openTable(testTableName);
+    KuduTable table = client.openTable(testTableName);
     for (char c = 'a'; c < 'f'; c++) {
       Insert insert = table.newInsert();
       PartialRow row = insert.getRow();
@@ -147,18 +164,18 @@ public class TestScanToken extends BaseKuduTest {
     }
     session.flush();
 
-    KuduScanToken.KuduScanTokenBuilder tokenBuilder = syncClient.newScanTokenBuilder(table);
+    KuduScanToken.KuduScanTokenBuilder tokenBuilder = client.newScanTokenBuilder(table);
     tokenBuilder.setProjectedColumnIndexes(ImmutableList.<Integer>of());
     List<KuduScanToken> tokens = tokenBuilder.build();
     assertEquals(6, tokens.size());
     assertEquals('f' - 'a' + 'z' - 'h',
                  countScanTokenRows(tokens,
-                                    syncClient.getMasterAddressesAsString(),
-                                    syncClient.getDefaultOperationTimeoutMs()));
+                     client.getMasterAddressesAsString(),
+                     client.getDefaultOperationTimeoutMs()));
 
     for (KuduScanToken token : tokens) {
       // Sanity check to make sure the debug printing does not throw.
-      LOG.debug(KuduScanToken.stringifySerializedToken(token.serialize(), syncClient));
+      LOG.debug(KuduScanToken.stringifySerializedToken(token.serialize(), client));
     }
   }
 
@@ -175,31 +192,31 @@ public class TestScanToken extends BaseKuduTest {
     CreateTableOptions createOptions = new CreateTableOptions();
     createOptions.setRangePartitionColumns(ImmutableList.<String>of());
     createOptions.setNumReplicas(1);
-    syncClient.createTable(testTableName, schema, createOptions);
+    client.createTable(testTableName, schema, createOptions);
 
-    KuduTable table = syncClient.openTable(testTableName);
+    KuduTable table = client.openTable(testTableName);
 
-    KuduScanToken.KuduScanTokenBuilder tokenBuilder = syncClient.newScanTokenBuilder(table);
+    KuduScanToken.KuduScanTokenBuilder tokenBuilder = client.newScanTokenBuilder(table);
     List<KuduScanToken> tokens = tokenBuilder.build();
     assertEquals(1, tokens.size());
     KuduScanToken token = tokens.get(0);
 
     // Drop a column
-    syncClient.alterTable(testTableName, new AlterTableOptions().dropColumn("a"));
+    client.alterTable(testTableName, new AlterTableOptions().dropColumn("a"));
     try {
-      token.intoScanner(syncClient);
+      token.intoScanner(client);
       fail();
     } catch (IllegalArgumentException e) {
       assertTrue(e.getMessage().contains("Unknown column"));
     }
 
     // Add back the column with the wrong type.
-    syncClient.alterTable(
+    client.alterTable(
         testTableName,
         new AlterTableOptions().addColumn(
             new ColumnSchema.ColumnSchemaBuilder("a", Type.STRING).nullable(true).build()));
     try {
-      token.intoScanner(syncClient);
+      token.intoScanner(client);
       fail();
     } catch (IllegalStateException e) {
       assertTrue(e.getMessage().contains(
@@ -207,13 +224,13 @@ public class TestScanToken extends BaseKuduTest {
     }
 
     // Add the column with the wrong nullability.
-    syncClient.alterTable(
+    client.alterTable(
         testTableName,
         new AlterTableOptions().dropColumn("a")
                                .addColumn(new ColumnSchema.ColumnSchemaBuilder("a", Type.INT64)
                                                           .nullable(true).build()));
     try {
-      token.intoScanner(syncClient);
+      token.intoScanner(client);
       fail();
     } catch (IllegalStateException e) {
       assertTrue(e.getMessage().contains(
@@ -221,13 +238,13 @@ public class TestScanToken extends BaseKuduTest {
     }
 
     // Add the column with the correct type and nullability.
-    syncClient.alterTable(
+    client.alterTable(
         testTableName,
         new AlterTableOptions().dropColumn("a")
                                .addColumn(new ColumnSchema.ColumnSchemaBuilder("a", Type.INT64)
                                                           .nullable(false)
                                                           .defaultValue(0L).build()));
-    token.intoScanner(syncClient);
+    token.intoScanner(client);
   }
 
   /** Test that scanRequestTimeout makes it from the scan token to the underlying Scanner class. */
@@ -235,15 +252,15 @@ public class TestScanToken extends BaseKuduTest {
   public void testScanRequestTimeout() throws IOException {
     final int NUM_ROWS_DESIRED = 100;
     final int SCAN_REQUEST_TIMEOUT_MS = 20;
-    KuduTable table = createDefaultTable(syncClient, testTableName);
-    loadDefaultTable(syncClient, testTableName, NUM_ROWS_DESIRED);
+    KuduTable table = createDefaultTable(client, testTableName);
+    loadDefaultTable(client, testTableName, NUM_ROWS_DESIRED);
     KuduScanToken.KuduScanTokenBuilder builder =
-        new KuduScanToken.KuduScanTokenBuilder(client, table);
+        new KuduScanToken.KuduScanTokenBuilder(asyncClient, table);
     builder.scanRequestTimeout(SCAN_REQUEST_TIMEOUT_MS);
     List<KuduScanToken> tokens = builder.build();
     for (KuduScanToken token : tokens) {
       byte[] serialized = token.serialize();
-      KuduScanner scanner = KuduScanToken.deserializeIntoScanner(serialized, syncClient);
+      KuduScanner scanner = KuduScanToken.deserializeIntoScanner(serialized, client);
       assertEquals(SCAN_REQUEST_TIMEOUT_MS, scanner.getScanRequestTimeout());
     }
   }

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestScannerMultiTablet.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestScannerMultiTablet.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestScannerMultiTablet.java
index 54a1cf3..4856e25 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestScannerMultiTablet.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestScannerMultiTablet.java
@@ -17,6 +17,7 @@
 package org.apache.kudu.client;
 
 import static org.apache.kudu.Type.STRING;
+import static org.apache.kudu.test.KuduTestHarness.DEFAULT_SLEEP;
 import static org.apache.kudu.util.ClientTestUtil.countRowsInScan;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
@@ -29,8 +30,10 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import com.stumbleupon.async.Deferred;
 
+import org.apache.kudu.test.KuduTestHarness;
 import org.junit.Before;
 import org.junit.Ignore;
+import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.kudu.client.Client.ScanTokenPB;
@@ -38,7 +41,7 @@ import org.apache.kudu.ColumnSchema;
 import org.apache.kudu.Common;
 import org.apache.kudu.Schema;
 
-public class TestScannerMultiTablet extends BaseKuduTest {
+public class TestScannerMultiTablet {
   // Generate a unique table name
   private static final String TABLE_NAME =
       TestScannerMultiTablet.class.getName()+"-"+System.currentTimeMillis();
@@ -50,6 +53,11 @@ public class TestScannerMultiTablet extends BaseKuduTest {
    */
   private static long beforeWriteTimestamp;
   private KuduTable table;
+  private KuduClient client;
+  private AsyncKuduClient asyncClient;
+
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
 
   @Before
   public void setUp() throws Exception {
@@ -64,10 +72,10 @@ public class TestScannerMultiTablet extends BaseKuduTest {
       builder.addSplitRow(splitRow);
     }
 
-    createTable(TABLE_NAME, schema, builder);
+    harness.getClient().createTable(TABLE_NAME, schema, builder);
 
-    KuduTable insertTable = openTable(TABLE_NAME);
-    AsyncKuduSession session = client.newSession();
+    KuduTable insertTable = harness.getClient().openTable(TABLE_NAME);
+    AsyncKuduSession session = harness.getAsyncClient().newSession();
     session.setFlushMode(AsyncKuduSession.FlushMode.AUTO_FLUSH_SYNC);
 
     // The data layout ends up like this:
@@ -88,14 +96,16 @@ public class TestScannerMultiTablet extends BaseKuduTest {
       }
     }
 
-    beforeWriteTimestamp = client.getLastPropagatedTimestamp();
+    beforeWriteTimestamp = harness.getAsyncClient().getLastPropagatedTimestamp();
 
     // Reset the clients in order to clear the propagated timestamp, which may
     // have been set if other test cases ran before this one. This ensures
     // that all tests set their own state.
-    resetClients();
+    harness.resetClients();
     // Reopen the table using the reset client.
-    table = openTable(TABLE_NAME);
+    table = harness.getClient().openTable(TABLE_NAME);
+    client = harness.getClient();
+    asyncClient = harness.getAsyncClient();
   }
 
   // Test various combinations of start/end row keys.
@@ -173,29 +183,29 @@ public class TestScannerMultiTablet extends BaseKuduTest {
   @Test(timeout = 100000)
   public void testProjections() throws Exception {
     // Test with column names.
-    AsyncKuduScanner.AsyncKuduScannerBuilder builder = client.newScannerBuilder(table);
+    AsyncKuduScanner.AsyncKuduScannerBuilder builder = asyncClient.newScannerBuilder(table);
     builder.setProjectedColumnNames(Lists.newArrayList(schema.getColumnByIndex(0).getName(),
         schema.getColumnByIndex(1).getName()));
     buildScannerAndCheckColumnsCount(builder, 2);
 
     // Test with column indexes.
-    builder = client.newScannerBuilder(table);
+    builder = asyncClient.newScannerBuilder(table);
     builder.setProjectedColumnIndexes(Lists.newArrayList(0, 1));
     buildScannerAndCheckColumnsCount(builder, 2);
 
     // Test with column names overriding indexes.
-    builder = client.newScannerBuilder(table);
+    builder = asyncClient.newScannerBuilder(table);
     builder.setProjectedColumnIndexes(Lists.newArrayList(0, 1));
     builder.setProjectedColumnNames(Lists.newArrayList(schema.getColumnByIndex(0).getName()));
     buildScannerAndCheckColumnsCount(builder, 1);
 
     // Test with keys last with indexes.
-    builder = client.newScannerBuilder(table);
+    builder = asyncClient.newScannerBuilder(table);
     builder.setProjectedColumnIndexes(Lists.newArrayList(2, 1, 0));
     buildScannerAndCheckColumnsCount(builder, 3);
 
     // Test with keys last with column names.
-    builder = client.newScannerBuilder(table);
+    builder = asyncClient.newScannerBuilder(table);
     builder.setProjectedColumnNames(Lists.newArrayList(schema.getColumnByIndex(2).getName(),
         schema.getColumnByIndex(0).getName()));
     buildScannerAndCheckColumnsCount(builder, 2);
@@ -203,13 +213,13 @@ public class TestScannerMultiTablet extends BaseKuduTest {
 
   @Test(timeout = 100000)
   public void testReplicaSelections() throws Exception {
-    AsyncKuduScanner scanner = client.newScannerBuilder(table)
+    AsyncKuduScanner scanner = asyncClient.newScannerBuilder(table)
         .replicaSelection(ReplicaSelection.LEADER_ONLY)
         .build();
 
     assertEquals(9, countRowsInScan(scanner));
 
-    scanner = client.newScannerBuilder(table)
+    scanner = asyncClient.newScannerBuilder(table)
         .replicaSelection(ReplicaSelection.CLOSEST_REPLICA)
         .build();
 
@@ -226,7 +236,7 @@ public class TestScannerMultiTablet extends BaseKuduTest {
 
     // Deserialize the scan token into a scanner, and make sure it is using
     // 'CLOSEST_REPLICA' selection policy.
-    KuduScanner scanner = KuduScanToken.deserializeIntoScanner(serializedToken, syncClient);
+    KuduScanner scanner = KuduScanToken.deserializeIntoScanner(serializedToken, client);
     assertEquals(ReplicaSelection.CLOSEST_REPLICA, scanner.getReplicaSelection());
     assertEquals(9, countRowsInScan(scanner));
   }
@@ -236,7 +246,7 @@ public class TestScannerMultiTablet extends BaseKuduTest {
     // Perform scan in READ_AT_SNAPSHOT mode with no snapshot timestamp
     // specified. Verify that the scanner timestamp is set from the tablet
     // server response.
-    AsyncKuduScanner scanner = client.newScannerBuilder(table)
+    AsyncKuduScanner scanner = asyncClient.newScannerBuilder(table)
         .readMode(AsyncKuduScanner.ReadMode.READ_AT_SNAPSHOT)
         .build();
     assertEquals(AsyncKuduClient.NO_TIMESTAMP, scanner.getSnapshotTimestamp());
@@ -271,12 +281,12 @@ public class TestScannerMultiTablet extends BaseKuduTest {
 
     // Perform scan in READ_YOUR_WRITES mode. Before the scan, verify that the
     // propagated timestamp is unset, since this is a fresh client.
-    AsyncKuduScanner scanner = client.newScannerBuilder(table)
+    AsyncKuduScanner scanner = asyncClient.newScannerBuilder(table)
                                      .readMode(AsyncKuduScanner.ReadMode.READ_YOUR_WRITES)
                                      .build();
     KuduScanner syncScanner = new KuduScanner(scanner);
     assertEquals(scanner.getReadMode(), syncScanner.getReadMode());
-    assertEquals(AsyncKuduClient.NO_TIMESTAMP, client.getLastPropagatedTimestamp());
+    assertEquals(AsyncKuduClient.NO_TIMESTAMP, asyncClient.getLastPropagatedTimestamp());
     assertEquals(AsyncKuduClient.NO_TIMESTAMP, scanner.getSnapshotTimestamp());
 
     assertEquals(9, countRowsInScan(syncScanner));
@@ -291,12 +301,12 @@ public class TestScannerMultiTablet extends BaseKuduTest {
 
     // Update the propagated timestamp to ensure we see the rows written
     // in the constructor.
-    syncClient.updateLastPropagatedTimestamp(preTs);
+    client.updateLastPropagatedTimestamp(preTs);
 
     // Perform scan in READ_YOUR_WRITES mode. Before the scan, verify that the
     // scanner timestamp is not yet set. It will get set only once the scan
     // is opened.
-    AsyncKuduScanner scanner = client.newScannerBuilder(table)
+    AsyncKuduScanner scanner = asyncClient.newScannerBuilder(table)
                                      .readMode(AsyncKuduScanner.ReadMode.READ_YOUR_WRITES)
                                      .build();
     KuduScanner syncScanner = new KuduScanner(scanner);
@@ -313,7 +323,7 @@ public class TestScannerMultiTablet extends BaseKuduTest {
     syncScanner.close();
 
     // Perform write in MANUAL_FLUSH (batch) mode.
-    KuduSession session = syncClient.newSession();
+    KuduSession session = client.newSession();
     session.setFlushMode(KuduSession.FlushMode.MANUAL_FLUSH);
     String[] keys = new String[] {"11", "22", "33"};
     for (int i = 0; i < keys.length; i++) {
@@ -326,12 +336,12 @@ public class TestScannerMultiTablet extends BaseKuduTest {
     session.flush();
     session.close();
 
-    scanner = client.newScannerBuilder(table)
+    scanner = asyncClient.newScannerBuilder(table)
                     .readMode(AsyncKuduScanner.ReadMode.READ_YOUR_WRITES)
                     .build();
     syncScanner = new KuduScanner(scanner);
-    assertTrue(preTs < client.getLastPropagatedTimestamp());
-    preTs = client.getLastPropagatedTimestamp();
+    assertTrue(preTs < asyncClient.getLastPropagatedTimestamp());
+    preTs = asyncClient.getLastPropagatedTimestamp();
 
     assertEquals(12, countRowsInScan(syncScanner));
 
@@ -344,24 +354,24 @@ public class TestScannerMultiTablet extends BaseKuduTest {
 
   @Test(timeout = 100000)
   public void testScanPropagatesLatestTimestamp() throws Exception {
-    AsyncKuduScanner scanner = client.newScannerBuilder(table).build();
+    AsyncKuduScanner scanner = asyncClient.newScannerBuilder(table).build();
 
     // Initially, the client does not have the timestamp set.
-    assertEquals(AsyncKuduClient.NO_TIMESTAMP, client.getLastPropagatedTimestamp());
-    assertEquals(KuduClient.NO_TIMESTAMP, syncClient.getLastPropagatedTimestamp());
+    assertEquals(AsyncKuduClient.NO_TIMESTAMP, asyncClient.getLastPropagatedTimestamp());
+    assertEquals(KuduClient.NO_TIMESTAMP, client.getLastPropagatedTimestamp());
     KuduScanner syncScanner = new KuduScanner(scanner);
 
     // Check that both clients return the same propagated timestamp.
     assertTrue(syncScanner.hasMoreRows());
-    assertEquals(AsyncKuduClient.NO_TIMESTAMP, client.getLastPropagatedTimestamp());
-    assertEquals(KuduClient.NO_TIMESTAMP, syncClient.getLastPropagatedTimestamp());
+    assertEquals(AsyncKuduClient.NO_TIMESTAMP, asyncClient.getLastPropagatedTimestamp());
+    assertEquals(KuduClient.NO_TIMESTAMP, client.getLastPropagatedTimestamp());
 
     int rowCount = syncScanner.nextRows().getNumRows();
     // At this point, the call to the first tablet server should have been
     // done already, so the client should have received the propagated timestamp
     // in the scanner response.
-    long asyncTsRef = client.getLastPropagatedTimestamp();
-    long syncTsRef = syncClient.getLastPropagatedTimestamp();
+    long asyncTsRef = asyncClient.getLastPropagatedTimestamp();
+    long syncTsRef = client.getLastPropagatedTimestamp();
     assertEquals(asyncTsRef, syncTsRef);
     assertNotEquals(AsyncKuduClient.NO_TIMESTAMP, asyncTsRef);
     assertNotEquals(KuduClient.NO_TIMESTAMP, syncTsRef);
@@ -369,8 +379,8 @@ public class TestScannerMultiTablet extends BaseKuduTest {
     assertTrue(syncScanner.hasMoreRows());
     while (syncScanner.hasMoreRows()) {
       rowCount += syncScanner.nextRows().getNumRows();
-      final long asyncTs = client.getLastPropagatedTimestamp();
-      final long syncTs = syncClient.getLastPropagatedTimestamp();
+      final long asyncTs = asyncClient.getLastPropagatedTimestamp();
+      final long syncTs = client.getLastPropagatedTimestamp();
       // Next scan responses from tablet servers should move the propagated
       // timestamp further.
       assertEquals(syncTs, asyncTs);
@@ -383,14 +393,14 @@ public class TestScannerMultiTablet extends BaseKuduTest {
   @Test(timeout = 100000)
   public void testScanTokenPropagatesTimestamp() throws Exception {
     // Initially, the client does not have the timestamp set.
-    assertEquals(AsyncKuduClient.NO_TIMESTAMP, client.getLastPropagatedTimestamp());
-    assertEquals(KuduClient.NO_TIMESTAMP, syncClient.getLastPropagatedTimestamp());
-    AsyncKuduScanner scanner = client.newScannerBuilder(table).build();
+    assertEquals(AsyncKuduClient.NO_TIMESTAMP, asyncClient.getLastPropagatedTimestamp());
+    assertEquals(KuduClient.NO_TIMESTAMP, client.getLastPropagatedTimestamp());
+    AsyncKuduScanner scanner = asyncClient.newScannerBuilder(table).build();
     KuduScanner syncScanner = new KuduScanner(scanner);
 
     // Let the client receive the propagated timestamp in the scanner response.
     syncScanner.nextRows().getNumRows();
-    final long tsPrev = client.getLastPropagatedTimestamp();
+    final long tsPrev = asyncClient.getLastPropagatedTimestamp();
     final long tsPropagated = tsPrev + 1000000;
 
     ScanTokenPB.Builder pbBuilder = ScanTokenPB.newBuilder();
@@ -401,9 +411,9 @@ public class TestScannerMultiTablet extends BaseKuduTest {
 
     // Deserialize scan tokens and make sure the client's last propagated
     // timestamp is updated accordingly.
-    assertEquals(tsPrev, client.getLastPropagatedTimestamp());
-    KuduScanToken.deserializeIntoScanner(serializedToken, syncClient);
-    assertEquals(tsPropagated, client.getLastPropagatedTimestamp());
+    assertEquals(tsPrev, asyncClient.getLastPropagatedTimestamp());
+    KuduScanToken.deserializeIntoScanner(serializedToken, client);
+    assertEquals(tsPropagated, asyncClient.getLastPropagatedTimestamp());
   }
 
   @Test(timeout = 100000)
@@ -415,7 +425,7 @@ public class TestScannerMultiTablet extends BaseKuduTest {
     final byte[] serializedToken = KuduScanToken.serialize(scanTokenPB);
 
     // Deserialize scan tokens and make sure the read mode is updated accordingly.
-    KuduScanner scanner = KuduScanToken.deserializeIntoScanner(serializedToken, syncClient);
+    KuduScanner scanner = KuduScanToken.deserializeIntoScanner(serializedToken, client);
     assertEquals(AsyncKuduScanner.ReadMode.READ_YOUR_WRITES, scanner.getReadMode());
   }
 
@@ -432,7 +442,7 @@ public class TestScannerMultiTablet extends BaseKuduTest {
                                       String exclusiveUpperBoundKeyOne,
                                       String exclusiveUpperBoundKeyTwo,
                                       ColumnRangePredicate predicate) {
-    AsyncKuduScanner.AsyncKuduScannerBuilder builder = client.newScannerBuilder(table);
+    AsyncKuduScanner.AsyncKuduScannerBuilder builder = asyncClient.newScannerBuilder(table);
 
     if (lowerBoundKeyOne != null) {
       PartialRow lowerBoundRow = schema.newPartialRow();

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurity.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurity.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurity.java
index 5594177..17ed3db 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurity.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurity.java
@@ -16,6 +16,7 @@ package org.apache.kudu.client;
 import static org.apache.kudu.util.AssertHelpers.assertEventuallyTrue;
 import static org.apache.kudu.util.ClientTestUtil.createBasicSchemaInsert;
 import static org.apache.kudu.util.ClientTestUtil.getBasicCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getBasicSchema;
 import static org.junit.Assert.assertNotNull;
 
 import java.io.Closeable;
@@ -66,15 +67,15 @@ public class TestSecurity {
     MiniKuduClusterBuilder mcb = new MiniKuduClusterBuilder();
     mcb.enableKerberos();
     if (opts.contains(Option.LONG_LEADER_ELECTION)) {
-      mcb.addMasterFlag("--leader_failure_max_missed_heartbeat_periods=10.0");
+      mcb.addMasterServerFlag("--leader_failure_max_missed_heartbeat_periods=10.0");
     }
     if (opts.contains(Option.SHORT_TOKENS_AND_TICKETS)) {
-      mcb.addMasterFlag("--authn_token_validity_seconds=" + TICKET_LIFETIME_SECS)
+      mcb.addMasterServerFlag("--authn_token_validity_seconds=" + TICKET_LIFETIME_SECS)
          .kdcRenewLifetime(RENEWABLE_LIFETIME_SECS + "s")
          .kdcTicketLifetime(TICKET_LIFETIME_SECS + "s");
     }
-    miniCluster = mcb.numMasters(3)
-        .numTservers(opts.contains(Option.START_TSERVERS) ? 3 : 0)
+    miniCluster = mcb.numMasterServers(3)
+        .numTabletServers(opts.contains(Option.START_TSERVERS) ? 3 : 0)
         .build();
     miniCluster.kinit("test-admin");
     client = new KuduClient.KuduClientBuilder(miniCluster.getMasterAddressesAsString()).build();
@@ -167,7 +168,7 @@ public class TestSecurity {
       // If we import the authentication data from the old authenticated client,
       // we should now be able to perform all of the normal client operations.
       newClient.importAuthenticationCredentials(authnData);
-      KuduTable table = newClient.createTable(TABLE_NAME, BaseKuduTest.basicSchema,
+      KuduTable table = newClient.createTable(TABLE_NAME, getBasicSchema(),
           getBasicCreateTableOptions());
       KuduSession session = newClient.newSession();
       session.apply(createBasicSchemaInsert(table, 1));

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurityContextRealUser.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurityContextRealUser.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurityContextRealUser.java
index 5957bcb..a1aaa8e 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurityContextRealUser.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestSecurityContextRealUser.java
@@ -17,7 +17,10 @@
 
 package org.apache.kudu.client;
 
+import org.apache.kudu.client.MiniKuduCluster.MiniKuduClusterBuilder;
+import org.apache.kudu.test.KuduTestHarness;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 import java.util.ArrayList;
@@ -32,27 +35,27 @@ import static org.junit.Assert.fail;
  * Tests that the 'real user' field of the security context is used for
  * SASL PLAIN negotiations, and is imported from the SecurityCredentialsPB.
  */
-public class TestSecurityContextRealUser extends BaseKuduTest {
+public class TestSecurityContextRealUser {
   private String tableName;
 
-  @Override
-  protected MiniKuduCluster.MiniKuduClusterBuilder getMiniClusterBuilder() {
-    return super.getMiniClusterBuilder()
-        // This test requires a delicate setup. We enable Kerberos, make
-        // authentication optional, and set the superuser ACL to test-admin so that
-        // the external mini-cluster is able to connect to the master while creating
-        // the cluster. The user ACL is scoped to a different user so that we can
-        // test real user name propagation.
-        .enableKerberos()
-        .addMasterFlag("--user-acl=token-user")
-        .addMasterFlag("--superuser-acl=test-admin")
-        .addMasterFlag("--rpc-authentication=optional")
-        .addMasterFlag("--rpc-trace-negotiation")
-        .addTserverFlag("--user-acl=token-user")
-        .addTserverFlag("--superuser-acl=test-admin")
-        .addTserverFlag("--rpc-authentication=optional")
-        .addTserverFlag("--rpc-trace-negotiation");
-  }
+  private static final MiniKuduClusterBuilder clusterBuilder = KuduTestHarness.getBaseClusterBuilder()
+      // This test requires a delicate setup. We enable Kerberos, make
+      // authentication optional, and set the superuser ACL to test-admin so that
+      // the external mini-cluster is able to connect to the master while creating
+      // the cluster. The user ACL is scoped to a different user so that we can
+      // test real user name propagation.
+      .enableKerberos()
+      .addMasterServerFlag("--user-acl=token-user")
+      .addMasterServerFlag("--superuser-acl=test-admin")
+      .addMasterServerFlag("--rpc-authentication=optional")
+      .addMasterServerFlag("--rpc-trace-negotiation")
+      .addTabletServerFlag("--user-acl=token-user")
+      .addTabletServerFlag("--superuser-acl=test-admin")
+      .addTabletServerFlag("--rpc-authentication=optional")
+      .addTabletServerFlag("--rpc-trace-negotiation");
+
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness(clusterBuilder);
 
   @Before
   public void setTableName() {
@@ -62,12 +65,12 @@ public class TestSecurityContextRealUser extends BaseKuduTest {
   @Test
   public void test() throws Exception {
     // Clear out the Kerberos credentials in the environment.
-    kdestroy();
+    harness.kdestroy();
 
     // Create a new client instance with the logged in user, and ensure that it
     // fails to connect (the logged in user is not in the user-acl).
     try (KuduClient client =
-             new KuduClient.KuduClientBuilder(getMasterAddressesAsString()).build()) {
+             new KuduClient.KuduClientBuilder(harness.getMasterAddressesAsString()).build()) {
       client.listTabletServers();
       fail();
     } catch (KuduException e) {
@@ -77,7 +80,7 @@ public class TestSecurityContextRealUser extends BaseKuduTest {
 
     // Try again with a correct real user.
     try (KuduClient client =
-             new KuduClient.KuduClientBuilder(getMasterAddressesAsString()).build()) {
+             new KuduClient.KuduClientBuilder(harness.getMasterAddressesAsString()).build()) {
       Client.AuthenticationCredentialsPB credentials =
           Client.AuthenticationCredentialsPB.newBuilder().setRealUser("token-user").build();
       client.importAuthenticationCredentials(credentials.toByteArray());

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestStatistics.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestStatistics.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestStatistics.java
index 4c7c641..f9cf0ca 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestStatistics.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestStatistics.java
@@ -18,9 +18,12 @@ package org.apache.kudu.client;
 
 import static org.apache.kudu.util.ClientTestUtil.createBasicSchemaInsert;
 import static org.apache.kudu.util.ClientTestUtil.getBasicCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getBasicSchema;
 import static org.junit.Assert.assertEquals;
 
+import org.apache.kudu.test.KuduTestHarness;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.kudu.client.Statistics.Statistic;
@@ -28,21 +31,25 @@ import org.apache.kudu.client.Statistics.Statistic;
 import java.util.ArrayList;
 import java.util.List;
 
-public class TestStatistics extends BaseKuduTest {
+public class TestStatistics {
 
   private static final String TABLE_NAME = TestStatistics.class.getName() + "-"
       + System.currentTimeMillis();
   private static KuduTable table;
 
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
   @Before
   public void setUp() throws Exception {
     CreateTableOptions options = getBasicCreateTableOptions().setNumReplicas(1);
-    table = createTable(TABLE_NAME, basicSchema, options);
+    table = harness.getClient().createTable(TABLE_NAME, getBasicSchema(), options);
   }
 
   @Test(timeout = 10000)
   public void test() throws Exception {
-    KuduSession session = syncClient.newSession();
+    KuduClient client = harness.getClient();
+    KuduSession session = client.newSession();
     session.setFlushMode(SessionConfiguration.FlushMode.MANUAL_FLUSH);
     int rowCount = 20;
     for (int i = 0; i < rowCount; i++) {
@@ -52,7 +59,7 @@ public class TestStatistics extends BaseKuduTest {
         session.flush();
       }
     }
-    Statistics statistics = syncClient.getStatistics();
+    Statistics statistics = client.getStatistics();
     assertEquals(rowCount / 2, statistics.getClientStatistic(Statistic.WRITE_RPCS));
     assertEquals(rowCount, statistics.getClientStatistic(Statistic.WRITE_OPS));
     assertEquals(0, statistics.getClientStatistic(Statistic.RPC_ERRORS));

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc8ae799/java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeouts.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeouts.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeouts.java
index 86c03dd..ed8f56c 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeouts.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeouts.java
@@ -18,16 +18,22 @@ package org.apache.kudu.client;
 
 import static org.apache.kudu.util.ClientTestUtil.createBasicSchemaInsert;
 import static org.apache.kudu.util.ClientTestUtil.getBasicCreateTableOptions;
+import static org.apache.kudu.util.ClientTestUtil.getBasicSchema;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.apache.kudu.test.KuduTestHarness;
+import org.junit.Rule;
 import org.junit.Test;
 
-public class TestTimeouts extends BaseKuduTest {
+public class TestTimeouts {
 
   private static final String TABLE_NAME =
       TestTimeouts.class.getName() + "-" + System.currentTimeMillis();
 
+  @Rule
+  public KuduTestHarness harness = new KuduTestHarness();
+
   /**
    * This test case tries different methods that should all timeout, while relying on the client to
    * pass down the timeouts to the session and scanner.
@@ -35,7 +41,8 @@ public class TestTimeouts extends BaseKuduTest {
    */
   @Test(timeout = 100000)
   public void testLowTimeouts() throws Exception {
-    KuduClient lowTimeoutsClient = new KuduClient.KuduClientBuilder(getMasterAddressesAsString())
+    KuduClient lowTimeoutsClient =
+        new KuduClient.KuduClientBuilder(harness.getMasterAddressesAsString())
         .defaultAdminOperationTimeoutMs(1)
         .defaultOperationTimeoutMs(1)
         .build();
@@ -47,7 +54,7 @@ public class TestTimeouts extends BaseKuduTest {
       // Expected.
     }
 
-    createTable(TABLE_NAME, basicSchema, getBasicCreateTableOptions());
+    harness.getClient().createTable(TABLE_NAME, getBasicSchema(), getBasicCreateTableOptions());
     KuduTable table = lowTimeoutsClient.openTable(TABLE_NAME);
 
     KuduSession lowTimeoutSession = lowTimeoutsClient.newSession();


Mime
View raw message