You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2014/04/04 20:18:26 UTC

svn commit: r1584851 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/client/ test/java/org/apache/hadoop/hbase/ test/java/org/apache/hadoop/hbase/client/ test/java/org/apache/hadoop/hbase/mapreduce/ test/java/org/apache/hadoop/hbase...

Author: liyin
Date: Fri Apr  4 18:18:26 2014
New Revision: 1584851

URL: http://svn.apache.org/r1584851
Log:
[HBASE-10901] Remove usage of createMultiRegions

Author: daviddeng

Summary: Remove usage of `createMultiRegions`, call `createTable` with `startKeys` version to create the table with multiple regions directly.

Test Plan: Run tests

Reviewers: manukranthk, liyintang, gauravm

Reviewed By: liyintang

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D1256548

Task ID: 3789093, 3297517, 3864238, 3269413, 3977473, 3925117, 2015426, 3762458

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableAsync.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestFullLogReconstruction.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestBlacklistRegionServer.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestClientLocalScanner.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHTableClientScanner.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestMetaScanner.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestParallelScanner.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRPCCallOptimization.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatNMappersPerRegion.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScan.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestROOTAssignment.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedCloseRegion.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedReopenRegion.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionFavoredNodes.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerShutdown.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestServerSideException.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableAsync.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableAsync.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableAsync.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HTableAsync.java Fri Apr  4 18:18:26 2014
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.ipc.thrif
 import org.apache.hadoop.hbase.thrift.SelfRetryingListenableFuture;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.DaemonThreadFactory;
+import org.apache.hadoop.hbase.util.StringBytes;
 
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -87,6 +88,20 @@ public class HTableAsync extends HTable 
     this.hConnectionParams = HConnectionParams.getInstance(conf);
   }
 
+  /**
+   * Creates an object to access a HBase table through asynchronous APIs.
+   *
+   * @param conf Configuration object to use.
+   * @param tableName Name of the table.
+   * @throws IOException if a remote or network exception occurs
+   */
+  public HTableAsync(Configuration conf, StringBytes tableName)
+      throws IOException {
+    super(conf, tableName);
+
+    this.hConnectionParams = HConnectionParams.getInstance(conf);
+  }
+
   public HTableAsync(HTable t) {
     super(t);
 

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Fri Apr  4 18:18:26 2014
@@ -580,21 +580,64 @@ public class HBaseTestingUtility {
 
   public HTable createTable(byte[] tableName, byte[][] families,
       int numVersions, byte[] startKey, byte[] endKey, int numRegions)
-  throws IOException{
-    HTableDescriptor desc = new HTableDescriptor(tableName);
+      throws IOException {
+    return createTable(new StringBytes(tableName), families, numVersions,
+        startKey, endKey, numRegions);
+  }
+
+  /**
+   * Creates a table.
+   *
+   * @param startKey the startKey of the second region.
+   * @param endKey the endKey of the last second region.
+   * @param numRegions if numRegions equals 1, startKey and endKey are not used,
+   *                   if numRegions equals 2, endKey is not used.
+   */
+  public HTableAsync createTable(StringBytes tableName, byte[][] families,
+      int numVersions, byte[] startKey, byte[] endKey, int numRegions)
+      throws IOException {
+    HTableDescriptor desc = new HTableDescriptor(tableName.getBytes());
     for (byte[] family : families) {
-      HColumnDescriptor hcd = new HColumnDescriptor(family)
-          .setMaxVersions(numVersions);
+      HColumnDescriptor hcd =
+          new HColumnDescriptor(family).setMaxVersions(numVersions);
       desc.addFamily(hcd);
     }
-    (new HBaseAdmin(getConfiguration())).createTable(desc, startKey,
-        endKey, numRegions);
-    return new HTable(getConfiguration(), tableName);
+    if (numRegions == 1) {
+      new HBaseAdmin(getConfiguration()).createTable(desc);
+    } if (numRegions == 2) {
+      new HBaseAdmin(getConfiguration()).createTable(desc,
+          new byte[][] { startKey });
+    } else {
+      new HBaseAdmin(getConfiguration()).createTable(desc, startKey, endKey,
+          numRegions);
+    };
+    return new HTableAsync(getConfiguration(), tableName);
   }
 
+  /**
+   * Creates a table.
+   *
+   * @param startKey the startKey of the second region.
+   * @param endKey the endKey of the last second region.
+   * @param numRegions if numRegions equals 1, startKey and endKey are not used,
+   *          if numRegions equals 2, endKey is not used.
+   */
+  public HTable createTable(StringBytes tableName, byte[][] families,
+      int numVersions, byte[][] splitKeys) throws IOException {
+    HTableDescriptor desc = new HTableDescriptor(tableName.getBytes());
+    for (byte[] family : families) {
+      HColumnDescriptor hcd =
+          new HColumnDescriptor(family).setMaxVersions(numVersions);
+      desc.addFamily(hcd);
+    }
+    new HBaseAdmin(getConfiguration()).createTable(desc, splitKeys);
+
+    return new HTable(getConfiguration(), tableName);
+  }
 
   /**
    * Create a table.
+   *
    * @param tableName
    * @param families
    * @return An HTableAsync instance for the created table, which is a sub-class
@@ -822,29 +865,20 @@ public class HBaseTestingUtility {
   }
 
   /**
-   * Creates many regions names "aaa" to "zzz".
-   *
-   * @param table  The table to use for the data.
-   * @param columnFamily  The family to insert the data into.
-   * @return count of regions created.
-   * @throws IOException When creating the regions fails.
+   * @deprecated Use createTable with startKey/stopKey versions to create
    */
+  @Deprecated
   public int createMultiRegions(HTable table, byte[] columnFamily)
   throws IOException {
     return createMultiRegions(getConfiguration(), table, columnFamily);
   }
 
   /**
-   * Creates many regions names "aaa" to "zzz".
-   * @param c Configuration to use.
-   * @param table  The table to use for the data.
-   * @param columnFamily  The family to insert the data into.
-   * @return count of regions created.
-   * @throws IOException When creating the regions fails.
+   * @deprecated Use createTable with startKey/stopKey versions to create
    */
+  @Deprecated
   public int createMultiRegions(final Configuration c, final HTable table,
-      final byte[] columnFamily)
-  throws IOException {
+      final byte[] columnFamily) throws IOException {
     return createMultiRegions(c, table, columnFamily, getTmpKeys());
   }
 
@@ -863,6 +897,10 @@ public class HBaseTestingUtility {
     return KEYS;
   }
 
+  /**
+   * @deprecated Use createTable with startKey/stopKey versions to create
+   */
+  @Deprecated
   public int createMultiRegions(final Configuration c, final HTable table,
       final byte[] columnFamily, byte [][] startKeys)
   throws IOException {

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestFullLogReconstruction.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestFullLogReconstruction.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestFullLogReconstruction.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/TestFullLogReconstruction.java Fri Apr  4 18:18:26 2014
@@ -100,14 +100,14 @@ public class TestFullLogReconstruction {
   // Marked as unstable and recored in #3977473
   @TestTag({ "unstable" })
   @Test (timeout = 300000)
+  @SuppressWarnings("unused")
   public void testReconstruction() throws Exception {
 
-    TEST_UTIL.createTable(TABLE_NAME, FAMILY);
+    TEST_UTIL.createTable(TABLE_NAME, new byte[][] { FAMILY }, 10,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
 
     HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLE_NAME);
 
-    TEST_UTIL.createMultiRegions(table, Bytes.toBytes("family"));
-
     // Load up the table with simple rows and count them
     int initialCount = TEST_UTIL.loadTable(table, FAMILY);
     Scan scan = new Scan();

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestBlacklistRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestBlacklistRegionServer.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestBlacklistRegionServer.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestBlacklistRegionServer.java Fri Apr  4 18:18:26 2014
@@ -19,6 +19,11 @@
  */
 package org.apache.hadoop.hbase.client;
 
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -31,23 +36,15 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import static org.junit.Assert.assertTrue;
-
 public class TestBlacklistRegionServer {
   private static final Log LOG = LogFactory.getLog(TestHCM.class);
 
   private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-  private static final byte[] TABLE_NAME = Bytes.toBytes("test");
   private static final byte[] FAM_NAM = Bytes.toBytes("f");
-  private static final byte[] ROW = Bytes.toBytes("bbd");
 
   private static final int REGION_SERVERS = 5;
 
@@ -67,8 +64,8 @@ public class TestBlacklistRegionServer {
 
     byte[] tableName = Bytes.toBytes("testBlacklistRegionServerWithoutTimeout");
 
-    HTable table = TEST_UTIL.createTable(tableName, FAM_NAM);
-    TEST_UTIL.createMultiRegions(table, FAM_NAM);
+    TEST_UTIL.createTable(tableName, new byte[][] { FAM_NAM }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
 
     List<JVMClusterUtil.RegionServerThread> servers =
       TEST_UTIL.getHBaseCluster().getLiveRegionServerThreads();
@@ -126,7 +123,7 @@ public class TestBlacklistRegionServer {
       }
     }
 
-    assertTrue(numberOfNonMetaRegions == 0);
+    Assert.assertTrue(numberOfNonMetaRegions == 0);
 
     LOG.debug("Removing blacklisted Region Server");
 

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestClientLocalScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestClientLocalScanner.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestClientLocalScanner.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestClientLocalScanner.java Fri Apr  4 18:18:26 2014
@@ -79,10 +79,10 @@ public class TestClientLocalScanner {
   @Test(timeout=200000)
   public void testCompareLocalScanToRemoteScan() throws IOException {
     byte [] name = Bytes.toBytes("testCompareLocalScanToRemoteScan");
-    HTable t = TEST_UTIL.createTable(name, new byte[][] {FAMILY, FAMILY2});
+    HTable t = TEST_UTIL.createTable(name, new byte[][] {FAMILY, FAMILY2}, 3,
+        Bytes.toBytes("aaa"), Bytes.toBytes("yyy"), 25);
     HTable tmpTable = new HTable(TEST_UTIL.getConfiguration(), name);
-    int cnt = TEST_UTIL.createMultiRegions(t, FAMILY);
-    TEST_UTIL.waitUntilAllRegionsAssigned(cnt);
+
     int rowCount = TEST_UTIL.loadTable(t, FAMILY);
     TEST_UTIL.loadTable(t, FAMILY2);
     t.flushCommits();
@@ -106,6 +106,7 @@ public class TestClientLocalScanner {
     ReadOnlyStoreCompactionInjectionHandler(byte[] tableName) {
       this.tableName = tableName;
     }
+    @Override
     protected void _processEvent(InjectionEvent event, Object... args) {
       if (event == InjectionEvent.READONLYSTORE_COMPACTION_WHILE_SNAPSHOTTING && !done) {
         try {
@@ -158,7 +159,7 @@ public class TestClientLocalScanner {
         new ReadOnlyStoreCompactionInjectionHandler(name);
     InjectionHandler.set(ih);
     ResultScanner scanner = t.getLocalScanner(new Scan());
-    for (Result r : scanner) {
+    for (@SuppressWarnings("unused") Result r : scanner) {
       rowCnt++;
     }
     InjectionHandler.clear();

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java Fri Apr  4 18:18:26 2014
@@ -67,7 +67,6 @@ import org.apache.hadoop.hbase.filter.Re
 import org.apache.hadoop.hbase.filter.RowFilter;
 import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
 import org.apache.hadoop.hbase.filter.WhileMatchFilter;
-import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
 import org.apache.hadoop.hbase.io.hfile.BlockCache;
 import org.apache.hadoop.hbase.io.hfile.CacheConfig;
 import org.apache.hadoop.hbase.io.hfile.CacheTestHelper;
@@ -77,15 +76,12 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.StringBytes;
-import org.apache.hadoop.hbase.util.TagRunner;
-import org.apache.hadoop.hbase.util.TestTag;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
 /**
  * Run tests that use the HBase clients; {@link HTable} and {@link HTablePool}.
@@ -3985,15 +3981,13 @@ public class TestFromClientSide {
     final StringBytes TABLENAME = new StringBytes("testCachePrewarm2");
      final byte[] FAMILY = Bytes.toBytes("family");
      Configuration conf = TEST_UTIL.getConfiguration();
-     TEST_UTIL.createTable(TABLENAME, FAMILY);
+    TEST_UTIL.createTable(TABLENAME, new byte[][] { FAMILY }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
 
      // Set up test table:
      // Create table:
      HTable table = new HTable(conf, TABLENAME);
 
-     // Create multiple regions for this table
-     TEST_UTIL.createMultiRegions(table, FAMILY);
-
      Path tempPath = new Path(TEST_UTIL.getTestDir(), "regions.dat");
 
      final String tempFileName = tempPath.toString();
@@ -4053,7 +4047,8 @@ public class TestFromClientSide {
 
     // Set up test table:
     // Create table:
-    TEST_UTIL.createTable(TABLENAME, FAMILY);
+    TEST_UTIL.createTable(TABLENAME, new byte[][] { FAMILY }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
 
     // disable region cache for the table.
     HTable.setRegionCachePrefetch(conf, TABLENAME.getBytes(), false);
@@ -4062,8 +4057,6 @@ public class TestFromClientSide {
 
     HTable table = new HTable(conf, TABLENAME);
 
-    // create many regions for the table.
-    TEST_UTIL.createMultiRegions(table, FAMILY);
     // This count effectively waits until the regions have been
     // fully assigned
     TEST_UTIL.countRows(table);

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java Fri Apr  4 18:18:26 2014
@@ -56,7 +56,7 @@ public class TestHCM {
 
   private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
   private static final StringBytes TABLE_NAME = new StringBytes("test");
-  private static final byte[] FAM_NAM = Bytes.toBytes("f");
+  private static final byte[] FAM_NAME = Bytes.toBytes("f");
   private static final byte[] ROW = Bytes.toBytes("bbd");
 
   private static final int REGION_SERVERS = 5;
@@ -80,11 +80,11 @@ public class TestHCM {
   @Test
   public void testRemoteServerFailure() throws Exception {
 
-    HTable table = TEST_UTIL.createTable(Bytes.toBytes("testRemoteServerFailure"), FAM_NAM);
+    HTable table = TEST_UTIL.createTable(
+        Bytes.toBytes("testRemoteServerFailure"), new byte[][] { FAM_NAME }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
     table.setAutoFlush(true);
 
-    TEST_UTIL.createMultiRegions(table, FAM_NAM);
-
     try {
 
       for (int i = 0; i < REGION_SERVERS; i++) {
@@ -98,7 +98,7 @@ public class TestHCM {
       Thread.sleep(10000);
 
       Put put = new Put(ROW);
-      put.add(FAM_NAM, ROW, ROW);
+      put.add(FAM_NAME, ROW, ROW);
 
       table.put(put);
 
@@ -122,10 +122,12 @@ public class TestHCM {
   @Test
   public void testRegionCaching() throws Exception{
 
-    HTable table = TEST_UTIL.createTable(TABLE_NAME, FAM_NAM);
-    TEST_UTIL.createMultiRegions(table, FAM_NAM);
+    HTable table = TEST_UTIL.createTable(TABLE_NAME, new byte[][] { FAM_NAME },
+        3, Bytes.toBytes("bbb"),
+        Bytes.toBytes("yyy"), 25);
+
     Put put = new Put(ROW);
-    put.add(FAM_NAM, ROW, ROW);
+    put.add(FAM_NAME, ROW, ROW);
     table.put(put);
     TableServers conn =
         (TableServers) table.getConnectionAndResetOperationContext();
@@ -141,12 +143,13 @@ public class TestHCM {
    */
   @Test
   public void testClientFailureReporting() throws Exception {
-
-    HTable table = TEST_UTIL.createTable(Bytes.toBytes("testClientFailureReporting"), FAM_NAM);
-    TEST_UTIL.createMultiRegions(table, FAM_NAM);
+    HTable table = TEST_UTIL.createTable(
+        new StringBytes("testClientFailureReporting"),
+        new byte[][] { FAM_NAME }, 3, Bytes.toBytes("bbb"),
+        Bytes.toBytes("yyy"), 25);
 
     Put put = new Put(ROW);
-    put.add(FAM_NAM, ROW, ROW);
+    put.add(FAM_NAME, ROW, ROW);
     setupFailure(table,
         TEST_UTIL.getHBaseCluster().getLiveRegionServerThreads().size());
     try {
@@ -174,12 +177,14 @@ public class TestHCM {
    */
   @Test
   public void testClientFailureReportingGet() throws Exception {
-    HTable table = TEST_UTIL.createTable(Bytes.toBytes("testClientFailureReportingGet"), FAM_NAM);
-    TEST_UTIL.createMultiRegions(table, FAM_NAM);
+    HTable table = TEST_UTIL.createTable(
+        new StringBytes("testClientFailureReportingGet"),
+        new byte[][] { FAM_NAME }, 3, Bytes.toBytes("bbb"),
+        Bytes.toBytes("yyy"), 25);
 
 
     Put put = new Put(ROW);
-    put.add(FAM_NAM, ROW, ROW);
+    put.add(FAM_NAME, ROW, ROW);
     table.put(put);
 
     setupFailure(table,
@@ -203,11 +208,13 @@ public class TestHCM {
   @Test
   public void testClientFailureReportingDelete() throws Exception {
 
-    HTable table = TEST_UTIL.createTable(Bytes.toBytes("testClientFailureReportingDelete"), FAM_NAM);
-    TEST_UTIL.createMultiRegions(table, FAM_NAM);
+    HTable table = TEST_UTIL.createTable(
+        Bytes.toBytes("testClientFailureReportingDelete"),
+        new byte[][] { FAM_NAME }, 3, Bytes.toBytes("bbb"),
+        Bytes.toBytes("yyy"), 25);
 
     Put put = new Put(ROW);
-    put.add(FAM_NAM, ROW, ROW);
+    put.add(FAM_NAME, ROW, ROW);
     table.put(put);
 
     setupFailure(table,
@@ -232,11 +239,12 @@ public class TestHCM {
   @Test
   public void testClientGetSuccess() throws Exception {
 
-    HTable table = TEST_UTIL.createTable(Bytes.toBytes("testClientSuccess"), FAM_NAM);
-    TEST_UTIL.createMultiRegions(table, FAM_NAM);
+    HTable table = TEST_UTIL.createTable(Bytes.toBytes("testClientSuccess"),
+        new byte[][] { FAM_NAME }, 3, Bytes.toBytes("bbb"),
+        Bytes.toBytes("yyy"), 25);
 
     Put put = new Put(ROW);
-    put.add(FAM_NAM, ROW, ROW);
+    put.add(FAM_NAME, ROW, ROW);
     table.put(put);
 
     setupFailure(table, 0);

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHFileHistogramE2E.java Fri Apr  4 18:18:26 2014
@@ -1,7 +1,5 @@
 package org.apache.hadoop.hbase.client;
 
-import static org.junit.Assert.*;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -13,15 +11,14 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.client.HTable;
-import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.io.hfile.histogram.HFileHistogram;
-import org.apache.hadoop.hbase.io.hfile.histogram.TestUniformSplitHistogram;
 import org.apache.hadoop.hbase.io.hfile.histogram.HFileHistogram.Bucket;
+import org.apache.hadoop.hbase.io.hfile.histogram.TestUniformSplitHistogram;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionUtilities;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -51,15 +48,15 @@ public class TestHFileHistogramE2E {
     HTable table = util.createTable(TABLE, FAMILY);
     util.loadTable(table, FAMILY);
     util.flush(TABLE);
-    assertTrue(util.getHBaseCluster().getRegions(TABLE).size() == 1);
+    Assert.assertTrue(util.getHBaseCluster().getRegions(TABLE).size() == 1);
     HRegion region = util.getHBaseCluster().getRegions(TABLE).get(0);
     HFileHistogram hist = region.getHistogram();
-    assertTrue(hist != null);
+    Assert.assertTrue(hist != null);
     boolean first = true;
     List<Bucket> buckets = hist.getUniformBuckets();
     int idx = 0;
-    assertTrue(buckets != null);
-    assertTrue(buckets.size() > 0);
+    Assert.assertTrue(buckets != null);
+    Assert.assertTrue(buckets.size() > 0);
     Bucket prevBucket = buckets.get(0);
     for (Bucket b : buckets) {
       if (first) {
@@ -68,8 +65,8 @@ public class TestHFileHistogramE2E {
         idx++;
         continue;
       }
-      assertTrue(Bytes.compareTo(b.getStartRow(), prevBucket.getEndRow()) >= 0);
-      assertTrue(Bytes.toStringBinary(b.getEndRow()) + " : " +
+      Assert.assertTrue(Bytes.compareTo(b.getStartRow(), prevBucket.getEndRow()) >= 0);
+      Assert.assertTrue(Bytes.toStringBinary(b.getEndRow()) + " : " +
           Bytes.toStringBinary(prevBucket.getStartRow()),
           ++idx >= buckets.size() || // The last bucket
           Bytes.compareTo(b.getEndRow(), prevBucket.getStartRow()) > 0);
@@ -83,28 +80,29 @@ public class TestHFileHistogramE2E {
     HTable table = util.createTable(TABLE2, FAMILY);
     util.loadTable(table, FAMILY);
     util.flush(TABLE2);
-    assertTrue(util.getHBaseCluster().getRegions(TABLE2).size() == 1);
+    Assert.assertTrue(util.getHBaseCluster().getRegions(TABLE2).size() == 1);
     HRegion region = util.getHBaseCluster().getRegions(TABLE2).get(0);
     List<Bucket> buckets = region.getHistogram().getUniformBuckets();
-    assertTrue(buckets != null);
-    assertTrue(buckets.size() > 0);
+    Assert.assertTrue(buckets != null);
+    Assert.assertTrue(buckets.size() > 0);
     List<Bucket> serBuckets = table.getHistogramForColumnFamily(
         region.getStartKey(), FAMILY);
-    assertTrue(serBuckets != null);
-    assertTrue(serBuckets.size() > 1);
-    assertTrue(Bytes.equals(serBuckets.get(0).getStartRow(),
+    Assert.assertTrue(serBuckets != null);
+    Assert.assertTrue(serBuckets.size() > 1);
+    Assert.assertTrue(Bytes.equals(serBuckets.get(0).getStartRow(),
         region.getStartKey()));
-    assertTrue(Bytes.equals(serBuckets.get(serBuckets.size() - 1).getEndRow(),
+    Assert.assertTrue(Bytes.equals(serBuckets.get(serBuckets.size() - 1)
+        .getEndRow(),
         region.getEndKey()));
     buckets = HRegionUtilities
         .adjustHistogramBoundariesToRegionBoundaries(buckets, region.getStartKey(), region.getEndKey());
-    assertTrue(compareBuckets(buckets, serBuckets));
+    Assert.assertTrue(compareBuckets(buckets, serBuckets));
   }
 
   public boolean compareBuckets(List<Bucket> buckets1, List<Bucket> buckets2) {
     int len1 = buckets1.size();
     int len2 = buckets2.size();
-    assertTrue(len1 == len2);
+    Assert.assertTrue(len1 == len2);
     for (int i=0; i<len1; i++) {
       Bucket b1 = buckets1.get(i);
       Bucket b2 = buckets2.get(i);
@@ -144,10 +142,10 @@ public class TestHFileHistogramE2E {
     List<byte[]> inputList = putRandomKVs(table, numEntries, 15);
     Collections.sort(inputList, Bytes.BYTES_COMPARATOR);
     List<HRegion> regions = util.getHBaseCluster().getRegions(TABLE3);
-    assertTrue(regions.size() == 1);
+    Assert.assertTrue(regions.size() == 1);
     HRegion region = regions.get(0);
     List<Bucket> lst = table.getHistogram(region.getStartKey());
-    assertTrue(lst.size() > 0);
+    Assert.assertTrue(lst.size() > 0);
 
     TestUniformSplitHistogram.checkError(inputList, lst,
         0.2, expectedBucketCnt);
@@ -157,20 +155,23 @@ public class TestHFileHistogramE2E {
   public void testHistogramForAllRegions() throws IOException {
     byte[] tableName = Bytes.toBytes("TestHistogramForAllRegions");
     byte[] cf = Bytes.toBytes("cf");
-    HTable table = util.createTable(tableName, cf);
-    util.createMultiRegions(table, cf);
+    HTable table = util.createTable(tableName, new byte[][] { cf }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
+
     util.loadTable(table, cf);
     util.flush(tableName);
-    assertTrue(util.getHBaseCluster().getRegions(tableName).size() > 1);
+
+    Assert.assertTrue(util.getHBaseCluster().getRegions(tableName).size() > 1);
     Map<byte[], byte[]> map = table.getStartEndKeysMap();
     List<List<Bucket>> buckets = table.getHistogramsForAllRegions();
-    assertTrue(map.size() == buckets.size());
+    Assert.assertTrue(map.size() == buckets.size());
     int regionIndex = 0;
     int regionCnt = map.size();
     for (List<Bucket> bucketsForRegion : buckets) {
-      assertTrue(bucketsForRegion.size() > 1);
-      assertTrue(map.containsKey(bucketsForRegion.get(0).getStartRow()));
-      assertTrue(Bytes.equals(map.get(bucketsForRegion.get(0).getStartRow()),
+      Assert.assertTrue(bucketsForRegion.size() > 1);
+      Assert.assertTrue(map.containsKey(bucketsForRegion.get(0).getStartRow()));
+      Assert.assertTrue(Bytes.equals(
+          map.get(bucketsForRegion.get(0).getStartRow()),
           bucketsForRegion.get(bucketsForRegion.size() - 1).getEndRow()));
       Bucket prevBucket = null;
       for (Bucket b : bucketsForRegion) {
@@ -179,18 +180,21 @@ public class TestHFileHistogramE2E {
         // * curBucket.startRow >= prevBucket.endRow
         // * curBucket.endRow >= prevBucket.endRow
         if (prevBucket != null) {
-          assertTrue(Bytes.toStringBinary(b.getStartRow())
+          Assert.assertTrue(
+              Bytes.toStringBinary(b.getStartRow())
               + " not greater than "
               + Bytes.toStringBinary(prevBucket.getStartRow()),
               Bytes.compareTo(b.getStartRow(), prevBucket.getStartRow()) > 0);
           if (regionIndex < (regionCnt - 1)) {
             // last region's end row is going to be an empty row,
             // so we need to special case it here.
-            assertTrue(Bytes.toStringBinary(b.getEndRow())
+            Assert.assertTrue(
+                Bytes.toStringBinary(b.getEndRow())
                 + " not greater than "
                 + Bytes.toStringBinary(prevBucket.getEndRow()),
                 Bytes.compareTo(b.getEndRow(), prevBucket.getEndRow()) >= 0);
-            assertTrue(Bytes.toStringBinary(b.getEndRow())
+            Assert.assertTrue(
+                Bytes.toStringBinary(b.getEndRow())
                 + " not greater than "
                 + Bytes.toStringBinary(prevBucket.getStartRow()),
                 Bytes.compareTo(b.getEndRow(), prevBucket.getStartRow()) >= 0);

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHTableClientScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHTableClientScanner.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHTableClientScanner.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestHTableClientScanner.java Fri Apr  4 18:18:26 2014
@@ -58,9 +58,8 @@ public class TestHTableClientScanner {
 
   @Test
   public void testScanner() throws IOException {
-    HTable table = TEST_UTIL.createTable(TABLE_NAME, FAMILY);
-    int regionCnt = TEST_UTIL.createMultiRegions(table, FAMILY);
-    TEST_UTIL.waitUntilAllRegionsAssigned(regionCnt);
+    HTable table = TEST_UTIL.createTable(TABLE_NAME, new byte[][] { FAMILY }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
 
     int rowCount = TEST_UTIL.loadTable(table, FAMILY);
 

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestMetaScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestMetaScanner.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestMetaScanner.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestMetaScanner.java Fri Apr  4 18:18:26 2014
@@ -59,15 +59,12 @@ public class TestMetaScanner {
     LOG.info("Starting testMetaScanner");
     final StringBytes TABLENAME = new StringBytes("testMetaScanner");
     final byte[] FAMILY = Bytes.toBytes("family");
-    TEST_UTIL.createTable(TABLENAME, FAMILY);
+
+    HTable table = TEST_UTIL.createTable(TABLENAME, new byte[][] { FAMILY }, 3,
+        Bytes.toBytes("region_a"), Bytes.toBytes("region_b"), 3);
+
     Configuration conf = TEST_UTIL.getConfiguration();
-    HTable table = new HTable(conf, TABLENAME);
-    TEST_UTIL.createMultiRegions(conf, table, FAMILY,
-        new byte[][]{
-          HConstants.EMPTY_START_ROW,
-          Bytes.toBytes("region_a"),
-          Bytes.toBytes("region_b")});
-    // Make sure all the regions are deployed
+     // Make sure all the regions are deployed
     TEST_UTIL.countRows(table);
 
     MetaScanner.MetaScannerVisitor visitor =

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestParallelScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestParallelScanner.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestParallelScanner.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/client/TestParallelScanner.java Fri Apr  4 18:18:26 2014
@@ -55,9 +55,10 @@ public class TestParallelScanner {
   public void testParallelScanner() throws IOException {
     // Create and load the table
     byte [] name = Bytes.toBytes("testParallelScanner");
-    HTable table = TEST_UTIL.createTable(name, new byte[][] {FAMILY});
-    final int regionCnt = TEST_UTIL.createMultiRegions(table, FAMILY);
-    TEST_UTIL.waitUntilAllRegionsAssigned(regionCnt);
+    int regionCnt = 25;
+    HTable table = TEST_UTIL.createTable(name, new byte[][] { FAMILY }, 3,
+            Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), regionCnt);
+
     final int rowCount = TEST_UTIL.loadTable(table, FAMILY);
     TEST_UTIL.flush(name);
 

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java Fri Apr  4 18:18:26 2014
@@ -72,6 +72,7 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.regionserver.StoreFile.BloomType;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
+import org.apache.hadoop.hbase.util.StringBytes;
 import org.apache.hadoop.hbase.util.TagRunner;
 import org.apache.hadoop.hbase.util.TestTag;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
@@ -107,7 +108,7 @@ public class TestHFileOutputFormat  {
     = { Bytes.add(PerformanceEvaluation.FAMILY_NAME, Bytes.toBytes("-A"))
       , Bytes.add(PerformanceEvaluation.FAMILY_NAME, Bytes.toBytes("-B"))
       , Bytes.add(PerformanceEvaluation.FAMILY_NAME, Bytes.toBytes("-C"))};
-  private static final byte[] TABLE_NAME = Bytes.toBytes("TestTable");
+  private static final StringBytes TABLE_NAME = new StringBytes("TestTable");
   private static final String oldValue = "valAAAAA";
   private static final String newValue = "valBBBBB";
 
@@ -535,12 +536,10 @@ public class TestHFileOutputFormat  {
     assertEquals(job.getNumReduceTasks(), 4);
   }
 
-  private byte [][] generateRandomStartKeys(int numKeys) {
+  private byte [][] generateRandomSplitKeys(int numSplits) {
     Random random = new Random();
-    byte[][] ret = new byte[numKeys][];
-    // first region start key is always empty
-    ret[0] = HConstants.EMPTY_BYTE_ARRAY;
-    for (int i = 1; i < numKeys; i++) {
+    byte[][] ret = new byte[numSplits][];
+    for (int i = 0; i < numSplits; i++) {
       ret[i] = PerformanceEvaluation.generateValue(random);
     }
     return ret;
@@ -563,19 +562,14 @@ public class TestHFileOutputFormat  {
     util = new HBaseTestingUtility();
     Configuration conf = util.getConfiguration();
     Path testDir = util.getTestDir("testLocalMRIncrementalLoad");
-    byte[][] startKeys = generateRandomStartKeys(5);
 
     try {
       util.startMiniCluster();
       HBaseAdmin admin = new HBaseAdmin(conf);
-      HTable table = util.createTable(TABLE_NAME, FAMILIES);
+      byte[][] splitKeys = generateRandomSplitKeys(4);
+      HTable table = util.createTable(TABLE_NAME, FAMILIES, 3, splitKeys);
       assertEquals("Should start with empty table",
           0, util.countRows(table));
-      for (byte[] family : FAMILIES) {
-        int numRegions = util.createMultiRegions(
-            util.getConfiguration(), table, family, startKeys);
-        assertEquals("Should make 5 regions", numRegions, 5);
-      }
 
       // Generate the bulk load files
       util.startMiniMapReduceCluster();
@@ -598,18 +592,10 @@ public class TestHFileOutputFormat  {
       // handle the split case
       if (shouldChangeRegions) {
         LOG.info("Changing regions in table");
-        admin.disableTable(table.getTableName());
-        byte[][] newStartKeys = generateRandomStartKeys(15);
-        for (byte[] family : FAMILIES) {
-          util.createMultiRegions(
-              util.getConfiguration(), table, family, newStartKeys);
-        }
-        admin.enableTable(table.getTableName());
-        while (table.getRegionsInfo().size() != 15 ||
-            !admin.isTableAvailable(table.getTableName())) {
-          Thread.sleep(1000);
-          LOG.info("Waiting for new region assignment to happen");
-        }
+        admin.deleteTable(table.getTableName());
+
+        byte[][] newSplitKeys = generateRandomSplitKeys(14);
+        table = util.createTable(TABLE_NAME, FAMILIES, 3, newSplitKeys);
       }
 
       // Perform the actual load
@@ -633,13 +619,13 @@ public class TestHFileOutputFormat  {
       String tableDigestBefore = util.checksumRows(table);
 
       // Cause regions to reopen
-      admin.disableTable(TABLE_NAME);
+      admin.disableTable(TABLE_NAME.getBytes());
       while (table.getRegionsInfo().size() != 0) {
         Thread.sleep(1000);
         LOG.info("Waiting for table to disable");
       }
-      admin.enableTable(TABLE_NAME);
-      util.waitTableAvailable(TABLE_NAME, 30000);
+      admin.enableTable(TABLE_NAME.getBytes());
+      util.waitTableAvailable(TABLE_NAME.getBytes(), 30000);
 
       assertEquals("Data should remain after reopening of regions",
           tableDigestBefore, util.checksumRows(table));
@@ -672,7 +658,7 @@ public class TestHFileOutputFormat  {
     try {
       MiniHBaseCluster cluster = util.startMiniCluster();
       cluster.getMaster();
-      HTable table = util.createTable(TABLE_NAME, FAMILIES);
+      HTable table = util.createTable(TABLE_NAME.getBytes(), FAMILIES);
       Configuration conf = table.getConfiguration() ;
       Path testDir = util.getTestDir("testUploadByTask");
 
@@ -743,7 +729,8 @@ public class TestHFileOutputFormat  {
   private void setupMockColumnFamilies(HTable table,
     Map<String, Compression.Algorithm> familyToCompression) throws IOException
   {
-    HTableDescriptor mockTableDescriptor = new HTableDescriptor(TABLE_NAME);
+    HTableDescriptor mockTableDescriptor =
+        new HTableDescriptor(TABLE_NAME.getBytes());
     for (Entry<String, Compression.Algorithm> entry : familyToCompression.entrySet()) {
       mockTableDescriptor.addFamily(new HColumnDescriptor(entry.getKey())
           .setMaxVersions(1)
@@ -891,7 +878,8 @@ public class TestHFileOutputFormat  {
   private void setupColumnFamiliesBloomType(HTable table,
     Map<String, BloomType> familyToBloom) throws IOException
   {
-    HTableDescriptor mockTableDescriptor = new HTableDescriptor(TABLE_NAME);
+    HTableDescriptor mockTableDescriptor =
+        new HTableDescriptor(TABLE_NAME.getBytes());
     for (Entry<String, BloomType> entry : familyToBloom.entrySet()) {
       mockTableDescriptor.addFamily(
           new HColumnDescriptor(entry.getKey().getBytes())
@@ -988,6 +976,7 @@ public class TestHFileOutputFormat  {
     }
   }
 
+  @SuppressWarnings("deprecation")
   private void setupColumnFamiliesEncodingType(HTable table,
       Map<String, DataBlockEncoding> familyToEncoding) throws IOException {
     HTableDescriptor mockTableDesc = new HTableDescriptor();
@@ -1255,17 +1244,11 @@ public class TestHFileOutputFormat  {
     Configuration conf = HBaseConfiguration.create();
     util = new HBaseTestingUtility(conf);
     if ("newtable".equals(args[0])) {
-      byte[] tname = args[1].getBytes();
-      HTable table = util.createTable(tname, FAMILIES);
-      HBaseAdmin admin = new HBaseAdmin(conf);
-      admin.disableTable(tname);
-      byte[][] startKeys = generateRandomStartKeys(5);
-      for (byte[] family : FAMILIES) {
-        util.createMultiRegions(conf, table, family, startKeys);
-      }
-      admin.enableTable(tname);
+      StringBytes tname = new StringBytes(args[1]);
+      byte[][] splitKeys = generateRandomSplitKeys(4);
+      util.createTable(tname, FAMILIES, 3, splitKeys);
     } else if ("incremental".equals(args[0])) {
-      byte[] tname = args[1].getBytes();
+      StringBytes tname = new StringBytes(args[1]);
       HTable table = new HTable(conf, tname);
       Path outDir = new Path("incremental-out");
       runIncrementalPELoad(conf, table, outDir);

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRPCCallOptimization.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRPCCallOptimization.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRPCCallOptimization.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestRPCCallOptimization.java Fri Apr  4 18:18:26 2014
@@ -55,8 +55,8 @@ public class TestRPCCallOptimization {
     // start mini hbase cluster
     TEST_UTIL.startMiniCluster(3);
     // create and fill table
-    table = TEST_UTIL.createTable(TABLE_NAME, INPUT_FAMILY);
-    TEST_UTIL.createMultiRegions(table, INPUT_FAMILY);
+    table = TEST_UTIL.createTable(TABLE_NAME, new byte[][] { INPUT_FAMILY }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
     TEST_UTIL.loadTable(table, INPUT_FAMILY);
     // start MR cluster
     TEST_UTIL.startMiniMapReduceCluster();
@@ -89,11 +89,13 @@ public class TestRPCCallOptimization {
       extends
       TableReducer<ImmutableBytesWritable, ImmutableBytesWritable, NullWritable> {
     
+    @Override
     protected void reduce(ImmutableBytesWritable key,
         Iterable<ImmutableBytesWritable> values, Context context)
         throws IOException, InterruptedException {
     }
 
+    @Override
     protected void cleanup(Context context) throws IOException,
         InterruptedException {
     }    

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatNMappersPerRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatNMappersPerRegion.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatNMappersPerRegion.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatNMappersPerRegion.java Fri Apr  4 18:18:26 2014
@@ -27,7 +27,6 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Result;
@@ -41,17 +40,15 @@ import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-
 /**
  * Tests TableInputFormat with varying numbers of mappers per region.
  */
 public class TestTableInputFormatNMappersPerRegion {
-  
+
   static final String SPECULATIVE_EXECUTION = "mapred.map.tasks.speculative.execution";
   static final Log LOG = LogFactory.getLog(TestTableInputFormatScan.class);
   static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
@@ -109,13 +106,13 @@ public class TestTableInputFormatNMapper
         }
       }
     }
-    
+
   }
-  
+
   /**
    * Tests whether TableInputFormat works correctly when number of mappers
    * per region is set to 1.
-   * 
+   *
    * @throws IOException
    * @throws InterruptedException
    * @throws ClassNotFoundException
@@ -125,10 +122,10 @@ public class TestTableInputFormatNMapper
   throws IOException, InterruptedException, ClassNotFoundException {
     testScan("testOneMapperPerRegion", 1, 25);
   }
-  
+
   /**
-   * Tests when number of mappers is set to 3. 
-   * 
+   * Tests when number of mappers is set to 3.
+   *
    * @throws IOException
    * @throws InterruptedException
    * @throws ClassNotFoundException
@@ -138,11 +135,11 @@ public class TestTableInputFormatNMapper
   throws IOException, InterruptedException, ClassNotFoundException {
     testScan("testThreeMappersPerRegion", 3, 25);
   }
-  
+
   /**
    * Tests the scenario where there is only one region. Expecting resumption to
    * one mapper per region.
-   * 
+   *
    * @throws IOException
    * @throws InterruptedException
    * @throws ClassNotFoundException
@@ -152,11 +149,11 @@ public class TestTableInputFormatNMapper
   throws IOException, InterruptedException, ClassNotFoundException {
     testScan("testOnTableWithOneRegion", 5, 1);
   }
-  
+
   /**
    * Tests the scenario where there is only two regions. Expecting resumption to
    * one mapper per region.
-   * 
+   *
    * @throws IOException
    * @throws InterruptedException
    * @throws ClassNotFoundException
@@ -166,10 +163,10 @@ public class TestTableInputFormatNMapper
   throws IOException, InterruptedException, ClassNotFoundException {
     testScan("testOnTableWithTwoRegions", 5, 2);
   }
-  
+
   /**
    * Tests whether the framework correctly detects illegal inputs.
-   * 
+   *
    * @throws IOException
    * @throws InterruptedException
    * @throws ClassNotFoundException
@@ -179,20 +176,20 @@ public class TestTableInputFormatNMapper
   throws IOException, InterruptedException, ClassNotFoundException {
     try {
       testScan("testZeroMapper", 0, 25);
-      assertTrue("Should not be able to take 0 as number of mappers " +
-          "per region", false);
+      Assert.assertTrue("Should not be able to take 0 as number of mappers "
+          + "per region", false);
     } catch (IllegalArgumentException e) {
       // Expected
     }
     try {
       testScan("testNegOneMapper", -1, 25);
-      assertTrue("Should not be able to take -1 as number of mappers " +
-          "per region", false);
+      Assert.assertTrue("Should not be able to take -1 as number of mappers "
+          + "per region", false);
     } catch (IllegalArgumentException e) {
       // Expected
     }
   }
-  
+
   // If numRegions > 2, this creates 25 regions, rather than numRegions regions.
   private void testScan(String tableName, int numMappersPerRegion, int numRegions)
   throws IOException, InterruptedException, ClassNotFoundException {
@@ -202,17 +199,21 @@ public class TestTableInputFormatNMapper
     c.setBoolean(SPECULATIVE_EXECUTION, false);
     // Set the number of maps per region for this job
     c.setInt(TableInputFormat.MAPPERS_PER_REGION, numMappersPerRegion);
-    // Create and fill table
-    table = TEST_UTIL.createTable(Bytes.toBytes(tableName), INPUT_FAMILY);
     // Store the number of regions opened
     int regionsOpened = 0;
     if (numRegions == 2) {
-      byte[][] startKeys = { HConstants.EMPTY_START_ROW, Bytes.toBytes("mmm") };
-      regionsOpened = TEST_UTIL.createMultiRegions(c, table, INPUT_FAMILY, startKeys);
+      regionsOpened = numRegions;
+      table = TEST_UTIL.createTable(Bytes.toBytes(tableName),
+          new byte[][] { INPUT_FAMILY }, 3, Bytes.toBytes("mmm"), null,
+          regionsOpened);
     } else if (numRegions == 1) {
+      table = TEST_UTIL.createTable(Bytes.toBytes(tableName), INPUT_FAMILY);
       regionsOpened = 1;
     } else if (numRegions > 2) {
-      regionsOpened = TEST_UTIL.createMultiRegions(table, INPUT_FAMILY);
+      regionsOpened = 25;
+      table = TEST_UTIL.createTable(Bytes.toBytes(tableName),
+          new byte[][] { INPUT_FAMILY }, 3, Bytes.toBytes("bbb"),
+          Bytes.toBytes("yyy"), regionsOpened);
     } else {
       throw new IllegalArgumentException("Expect positive number of regions but got " +
           numRegions);
@@ -227,7 +228,7 @@ public class TestTableInputFormatNMapper
     TableMapReduceUtil.initTableMapperJob(tableName, scan,
         RowCounterMapper.class, ImmutableBytesWritable.class, Result.class, job);
     job.waitForCompletion(true);
-    assertTrue(job.isComplete());
+    Assert.assertTrue(job.isComplete());
     // Get statistics
     Counters counters = job.getCounters();
     long totalMapCount = counters
@@ -235,10 +236,10 @@ public class TestTableInputFormatNMapper
     long totalRowCount = counters
         .findCounter(RowCounterMapper.Counters.ROWS).getValue();
     int actualNumMappersPerRegion = (numRegions > 2) ? numMappersPerRegion : 1;
-    assertEquals("Tried to open " + actualNumMappersPerRegion * regionsOpened + 
-        " maps but got " + totalMapCount, 
+    Assert.assertEquals("Tried to open " + actualNumMappersPerRegion * regionsOpened +
+        " maps but got " + totalMapCount,
         actualNumMappersPerRegion * regionsOpened, totalMapCount);
-    assertEquals("Supposed to find " + rowsLoaded + " rows but got " + totalRowCount, 
+    Assert.assertEquals("Supposed to find " + rowsLoaded + " rows but got " + totalRowCount,
         rowsLoaded, totalRowCount);
   }
 }

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScan.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScan.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScan.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScan.java Fri Apr  4 18:18:26 2014
@@ -41,13 +41,11 @@ import org.apache.hadoop.mapreduce.Reduc
 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Tests various scan start and stop row scenarios. This is set in a scan and
  * tested in a MapReduce job to see if that is handed over and done properly
@@ -73,8 +71,8 @@ public class TestTableInputFormatScan {
     // start mini hbase cluster
     TEST_UTIL.startMiniCluster(3);
     // create and fill table
-    table = TEST_UTIL.createTable(TABLE_NAME, INPUT_FAMILY);
-    TEST_UTIL.createMultiRegions(table, INPUT_FAMILY);
+    table = TEST_UTIL.createTable(TABLE_NAME, new byte[][] { INPUT_FAMILY }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
     TEST_UTIL.loadTable(table, INPUT_FAMILY);
     // start MR cluster
     TEST_UTIL.startMiniMapReduceCluster();
@@ -145,6 +143,7 @@ public class TestTableInputFormatScan {
     private String first = null;
     private String last = null;
 
+    @Override
     protected void reduce(ImmutableBytesWritable key,
         Iterable<ImmutableBytesWritable> values, Context context)
     throws IOException ,InterruptedException {
@@ -159,6 +158,7 @@ public class TestTableInputFormatScan {
       }
     }
 
+    @Override
     protected void cleanup(Context context)
     throws IOException, InterruptedException {
       Configuration c = context.getConfiguration();
@@ -167,10 +167,10 @@ public class TestTableInputFormatScan {
       LOG.info("cleanup: first -> \"" + first + "\", start row -> \"" + startRow + "\"");
       LOG.info("cleanup: last -> \"" + last + "\", last row -> \"" + lastRow + "\"");
       if (startRow != null && startRow.length() > 0) {
-        assertEquals(startRow, first);
+        Assert.assertEquals(startRow, first);
       }
       if (lastRow != null && lastRow.length() > 0) {
-        assertEquals(lastRow, last);
+        Assert.assertEquals(lastRow, last);
       }
     }
 
@@ -326,7 +326,6 @@ public class TestTableInputFormatScan {
    * @throws ClassNotFoundException
    * @throws InterruptedException
    */
-  @SuppressWarnings("deprecation")
   private void testScan(String start, String stop, String last)
   throws IOException, InterruptedException, ClassNotFoundException {
     String jobName = "Scan" + (start != null ? start.toUpperCase() : "Empty") +
@@ -353,7 +352,7 @@ public class TestTableInputFormatScan {
     FileOutputFormat.setOutputPath(job, new Path(job.getJobName()));
     LOG.info("Started " + job.getJobName());
     job.waitForCompletion(true);
-    assertTrue(job.isComplete());
+    Assert.assertTrue(job.isComplete());
     LOG.info("After map/reduce completion - job " + jobName);
   }
 }

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestMasterTransitions.java Fri Apr  4 18:18:26 2014
@@ -87,10 +87,10 @@ public class TestMasterTransitions {
     // Start a cluster of two regionservers.
     TEST_UTIL.startMiniCluster(2);
     // Create a table of three families.  This will assign a region.
-    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES);
-    HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
-    int countOfRegions = TEST_UTIL.createMultiRegions(t, getTestFamily());
-    TEST_UTIL.waitUntilAllRegionsAssigned(countOfRegions);
+    int countOfRegions = 25;
+    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), countOfRegions);
+
     addToEachStartKey(countOfRegions);
     TEST_UTIL.ensureSomeRegionServersAvailable(2);
   }
@@ -162,6 +162,7 @@ public class TestMasterTransitions {
       return result;
     }
 
+    @Override
     public void processed(final RegionServerOperation op) {
       if (isWantedCloseOperation(op) != null) return;
       this.done = true;
@@ -204,7 +205,7 @@ public class TestMasterTransitions {
   /**
    * In 2428, the meta region has just been set offline and then a close comes
    * in.
-   * @see <a href="https://issues.apache.org/jira/browse/HBASE-2428">HBASE-2428</a> 
+   * @see <a href="https://issues.apache.org/jira/browse/HBASE-2428">HBASE-2428</a>
    */
   @Test (timeout=300000) public void testRegionCloseWhenNoMetaHBase2428()
   throws Exception {
@@ -225,7 +226,7 @@ public class TestMasterTransitions {
     // Get a region out on the otherServer.
     final HRegionInfo hri =
       otherServer.getOnlineRegions().iterator().next().getRegionInfo();
- 
+
     // Add our RegionServerOperationsListener
     HBase2428Listener listener = new HBase2428Listener(cluster,
       metaHRS.getHServerInfo().getServerAddress(), hri, otherServerIndex);
@@ -352,7 +353,7 @@ public class TestMasterTransitions {
       this.copyOfOnlineRegions =
         this.victim.getCopyOfOnlineRegionsSortedBySize().values();
     }
- 
+
     @Override
     public boolean process(HServerInfo serverInfo, HMsg incomingMsg) {
       if (!victim.getServerInfo().equals(serverInfo) ||
@@ -405,7 +406,7 @@ public class TestMasterTransitions {
    * we kill it.  We then wait on all regions to come back on line.  If bug
    * is fixed, this should happen soon as the processing of the killed server is
    * done.
-   * @see <a href="https://issues.apache.org/jira/browse/HBASE-2482">HBASE-2482</a> 
+   * @see <a href="https://issues.apache.org/jira/browse/HBASE-2482">HBASE-2482</a>
    */
   @Test (timeout=300000) public void testKillRSWithOpeningRegion2482()
   throws Exception {
@@ -543,7 +544,7 @@ public class TestMasterTransitions {
     int rows = 0;
     Scan scan = new Scan();
     ResultScanner s = t.getScanner(scan);
-    for (Result r = null; (r = s.next()) != null;) {
+    while (s.next() != null) {
       rows++;
     }
     s.close();

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestROOTAssignment.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestROOTAssignment.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestROOTAssignment.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestROOTAssignment.java Fri Apr  4 18:18:26 2014
@@ -58,11 +58,11 @@ public class TestROOTAssignment {
     TEST_UTIL.getConfiguration().setInt("hbase.regions.percheckin", 2);
     // Start a cluster of two regionservers.
     TEST_UTIL.startMiniCluster(2);
+
     // Create a table of three families.  This will assign a region.
-    TEST_UTIL.createTable(TABLENAME, FAMILIES);
-    HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
-    int countOfRegions = TEST_UTIL.createMultiRegions(t, FAMILIES[0]);
-    TEST_UTIL.waitUntilAllRegionsAssigned(countOfRegions);
+    TEST_UTIL.createTable(TABLENAME, FAMILIES, 3, Bytes.toBytes("bbb"),
+        Bytes.toBytes("yyy"), 25);
+
     HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
     TEST_UTIL.loadTable(table, FAMILIES[0]);
     table.close();
@@ -86,7 +86,7 @@ public class TestROOTAssignment {
     private boolean done = false;
     private final HServerAddress rootServerAddress;
     private final HMaster master;
- 
+
     PostponeShutdownProcessing(final HMaster master,
         final HServerAddress rootServerAddress) {
       this.master = master;
@@ -138,7 +138,7 @@ public class TestROOTAssignment {
    * If the split of the log for the regionserver hosting ROOT doesn't go off
    * smoothly, if the process server shutdown gets added to the delayed queue
    * of events to process, then ROOT was not being allocated, ever.
-   * @see <a href="https://issues.apache.org/jira/browse/HBASE-2707">HBASE-2707</a> 
+   * @see <a href="https://issues.apache.org/jira/browse/HBASE-2707">HBASE-2707</a>
    */
   @Test (timeout=300000) public void testROOTDeployedThoughProblemSplittingLog()
   throws Exception {
@@ -148,7 +148,7 @@ public class TestROOTAssignment {
     byte [] rootRegion = Bytes.toBytes("-ROOT-,,0");
     int rootIndex = cluster.getServerWith(rootRegion);
     final HRegionServer rootHRS = cluster.getRegionServer(rootIndex);
- 
+
     // Add our RegionServerOperationsListener
     PostponeShutdownProcessing listener = new PostponeShutdownProcessing(master,
       rootHRS.getHServerInfo().getServerAddress());

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedCloseRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedCloseRegion.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedCloseRegion.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedCloseRegion.java Fri Apr  4 18:18:26 2014
@@ -27,25 +27,20 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HMsg;
-import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.master.HMaster;
-import org.apache.hadoop.hbase.master.ProcessRegionClose;
-import org.apache.hadoop.hbase.master.RegionServerOperation;
-import org.apache.hadoop.hbase.master.RegionServerOperationListener;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.hbase.util.Writables;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -66,10 +61,11 @@ public class TestZKBasedCloseRegion {
     c.setInt(HConstants.REGIONSERVER_INFO_PORT, 0);
     c.setInt("hbase.master.meta.thread.rescanfrequency", 5*1000);
     TEST_UTIL.startMiniCluster(2);
-    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES);
-    HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
-    int countOfRegions = TEST_UTIL.createMultiRegions(t, getTestFamily());
-    waitUntilAllRegionsAssigned(countOfRegions);
+
+    int countOfRegions = 25;
+    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), countOfRegions);
+
     addToEachStartKey(countOfRegions);
   }
 
@@ -82,7 +78,7 @@ public class TestZKBasedCloseRegion {
       // Need at least two servers.
       LOG.info("Started new server=" +
         TEST_UTIL.getHBaseCluster().startRegionServer());
-      
+
     }
   }
 
@@ -99,16 +95,16 @@ public class TestZKBasedCloseRegion {
     LOG.debug("Asking RS to close region " + region.getRegionNameAsString());
 
     AtomicBoolean closeEventProcessed = new AtomicBoolean(false);
-    RegionServerOperationListener listener = 
+    RegionServerOperationListener listener =
       new CloseRegionEventListener(region.getRegionNameAsString(), closeEventProcessed);
     HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
     master.getRegionServerOperationQueue().registerRegionServerOperationListener(listener);
-    HMsg closeRegionMsg = new HMsg(HMsg.Type.MSG_REGION_CLOSE, 
+    HMsg closeRegionMsg = new HMsg(HMsg.Type.MSG_REGION_CLOSE,
                                    region.getRegionInfo(),
                                    Bytes.toBytes("Forcing close in test")
                                   );
     TEST_UTIL.getHBaseCluster().addMessageToSendRegionServer(rsIdx, closeRegionMsg);
-    
+
     synchronized(closeEventProcessed) {
       // wait for 3 minutes
       closeEventProcessed.wait(3*60*1000);
@@ -120,9 +116,9 @@ public class TestZKBasedCloseRegion {
       LOG.info("Done with test, RS informed master successfully.");
     }
   }
-  
+
   public static class CloseRegionEventListener implements RegionServerOperationListener {
-    
+
     private static final Log LOG = LogFactory.getLog(CloseRegionEventListener.class);
     String regionToClose;
     AtomicBoolean closeEventProcessed;
@@ -157,33 +153,10 @@ public class TestZKBasedCloseRegion {
         }
       }
     }
-    
-  }
-  
 
-  private static void waitUntilAllRegionsAssigned(final int countOfRegions)
-  throws IOException {
-    HTable meta = new HTable(TEST_UTIL.getConfiguration(),
-      HConstants.META_TABLE_NAME);
-    while (true) {
-      int rows = 0;
-      Scan scan = new Scan();
-      scan.addColumn(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-      ResultScanner s = meta.getScanner(scan);
-      for (Result r = null; (r = s.next()) != null;) {
-        byte [] b =
-          r.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-        if (b == null || b.length <= 0) break;
-        rows++;
-      }
-      s.close();
-      // If I get to here and all rows have a Server, then all have been assigned.
-      if (rows == countOfRegions) break;
-      LOG.info("Found=" + rows);
-      Threads.sleep(1000); 
-    }
   }
 
+
   /*
    * Add to each of the regions in .META. a value.  Key is the startrow of the
    * region (except its 'aaa' for first region).  Actual value is the row name.
@@ -228,14 +201,14 @@ public class TestZKBasedCloseRegion {
   private static byte [] getTestQualifier() {
     return getTestFamily();
   }
-  
+
   public static void main(String args[]) throws Exception {
     TestZKBasedCloseRegion.beforeAllTests();
-    
+
     TestZKBasedCloseRegion test = new TestZKBasedCloseRegion();
     test.setup();
     test.testCloseRegion();
-    
+
     TestZKBasedCloseRegion.afterAllTests();
   }
 }

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedReopenRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedReopenRegion.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedReopenRegion.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedReopenRegion.java Fri Apr  4 18:18:26 2014
@@ -27,26 +27,20 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HMsg;
-import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HServerInfo;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.master.HMaster;
-import org.apache.hadoop.hbase.master.ProcessRegionClose;
-import org.apache.hadoop.hbase.master.ProcessRegionOpen;
-import org.apache.hadoop.hbase.master.RegionServerOperation;
-import org.apache.hadoop.hbase.master.RegionServerOperationListener;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.hbase.util.Writables;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -67,10 +61,11 @@ public class TestZKBasedReopenRegion {
     c.setInt(HConstants.REGIONSERVER_INFO_PORT, 0);
     c.setInt("hbase.master.meta.thread.rescanfrequency", 5*1000);
     TEST_UTIL.startMiniCluster(2);
-    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES);
-    HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
-    int countOfRegions = TEST_UTIL.createMultiRegions(t, getTestFamily());
-    waitUntilAllRegionsAssigned(countOfRegions);
+
+    int countOfRegions = 25;
+    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
+
     addToEachStartKey(countOfRegions);
   }
 
@@ -83,7 +78,7 @@ public class TestZKBasedReopenRegion {
       // Need at least two servers.
       LOG.info("Started new server=" +
         TEST_UTIL.getHBaseCluster().startRegionServer());
-      
+
     }
   }
 
@@ -100,18 +95,18 @@ public class TestZKBasedReopenRegion {
 
     AtomicBoolean closeEventProcessed = new AtomicBoolean(false);
     AtomicBoolean reopenEventProcessed = new AtomicBoolean(false);
-    RegionServerOperationListener listener = 
-      new ReopenRegionEventListener(region.getRegionNameAsString(), 
+    RegionServerOperationListener listener =
+      new ReopenRegionEventListener(region.getRegionNameAsString(),
                                     closeEventProcessed,
                                     reopenEventProcessed);
     HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
     master.getRegionServerOperationQueue().registerRegionServerOperationListener(listener);
-    HMsg closeRegionMsg = new HMsg(HMsg.Type.MSG_REGION_CLOSE, 
+    HMsg closeRegionMsg = new HMsg(HMsg.Type.MSG_REGION_CLOSE,
                                    region.getRegionInfo(),
                                    Bytes.toBytes("Forcing close in test")
                                   );
     TEST_UTIL.getHBaseCluster().addMessageToSendRegionServer(rsIdx, closeRegionMsg);
-    
+
     synchronized(closeEventProcessed) {
       closeEventProcessed.wait(3*60*1000);
     }
@@ -124,19 +119,19 @@ public class TestZKBasedReopenRegion {
     }
     if(!reopenEventProcessed.get()) {
       throw new Exception("Timed out, open event not called on master after region close.");
-    }    
-    
+    }
+
     LOG.info("Done with test, RS informed master successfully.");
   }
-  
+
   public static class ReopenRegionEventListener implements RegionServerOperationListener {
-    
+
     private static final Log LOG = LogFactory.getLog(ReopenRegionEventListener.class);
     String regionToClose;
     AtomicBoolean closeEventProcessed;
     AtomicBoolean reopenEventProcessed;
 
-    public ReopenRegionEventListener(String regionToClose, 
+    public ReopenRegionEventListener(String regionToClose,
                                      AtomicBoolean closeEventProcessed,
                                      AtomicBoolean reopenEventProcessed) {
       this.regionToClose = regionToClose;
@@ -180,35 +175,11 @@ public class TestZKBasedReopenRegion {
           synchronized(reopenEventProcessed) {
             reopenEventProcessed.notifyAll();
           }
-        }        
+        }
       }
-      
-    }
-    
-  }
-  
 
-  private static void waitUntilAllRegionsAssigned(final int countOfRegions)
-  throws IOException {
-    HTable meta = new HTable(TEST_UTIL.getConfiguration(),
-      HConstants.META_TABLE_NAME);
-    while (true) {
-      int rows = 0;
-      Scan scan = new Scan();
-      scan.addColumn(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-      ResultScanner s = meta.getScanner(scan);
-      for (Result r = null; (r = s.next()) != null;) {
-        byte [] b =
-          r.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-        if (b == null || b.length <= 0) break;
-        rows++;
-      }
-      s.close();
-      // If I get to here and all rows have a Server, then all have been assigned.
-      if (rows == countOfRegions) break;
-      LOG.info("Found=" + rows);
-      Threads.sleep(1000); 
     }
+
   }
 
   /*
@@ -255,14 +226,14 @@ public class TestZKBasedReopenRegion {
   private static byte [] getTestQualifier() {
     return getTestFamily();
   }
-  
+
   public static void main(String args[]) throws Exception {
     TestZKBasedReopenRegion.beforeAllTests();
-    
+
     TestZKBasedReopenRegion test = new TestZKBasedReopenRegion();
     test.setup();
     test.testOpenRegion();
-    
+
     TestZKBasedReopenRegion.afterAllTests();
   }
 }

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionInfo.java Fri Apr  4 18:18:26 2014
@@ -36,7 +36,6 @@ import org.apache.hadoop.hbase.HColumnDe
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.ipc.HBaseRPCOptions;
 import org.apache.hadoop.hbase.ipc.HRegionInterface;
 import org.apache.hadoop.hbase.ipc.ThriftHRegionInterface;
@@ -170,8 +169,8 @@ public class TestHRegionInfo {
     testUtil.startMiniCluster();
     Configuration conf = testUtil.getConfiguration();
 
-    HTable htable = testUtil.createTable(table, family);
-    testUtil.createMultiRegions(htable, family);
+    testUtil.createTable(table, new byte[][] { family }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
 
     List<HRegion> regions = testUtil.getMiniHBaseCluster().getRegions(table);
     HRegion region = regions.get(0);

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionFavoredNodes.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionFavoredNodes.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionFavoredNodes.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionFavoredNodes.java Fri Apr  4 18:18:26 2014
@@ -33,9 +33,9 @@ public class TestRegionFavoredNodes {
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
     TEST_UTIL.startMiniCluster(REGION_SERVERS);
-    table = TEST_UTIL.createTable(TABLE_NAME, COLUMN_FAMILY);
-    int numRegions = TEST_UTIL.createMultiRegions(table, COLUMN_FAMILY);
-    TEST_UTIL.waitUntilAllRegionsAssigned(numRegions);
+
+    table = TEST_UTIL.createTable(TABLE_NAME, new byte[][] { COLUMN_FAMILY }, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), 25);
   }
 
   @AfterClass

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerShutdown.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerShutdown.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerShutdown.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerShutdown.java Fri Apr  4 18:18:26 2014
@@ -19,6 +19,10 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -33,7 +37,6 @@ import org.apache.hadoop.hbase.client.Re
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.hbase.util.Writables;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -41,13 +44,6 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
 public class TestRegionServerShutdown {
 
   private static final Log LOG = LogFactory.getLog(TestRegionServerShutdown.class);
@@ -62,10 +58,11 @@ public class TestRegionServerShutdown {
     c.setInt(HConstants.REGIONSERVER_INFO_PORT, 0);
     c.setInt("hbase.master.meta.thread.rescanfrequency", 5*1000);
     TEST_UTIL.startMiniCluster(2);
-    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES);
-    HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
-    int countOfRegions = TEST_UTIL.createMultiRegions(t, getTestFamily());
-    waitUntilAllRegionsAssigned(countOfRegions);
+
+    int countOfRegions = 25;
+    TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES, 3,
+        Bytes.toBytes("bbb"), Bytes.toBytes("yyy"), countOfRegions);
+
     addToEachStartKey(countOfRegions);
   }
 
@@ -99,7 +96,7 @@ public class TestRegionServerShutdown {
     LOG.debug("Asking RS " + regionServer1.getServerInfo().getHostnamePort()
         + " to close region " + region.getRegionNameAsString());
     regionServer1.closeRegion(region.getRegionInfo(), true);
-    assertNull(regionServer1.getOnlineRegion(region.getRegionName()));
+    Assert.assertNull(regionServer1.getOnlineRegion(region.getRegionName()));
 
     // Let master assign the region to the RS0, otherwise the region has a chance
     // to be assign it back to RS1 and void this test.
@@ -120,30 +117,8 @@ public class TestRegionServerShutdown {
     Thread.sleep(5000);
     LOG.debug("RS " + regionServer0.getServerInfo().getHostnamePort() + " has "
         + regionServer0.getOnlineRegions().size() + " online regions");
-    assertEquals("No open region should exist", 0, regionServer0.getOnlineRegions().size());
-  }
-
-  private static void waitUntilAllRegionsAssigned(final int countOfRegions)
-      throws IOException {
-    HTable meta = new HTable(TEST_UTIL.getConfiguration(),
-        HConstants.META_TABLE_NAME);
-    while (true) {
-      int rows = 0;
-      Scan scan = new Scan();
-      scan.addColumn(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-      ResultScanner s = meta.getScanner(scan);
-      for (Result r = null; (r = s.next()) != null;) {
-        byte [] b =
-            r.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER);
-        if (b == null || b.length <= 0) break;
-        rows++;
-      }
-      s.close();
-      // If I get to here and all rows have a Server, then all have been assigned.
-      if (rows == countOfRegions) break;
-      LOG.info("Found=" + rows);
-      Threads.sleep(1000);
-    }
+    Assert.assertEquals("No open region should exist", 0, regionServer0
+        .getOnlineRegions().size());
   }
 
   /*

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestServerSideException.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestServerSideException.java?rev=1584851&r1=1584850&r2=1584851&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestServerSideException.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestServerSideException.java Fri Apr  4 18:18:26 2014
@@ -19,7 +19,8 @@
  */
 package org.apache.hadoop.hbase.thrift.swift;
 
-import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -35,13 +36,13 @@ import org.apache.hadoop.hbase.ipc.Thrif
 import org.apache.hadoop.hbase.regionserver.FailureInjectingThriftHRegionServer;
 import org.apache.hadoop.hbase.regionserver.RegionOverloadedException;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.StringBytes;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.assertTrue;
+import com.google.common.util.concurrent.ListenableFuture;
 
 /**
  * Test failure handling in HTableAsync. We can also use it in
@@ -113,7 +114,7 @@ public class TestServerSideException {
         hasIOE = true;
       }
     }
-    assertTrue(hasIOE);
+    Assert.assertTrue(hasIOE);
   }
 
   /**
@@ -130,7 +131,7 @@ public class TestServerSideException {
     Get get = new Get.Builder(ROW).addFamily(FAMILY).create();
     ListenableFuture<Result> future = table.getAsync(get);
     Result result = future.get();
-    assertTrue(Bytes.equals(result.getValue(FAMILY, null), VALUE));
+    Assert.assertTrue(Bytes.equals(result.getValue(FAMILY, null), VALUE));
 
     // Expect the client to retry once and fail on the second attempt.
     // In the mean time, it should sleep enough time as the server requested.
@@ -148,11 +149,11 @@ public class TestServerSideException {
         long futureFinishTime = System.currentTimeMillis();
         // The default value is 1000ms, larger than 200ms set for normal retries.
         // So we know client listens to the instruction of server.
-        assertTrue(futureFinishTime - futureStartTime > HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
+        Assert.assertTrue(futureFinishTime - futureStartTime > HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
         hasROE = true;
       }
     }
-    assertTrue(hasROE);
+    Assert.assertTrue(hasROE);
   }
 
   /**
@@ -169,7 +170,7 @@ public class TestServerSideException {
     Get get = new Get.Builder(ROW).addFamily(FAMILY).create();
     ListenableFuture<Result> future = table.getAsync(get);
     Result result = future.get();
-    assertTrue(Bytes.equals(result.getValue(FAMILY, null), VALUE));
+    Assert.assertTrue(Bytes.equals(result.getValue(FAMILY, null), VALUE));
   }
 
   /**
@@ -192,7 +193,7 @@ public class TestServerSideException {
         hasDoNotRetryIOE = true;
       }
     }
-    assertTrue(hasDoNotRetryIOE);
+    Assert.assertTrue(hasDoNotRetryIOE);
   }
 
   /**
@@ -205,11 +206,9 @@ public class TestServerSideException {
    */
   @Test
   public void testTTransportException() throws Exception {
-    HTableAsync table = TEST_UTIL.createTable(
-        Bytes.toBytes("testTable2"), FAMILY);
-
-    int numRegions = TEST_UTIL.createMultiRegions(table, FAMILY);
-    TEST_UTIL.waitUntilAllRegionsAssigned(numRegions);
+    HTableAsync table = TEST_UTIL.createTable(new StringBytes("testTable2"),
+        new byte[][] { FAMILY }, 3, Bytes.toBytes("bbb"),
+        Bytes.toBytes("yyy"), 25);
 
     Put put = new Put(ROW);
     put.add(FAMILY, null, VALUE);
@@ -222,6 +221,6 @@ public class TestServerSideException {
     Get get = new Get.Builder(ROW).addFamily(FAMILY).create();
     ListenableFuture<Result> future = table.getAsync(get);
     Result result = future.get();
-    assertTrue(Bytes.equals(result.getValue(FAMILY, null), VALUE));
+    Assert.assertTrue(Bytes.equals(result.getValue(FAMILY, null), VALUE));
   }
 }