hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1425525 [5/7] - in /hbase/branches/0.94-test: ./ bin/ conf/ security/src/main/java/org/apache/hadoop/hbase/ipc/ security/src/main/java/org/apache/hadoop/hbase/security/access/ security/src/test/java/org/apache/hadoop/hbase/security/access/...
Date Sun, 23 Dec 2012 20:54:15 GMT
Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Sun Dec 23 20:54:12 2012
@@ -39,7 +39,6 @@ import java.util.Map;
 import java.util.NavigableSet;
 import java.util.Random;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -97,7 +96,9 @@ import org.apache.zookeeper.ZooKeeper;
  * old HBaseTestCase and HBaseClusterTestCase functionality.
  * Create an instance and keep it around testing HBase.  This class is
  * meant to be your one-stop shop for anything you might need testing.  Manages
- * one cluster at a time only.
+ * one cluster at a time only. Managed cluster can be an in-process
+ * {@link MiniHBaseCluster}, or a deployed cluster of type {@link DistributedHBaseCluster}.
+ * Not all methods work with the real cluster.
  * Depends on log4j being on classpath and
  * hbase-site.xml for logging and test-run configuration.  It does not set
  * logging levels nor make changes to configuration parameters.
@@ -120,7 +121,7 @@ public class HBaseTestingUtility {
   private boolean passedZkCluster = false;
   private MiniDFSCluster dfsCluster = null;
 
-  private MiniHBaseCluster hbaseCluster = null;
+  private HBaseCluster hbaseCluster = null;
   private MiniMRCluster mrCluster = null;
 
   // Directory where we put the data for this instance of HBaseTestingUtility
@@ -213,6 +214,10 @@ public class HBaseTestingUtility {
     return this.conf;
   }
 
+  public void setHBaseCluster(HBaseCluster hbaseCluster) {
+    this.hbaseCluster = hbaseCluster;
+  }
+
   /**
    * @return Where to write test data on local filesystem; usually
    * {@link #DEFAULT_BASE_TEST_DIRECTORY}
@@ -650,7 +655,7 @@ public class HBaseTestingUtility {
 
     getHBaseAdmin(); // create immediately the hbaseAdmin
     LOG.info("Minicluster is up");
-    return this.hbaseCluster;
+    return (MiniHBaseCluster)this.hbaseCluster;
   }
 
   /**
@@ -678,7 +683,11 @@ public class HBaseTestingUtility {
    * @see #startMiniCluster()
    */
   public MiniHBaseCluster getMiniHBaseCluster() {
-    return this.hbaseCluster;
+    if (this.hbaseCluster instanceof MiniHBaseCluster) {
+      return (MiniHBaseCluster)this.hbaseCluster;
+    }
+    throw new RuntimeException(hbaseCluster + " not an instance of " +
+                               MiniHBaseCluster.class.getName());
   }
 
   /**
@@ -721,7 +730,7 @@ public class HBaseTestingUtility {
     if (this.hbaseCluster != null) {
       this.hbaseCluster.shutdown();
       // Wait till hbase is down before going on to shutdown zk.
-      this.hbaseCluster.join();
+      this.hbaseCluster.waitUntilShutDown();
       this.hbaseCluster = null;
     }
   }
@@ -759,7 +768,7 @@ public class HBaseTestingUtility {
    * @throws IOException
    */
   public void flush() throws IOException {
-    this.hbaseCluster.flushcache();
+    getMiniHBaseCluster().flushcache();
   }
 
   /**
@@ -767,7 +776,7 @@ public class HBaseTestingUtility {
    * @throws IOException
    */
   public void flush(byte [] tableName) throws IOException {
-    this.hbaseCluster.flushcache(tableName);
+    getMiniHBaseCluster().flushcache(tableName);
   }
 
   /**
@@ -775,7 +784,7 @@ public class HBaseTestingUtility {
    * @throws IOException
    */
   public void compact(boolean major) throws IOException {
-    this.hbaseCluster.compact(major);
+    getMiniHBaseCluster().compact(major);
   }
 
   /**
@@ -783,7 +792,7 @@ public class HBaseTestingUtility {
    * @throws IOException
    */
   public void compact(byte [] tableName, boolean major) throws IOException {
-    this.hbaseCluster.compact(tableName, major);
+    getMiniHBaseCluster().compact(tableName, major);
   }
 
 
@@ -1003,6 +1012,37 @@ public class HBaseTestingUtility {
     t.flushCommits();
     return rowCount;
   }
+
+  /**
+   * Load table of multiple column families with rows from 'aaa' to 'zzz'.
+   * @param t Table
+   * @param f Array of Families to load
+   * @return Count of rows loaded.
+   * @throws IOException
+   */
+  public int loadTable(final HTable t, final byte[][] f) throws IOException {
+    t.setAutoFlush(false);
+    byte[] k = new byte[3];
+    int rowCount = 0;
+    for (byte b1 = 'a'; b1 <= 'z'; b1++) {
+      for (byte b2 = 'a'; b2 <= 'z'; b2++) {
+        for (byte b3 = 'a'; b3 <= 'z'; b3++) {
+          k[0] = b1;
+          k[1] = b2;
+          k[2] = b3;
+          Put put = new Put(k);
+          for (int i = 0; i < f.length; i++) {
+            put.add(f[i], null, k);
+          }
+          t.put(put);
+          rowCount++;
+        }
+      }
+    }
+    t.flushCommits();
+    return rowCount;
+  }
+
   /**
    * Load region with rows from 'aaa' to 'zzz'.
    * @param r Region
@@ -1069,7 +1109,7 @@ public class HBaseTestingUtility {
    */
   public int createMultiRegions(HTable table, byte[] columnFamily)
   throws IOException {
-    return createMultiRegions(getConfiguration(), table, columnFamily);
+    return createMultiRegions(table, columnFamily, true);
   }
 
   public static final byte[][] KEYS = {
@@ -1086,16 +1126,16 @@ public class HBaseTestingUtility {
 
   /**
    * 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.
+   * @param cleanupFS  True if a previous region should be remove from the FS  
    * @return count of regions created.
    * @throws IOException When creating the regions fails.
    */
-  public int createMultiRegions(final Configuration c, final HTable table,
-      final byte[] columnFamily)
+  public int createMultiRegions(HTable table, byte[] columnFamily, boolean cleanupFS)
   throws IOException {
-    return createMultiRegions(c, table, columnFamily, KEYS);
+    return createMultiRegions(getConfiguration(), table, columnFamily, KEYS, cleanupFS);
   }
 
   /**
@@ -1123,7 +1163,12 @@ public class HBaseTestingUtility {
   }
 
   public int createMultiRegions(final Configuration c, final HTable table,
-      final byte[] columnFamily, byte [][] startKeys)
+      final byte[] columnFamily, byte [][] startKeys) throws IOException {
+    return createMultiRegions(c, table, columnFamily, startKeys, true);
+  }
+  
+  public int createMultiRegions(final Configuration c, final HTable table,
+          final byte[] columnFamily, byte [][] startKeys, boolean cleanupFS)
   throws IOException {
     Arrays.sort(startKeys, Bytes.BYTES_COMPARATOR);
     HTable meta = new HTable(c, HConstants.META_TABLE_NAME);
@@ -1137,6 +1182,9 @@ public class HBaseTestingUtility {
     // and end key. Adding the custom regions below adds those blindly,
     // including the new start region from empty to "bbb". lg
     List<byte[]> rows = getMetaTableRows(htd.getName());
+    String regionToDeleteInFS = table
+        .getRegionsInRange(Bytes.toBytes(""), Bytes.toBytes("")).get(0)
+        .getRegionInfo().getEncodedName();
     List<HRegionInfo> newRegions = new ArrayList<HRegionInfo>(startKeys.length);
     // add custom ones
     int count = 0;
@@ -1158,13 +1206,22 @@ public class HBaseTestingUtility {
         Bytes.toStringBinary(row));
       meta.delete(new Delete(row));
     }
+    if (cleanupFS) {
+      // see HBASE-7417 - this confused TestReplication
+      // remove the "old" region from FS
+      Path tableDir = new Path(getDefaultRootDirPath().toString()
+          + System.getProperty("file.separator") + htd.getNameAsString()
+          + System.getProperty("file.separator") + regionToDeleteInFS);
+      getDFSCluster().getFileSystem().delete(tableDir);
+    }
     // flush cache of regions
     HConnection conn = table.getConnection();
     conn.clearRegionCache();
     // assign all the new regions IF table is enabled.
-    if (getHBaseAdmin().isTableEnabled(table.getTableName())) {
+    HBaseAdmin admin = getHBaseAdmin();
+    if (admin.isTableEnabled(table.getTableName())) {
       for(HRegionInfo hri : newRegions) {
-        hbaseCluster.getMaster().assignRegion(hri);
+        admin.assign(hri.getRegionName());
       }
     }
 
@@ -1275,8 +1332,8 @@ public class HBaseTestingUtility {
       Bytes.toString(tableName));
     byte [] firstrow = metaRows.get(0);
     LOG.debug("FirstRow=" + Bytes.toString(firstrow));
-    int index = hbaseCluster.getServerWith(firstrow);
-    return hbaseCluster.getRegionServerThreads().get(index).getRegionServer();
+    int index = getMiniHBaseCluster().getServerWith(firstrow);
+    return getMiniHBaseCluster().getRegionServerThreads().get(index).getRegionServer();
   }
 
   /**
@@ -1357,7 +1414,7 @@ public class HBaseTestingUtility {
    * @throws Exception
    */
   public void expireMasterSession() throws Exception {
-    HMaster master = hbaseCluster.getMaster();
+    HMaster master = getMiniHBaseCluster().getMaster();
     expireSession(master.getZooKeeper(), false);
   }
 
@@ -1367,7 +1424,7 @@ public class HBaseTestingUtility {
    * @throws Exception
    */
   public void expireRegionServerSession(int index) throws Exception {
-    HRegionServer rs = hbaseCluster.getRegionServer(index);
+    HRegionServer rs = getMiniHBaseCluster().getRegionServer(index);
     expireSession(rs.getZooKeeper(), false);
     decrementMinRegionServerCount();
   }
@@ -1441,13 +1498,27 @@ public class HBaseTestingUtility {
     }
   }
 
-
   /**
-   * Get the HBase cluster.
+   * Get the Mini HBase cluster.
    *
    * @return hbase cluster
+   * @see #getHBaseClusterInterface()
    */
   public MiniHBaseCluster getHBaseCluster() {
+    return getMiniHBaseCluster();
+  }
+
+  /**
+   * Returns the HBaseCluster instance.
+   * <p>Returned object can be any of the subclasses of HBaseCluster, and the
+   * tests referring this should not assume that the cluster is a mini cluster or a
+   * distributed one. If the test only works on a mini cluster, then specific
+   * method {@link #getMiniHBaseCluster()} can be used instead w/o the
+   * need to type-cast.
+   */
+  public HBaseCluster getHBaseClusterInterface() {
+    //implementation note: we should rename this method as #getHBaseCluster(),
+    //but this would require refactoring 90+ calls.
     return hbaseCluster;
   }
 
@@ -1609,8 +1680,8 @@ public class HBaseTestingUtility {
   public boolean ensureSomeRegionServersAvailable(final int num)
       throws IOException {
     boolean startedServer = false;
-
-    for (int i=hbaseCluster.getLiveRegionServerThreads().size(); i<num; ++i){
+    MiniHBaseCluster hbaseCluster = getMiniHBaseCluster();
+    for (int i=hbaseCluster.getLiveRegionServerThreads().size(); i<num; ++i) {
       LOG.info("Started new server=" + hbaseCluster.startRegionServer());
       startedServer = true;
     }
@@ -1632,12 +1703,12 @@ public class HBaseTestingUtility {
     boolean startedServer = ensureSomeRegionServersAvailable(num);
 
     for (JVMClusterUtil.RegionServerThread rst :
-      hbaseCluster.getRegionServerThreads()) {
+      getMiniHBaseCluster().getRegionServerThreads()) {
 
       HRegionServer hrs = rst.getRegionServer();
       if (hrs.isStopping() || hrs.isStopped()) {
         LOG.info("A region server is stopped or stopping:"+hrs);
-        LOG.info("Started new server=" + hbaseCluster.startRegionServer());
+        LOG.info("Started new server=" + getMiniHBaseCluster().startRegionServer());
         startedServer = true;
       }
     }
@@ -1907,7 +1978,9 @@ public class HBaseTestingUtility {
         Bytes.toBytes(String.format(keyFormat, splitStartKey)),
         Bytes.toBytes(String.format(keyFormat, splitEndKey)),
         numRegions);
-    hbaseCluster.flushcache(HConstants.META_TABLE_NAME);
+    if (hbaseCluster != null) {
+      getMiniHBaseCluster().flushcache(HConstants.META_TABLE_NAME);
+    }
 
     for (int iFlush = 0; iFlush < numFlushes; ++iFlush) {
       for (int iRow = 0; iRow < numRowsPerFlush; ++iRow) {
@@ -1942,7 +2015,9 @@ public class HBaseTestingUtility {
       }
       LOG.info("Initiating flush #" + iFlush + " for table " + tableName);
       table.flushCommits();
-      hbaseCluster.flushcache(tableNameBytes);
+      if (hbaseCluster != null) {
+        getMiniHBaseCluster().flushcache(tableNameBytes);
+      }
     }
 
     return table;

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/LargeTests.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/LargeTests.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/LargeTests.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/LargeTests.java Sun Dec 23 20:54:12 2012
@@ -33,6 +33,7 @@ package org.apache.hadoop.hbase;
  *
  * @see SmallTests
  * @see MediumTests
+ * @see IntegrationTests
  */
 public interface LargeTests {
 }

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MediumTests.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MediumTests.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MediumTests.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MediumTests.java Sun Dec 23 20:54:12 2012
@@ -32,6 +32,7 @@ package org.apache.hadoop.hbase;
  *
  * @see SmallTests
  * @see LargeTests
+ * @see IntegrationTests
  */
 public interface MediumTests {
 }

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java Sun Dec 23 20:54:12 2012
@@ -28,6 +28,8 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.hbase.ipc.HRegionInterface;
+import org.apache.hadoop.hbase.ipc.HMasterInterface;
 import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.regionserver.HRegion;
@@ -35,6 +37,8 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
+import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
+import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
 import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.io.MapWritable;
 
@@ -44,9 +48,8 @@ import org.apache.hadoop.io.MapWritable;
  * if we are running on DistributedFilesystem, create a FileSystem instance
  * each and will close down their instance on the way out.
  */
-public class MiniHBaseCluster {
+public class MiniHBaseCluster extends HBaseCluster {
   static final Log LOG = LogFactory.getLog(MiniHBaseCluster.class.getName());
-  private Configuration conf;
   public LocalHBaseCluster hbaseCluster;
   private static int index;
 
@@ -69,11 +72,19 @@ public class MiniHBaseCluster {
    * @throws IOException
    */
   public MiniHBaseCluster(Configuration conf, int numMasters,
-      int numRegionServers)
-  throws IOException, InterruptedException {
-    this.conf = conf;
+                             int numRegionServers)
+      throws IOException, InterruptedException {
+    this(conf, numMasters, numRegionServers, null, null);
+  }
+
+  public MiniHBaseCluster(Configuration conf, int numMasters, int numRegionServers,
+         Class<? extends HMaster> masterClass,
+         Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass)
+      throws IOException, InterruptedException {
+    super(conf);
     conf.set(HConstants.MASTER_PORT, "0");
-    init(numMasters, numRegionServers);
+    init(numMasters, numRegionServers, masterClass, regionserverClass);
+    this.initialClusterStatus = getClusterStatus();
   }
 
   public Configuration getConfiguration() {
@@ -178,12 +189,21 @@ public class MiniHBaseCluster {
     }
   }
 
-  private void init(final int nMasterNodes, final int nRegionNodes)
+  private void init(final int nMasterNodes, final int nRegionNodes,
+          Class<? extends HMaster> masterClass,
+          Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass)
   throws IOException, InterruptedException {
     try {
+      if (masterClass == null){
+       masterClass =  HMaster.class;
+      }
+      if (regionserverClass == null){
+       regionserverClass = MiniHBaseCluster.MiniHBaseClusterRegionServer.class;
+      }
+
       // start up a LocalHBaseCluster
       hbaseCluster = new LocalHBaseCluster(conf, nMasterNodes, 0,
-        HMaster.class, MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
+         masterClass, regionserverClass);
 
       // manually add the regionservers as other users
       for (int i=0; i<nRegionNodes; i++) {
@@ -204,6 +224,54 @@ public class MiniHBaseCluster {
     }
   }
 
+  @Override
+  public void startRegionServer(String hostname) throws IOException {
+    this.startRegionServer();
+  }
+
+  @Override
+  public void killRegionServer(ServerName serverName) throws IOException {
+    HRegionServer server = getRegionServer(getRegionServerIndex(serverName));
+    if (server instanceof MiniHBaseClusterRegionServer) {
+      LOG.info("Killing " + server.toString());
+      ((MiniHBaseClusterRegionServer) server).kill();
+    } else {
+      abortRegionServer(getRegionServerIndex(serverName));
+    }
+  }
+
+  @Override
+  public void stopRegionServer(ServerName serverName) throws IOException {
+    stopRegionServer(getRegionServerIndex(serverName));
+  }
+
+  @Override
+  public void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException {
+    //ignore timeout for now
+    waitOnRegionServer(getRegionServerIndex(serverName));
+  }
+
+  @Override
+  public void startMaster(String hostname) throws IOException {
+    this.startMaster();
+  }
+
+  @Override
+  public void killMaster(ServerName serverName) throws IOException {
+    abortMaster(getMasterIndex(serverName));
+  }
+
+  @Override
+  public void stopMaster(ServerName serverName) throws IOException {
+    stopMaster(getMasterIndex(serverName));
+  }
+
+  @Override
+  public void waitForMasterToStop(ServerName serverName, long timeout) throws IOException {
+    //ignore timeout for now
+    waitOnMaster(getMasterIndex(serverName));
+  }
+
   /**
    * Starts a region server thread running
    *
@@ -299,6 +367,11 @@ public class MiniHBaseCluster {
     return t;
   }
 
+  @Override
+  public HMasterInterface getMasterAdmin() {
+    return this.hbaseCluster.getActiveMaster();
+  }
+
   /**
    * Returns the current active master, if available.
    * @return the active HMaster, null if none is active.
@@ -373,15 +446,18 @@ public class MiniHBaseCluster {
    *         masters left.
    * @throws InterruptedException
    */
-  public boolean waitForActiveAndReadyMaster() throws InterruptedException {
+  public boolean waitForActiveAndReadyMaster(long timeout) throws IOException {
     List<JVMClusterUtil.MasterThread> mts;
-    while (!(mts = getMasterThreads()).isEmpty()) {
+    long start = System.currentTimeMillis();
+    while (!(mts = getMasterThreads()).isEmpty()
+        && (System.currentTimeMillis() - start) < timeout) {
       for (JVMClusterUtil.MasterThread mt : mts) {
         if (mt.getMaster().isActiveMaster() && mt.getMaster().isInitialized()) {
           return true;
         }
       }
-      Thread.sleep(100);
+
+      Threads.sleep(100);
     }
     return false;
   }
@@ -418,6 +494,16 @@ public class MiniHBaseCluster {
     HConnectionManager.deleteAllConnections(false);
   }
 
+  @Override
+  public void close() throws IOException {
+  }
+
+  @Override
+  public ClusterStatus getClusterStatus() throws IOException {
+    HMaster master = getMaster();
+    return master == null ? null : master.getClusterStatus();
+  }
+
   /**
    * Call flushCache on all regions on all participating regionservers.
    * @throws IOException
@@ -540,6 +626,15 @@ public class MiniHBaseCluster {
     return index;
   }
 
+  @Override
+  public ServerName getServerHoldingRegion(byte[] regionName) throws IOException {
+    int index = getServerWith(regionName);
+    if (index < 0) {
+      return null;
+    }
+    return getRegionServer(index).getServerName();
+  }
+
   /**
    * Counts the total numbers of regions being served by the currently online
    * region servers by asking each how many regions they have.  Does not look
@@ -553,4 +648,30 @@ public class MiniHBaseCluster {
     }
     return count;
   }
+
+  @Override
+  public void waitUntilShutDown() {
+    this.hbaseCluster.join();
+  }
+
+  protected int getRegionServerIndex(ServerName serverName) {
+    //we have a small number of region servers, this should be fine for now.
+    List<RegionServerThread> servers = getRegionServerThreads();
+    for (int i=0; i < servers.size(); i++) {
+      if (servers.get(i).getRegionServer().getServerName().equals(serverName)) {
+        return i;
+      }
+    }
+    return -1;
+  }
+
+  protected int getMasterIndex(ServerName serverName) {
+    List<MasterThread> masters = getMasterThreads();
+    for (int i = 0; i < masters.size(); i++) {
+      if (masters.get(i).getMaster().getServerName().equals(serverName)) {
+        return i;
+      }
+    }
+    return -1;
+  }
 }

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/SmallTests.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/SmallTests.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/SmallTests.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/SmallTests.java Sun Dec 23 20:54:12 2012
@@ -29,6 +29,7 @@ package org.apache.hadoop.hbase;
  *
  * @see MediumTests
  * @see LargeTests
+ * @see IntegrationTests
  */
 public interface SmallTests {
 }

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestDrainingServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestDrainingServer.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestDrainingServer.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestDrainingServer.java Sun Dec 23 20:54:12 2012
@@ -54,13 +54,14 @@ public class TestDrainingServer {
   private static final byte [] TABLENAME = Bytes.toBytes("t");
   private static final byte [] FAMILY = Bytes.toBytes("f");
   private static final int COUNT_OF_REGIONS = HBaseTestingUtility.KEYS.length;
+  private static final int NB_SLAVES = 5;
 
   /**
    * Spin up a cluster with a bunch of regions on it.
    */
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
-    TEST_UTIL.startMiniCluster(5);
+    TEST_UTIL.startMiniCluster(NB_SLAVES);
     TEST_UTIL.getConfiguration().setBoolean("hbase.master.enabletable.roundrobin", true);
     ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL);
     HTableDescriptor htd = new HTableDescriptor(TABLENAME);
@@ -73,14 +74,25 @@ public class TestDrainingServer {
       createTableDescriptor(fs, FSUtils.getRootDir(TEST_UTIL.getConfiguration()), htd);
     // Assign out the regions we just created.
     HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+    MiniHBaseCluster cluster = TEST_UTIL.getMiniHBaseCluster();
     admin.disableTable(TABLENAME);
     admin.enableTable(TABLENAME);
-    ZKAssign.blockUntilNoRIT(zkw);
-    // Assert that every regionserver has some regions on it.
-    MiniHBaseCluster cluster = TEST_UTIL.getMiniHBaseCluster();
-    for (int i = 0; i < cluster.getRegionServerThreads().size(); i++) {
-      HRegionServer hrs = cluster.getRegionServer(i);
-      Assert.assertFalse(hrs.getOnlineRegions().isEmpty());
+    boolean ready = false;
+    while (!ready) {
+      ZKAssign.blockUntilNoRIT(zkw);
+      // Assert that every regionserver has some regions on it, else invoke the balancer.
+      ready = true;
+      for (int i = 0; i < NB_SLAVES; i++) {
+        HRegionServer hrs = cluster.getRegionServer(i);
+        if (hrs.getOnlineRegions().isEmpty()) {
+          ready = false;
+          break;
+        }
+      }
+      if (!ready) {
+        admin.balancer();
+        Thread.sleep(100);
+      }
     }
   }
 

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/TestRegionRebalancing.java Sun Dec 23 20:54:12 2012
@@ -218,9 +218,10 @@ public class TestRegionRebalancing {
    * Wait until all the regions are assigned.
    */
   private void waitForAllRegionsAssigned() throws IOException {
-    while (getRegionCount() < 22) {
+    int totalRegions = HBaseTestingUtility.KEYS.length+2;
+    while (getRegionCount() < totalRegions) {
     // while (!cluster.getMaster().allRegionsAssigned()) {
-      LOG.debug("Waiting for there to be 22 regions, but there are " + getRegionCount() + " right now.");
+      LOG.debug("Waiting for there to be "+ totalRegions +" regions, but there are " + getRegionCount() + " right now.");
       try {
         Thread.sleep(200);
       } catch (InterruptedException e) {}

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/backup/TestHFileArchiving.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/backup/TestHFileArchiving.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/backup/TestHFileArchiving.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/backup/TestHFileArchiving.java Sun Dec 23 20:54:12 2012
@@ -35,7 +35,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.PathFilter;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.LargeTests;
+import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
@@ -55,7 +55,7 @@ import org.junit.experimental.categories
  * Test that the {@link HFileArchiver} correctly removes all the parts of a region when cleaning up
  * a region
  */
-@Category(LargeTests.class)
+@Category(MediumTests.class)
 public class TestHFileArchiving {
 
   private static final String STRING_TABLE_NAME = "test_table";
@@ -230,18 +230,70 @@ public class TestHFileArchiving {
 
     // then get the current store files
     Path regionDir = region.getRegionDir();
-    List<String> storeFiles = getAllFileNames(fs, regionDir);
-    // remove all the non-storefile named files for the region
+    List<String> storeFiles = getRegionStoreFiles(fs, regionDir);
+
+    // then delete the table so the hfiles get archived
+    UTIL.deleteTable(TABLE_NAME);
+
+    // then get the files in the archive directory.
+    Path archiveDir = HFileArchiveUtil.getArchivePath(UTIL.getConfiguration());
+    List<String> archivedFiles = getAllFileNames(fs, archiveDir);
+    Collections.sort(storeFiles);
+    Collections.sort(archivedFiles);
+
+    LOG.debug("Store files:");
     for (int i = 0; i < storeFiles.size(); i++) {
-      String file = storeFiles.get(i);
-      if (file.contains(HRegion.REGIONINFO_FILE) || file.contains("hlog")) {
-        storeFiles.remove(i--);
-      }
+      LOG.debug(i + " - " + storeFiles.get(i));
     }
-    storeFiles.remove(HRegion.REGIONINFO_FILE);
+    LOG.debug("Archive files:");
+    for (int i = 0; i < archivedFiles.size(); i++) {
+      LOG.debug(i + " - " + archivedFiles.get(i));
+    }
+
+    assertTrue("Archived files are missing some of the store files!",
+      archivedFiles.containsAll(storeFiles));
+  }
+
+  /**
+   * Test that the store files are archived when a column family is removed.
+   * @throws Exception
+   */
+  @Test
+  public void testArchiveOnTableFamilyDelete() throws Exception {
+    List<HRegion> servingRegions = UTIL.getHBaseCluster().getRegions(TABLE_NAME);
+    // make sure we only have 1 region serving this table
+    assertEquals(1, servingRegions.size());
+    HRegion region = servingRegions.get(0);
+
+    // get the parent RS and monitor
+    HRegionServer hrs = UTIL.getRSForFirstRegionInTable(TABLE_NAME);
+    FileSystem fs = hrs.getFileSystem();
+
+    // put some data on the region
+    LOG.debug("-------Loading table");
+    UTIL.loadRegion(region, TEST_FAM);
+
+    // get the hfiles in the region
+    List<HRegion> regions = hrs.getOnlineRegions(TABLE_NAME);
+    assertEquals("More that 1 region for test table.", 1, regions.size());
+
+    region = regions.get(0);
+    // wait for all the compactions to complete
+    region.waitForFlushesAndCompactions();
+
+    // disable table to prevent new updates
+    UTIL.getHBaseAdmin().disableTable(TABLE_NAME);
+    LOG.debug("Disabled table");
+
+    // remove all the files from the archive to get a fair comparison
+    clearArchiveDirectory();
+
+    // then get the current store files
+    Path regionDir = region.getRegionDir();
+    List<String> storeFiles = getRegionStoreFiles(fs, regionDir);
 
     // then delete the table so the hfiles get archived
-    UTIL.deleteTable(TABLE_NAME);
+    UTIL.getHBaseAdmin().deleteColumn(TABLE_NAME, TEST_FAM);
 
     // then get the files in the archive directory.
     Path archiveDir = HFileArchiveUtil.getArchivePath(UTIL.getConfiguration());
@@ -290,4 +342,18 @@ public class TestHFileArchiving {
     }
     return fileNames;
   }
-}
\ No newline at end of file
+
+  private List<String> getRegionStoreFiles(final FileSystem fs, final Path regionDir) 
+      throws IOException {
+    List<String> storeFiles = getAllFileNames(fs, regionDir);
+    // remove all the non-storefile named files for the region
+    for (int i = 0; i < storeFiles.size(); i++) {
+      String file = storeFiles.get(i);
+      if (file.contains(HRegion.REGIONINFO_FILE) || file.contains("hlog")) {
+        storeFiles.remove(i--);
+      }
+    }
+    storeFiles.remove(HRegion.REGIONINFO_FILE);
+    return storeFiles;
+  }
+}

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java Sun Dec 23 20:54:12 2012
@@ -64,6 +64,7 @@ import org.apache.hadoop.hbase.HServerAd
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.LargeTests;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.client.metrics.ScanMetrics;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@@ -3889,6 +3890,24 @@ public class TestFromClientSide {
   }
 
   /**
+   * creates an HTable for tableName using an unmanaged HConnection.
+   *
+   * @param tableName - table to create
+   * @return the created HTable object
+   * @throws IOException
+   */
+  HTable createUnmangedHConnectionHTable(final byte [] tableName) throws IOException {
+    TEST_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
+    HConnection conn = HConnectionManager.createConnection(TEST_UTIL.getConfiguration());
+    ExecutorService pool = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
+      60, TimeUnit.SECONDS,
+      new SynchronousQueue<Runnable>(),
+      Threads.newDaemonThreadFactory("test-from-client-table"));
+    ((ThreadPoolExecutor)pool).allowCoreThreadTimeOut(true);
+    return new HTable(tableName, conn, pool);
+  }
+
+  /**
    * simple test that just executes parts of the client
    * API that accept a pre-created HConnction instance
    *
@@ -3897,18 +3916,41 @@ public class TestFromClientSide {
   @Test
   public void testUnmanagedHConnection() throws IOException {
     final byte[] tableName = Bytes.toBytes("testUnmanagedHConnection");
-    TEST_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
-    HConnection conn = HConnectionManager.createConnection(TEST_UTIL
-        .getConfiguration());
-    ExecutorService pool = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
-        60, TimeUnit.SECONDS,
-        new SynchronousQueue<Runnable>(),
-        Threads.newDaemonThreadFactory("test-from-client-table"));
-    ((ThreadPoolExecutor)pool).allowCoreThreadTimeOut(true);
-    HTable t = new HTable(tableName, conn, pool);
+    HTable t = createUnmangedHConnectionHTable(tableName);
+    HBaseAdmin ha = new HBaseAdmin(t.getConnection());
+    assertTrue(ha.tableExists(tableName));
+    assertTrue(t.get(new Get(ROW)).isEmpty());
+  }
+
+  /**
+   * test of that unmanaged HConnections are able to reconnect
+   * properly (see HBASE-5058)
+   *
+   * @throws Exception
+   */
+  @Test
+  public void testUnmanagedHConnectionReconnect() throws Exception {
+    final byte[] tableName = Bytes.toBytes("testUnmanagedHConnectionReconnect");
+    HTable t = createUnmangedHConnectionHTable(tableName);
+    HConnection conn = t.getConnection();
     HBaseAdmin ha = new HBaseAdmin(conn);
     assertTrue(ha.tableExists(tableName));
     assertTrue(t.get(new Get(ROW)).isEmpty());
+
+    // stop the master
+    MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
+    cluster.stopMaster(0, false);
+    cluster.waitOnMaster(0);
+
+    // start up a new master
+    cluster.startMaster();
+    assertTrue(cluster.waitForActiveAndReadyMaster());
+
+    // test that the same unmanaged connection works with a new
+    // HBaseAdmin and can connect to the new master;
+    HBaseAdmin newAdmin = new HBaseAdmin(conn);
+    assertTrue(newAdmin.tableExists(tableName));
+    assert(newAdmin.getClusterStatus().getServersSize() == SLAVES);
   }
 
   @Test

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java Sun Dec 23 20:54:12 2012
@@ -60,6 +60,7 @@ public class TestClassLoading {
   static final String cpName4 = "TestCP4";
   static final String cpName5 = "TestCP5";
   static final String cpName6 = "TestCP6";
+  static final String cpNameInvalid = "TestCPInvalid";
 
   private static Class<?> regionCoprocessor1 = ColumnAggregationEndpoint.class;
   private static Class<?> regionCoprocessor2 = GenericEndpoint.class;
@@ -68,14 +69,6 @@ public class TestClassLoading {
 
   private static final String[] regionServerSystemCoprocessors =
       new String[]{
-      regionCoprocessor1.getSimpleName(),
-      regionServerCoprocessor.getSimpleName()
-  };
-
-  private static final String[] regionServerSystemAndUserCoprocessors =
-      new String[] {
-      regionCoprocessor1.getSimpleName(),
-      regionCoprocessor2.getSimpleName(),
       regionServerCoprocessor.getSimpleName()
   };
 
@@ -207,16 +200,18 @@ public class TestClassLoading {
       new Path(fs.getUri().toString() + Path.SEPARATOR));
     String jarFileOnHDFS1 = fs.getUri().toString() + Path.SEPARATOR +
       jarFile1.getName();
+    Path pathOnHDFS1 = new Path(jarFileOnHDFS1);
     assertTrue("Copy jar file to HDFS failed.",
-      fs.exists(new Path(jarFileOnHDFS1)));
+      fs.exists(pathOnHDFS1));
     LOG.info("Copied jar file to HDFS: " + jarFileOnHDFS1);
 
     fs.copyFromLocalFile(new Path(jarFile2.getPath()),
         new Path(fs.getUri().toString() + Path.SEPARATOR));
     String jarFileOnHDFS2 = fs.getUri().toString() + Path.SEPARATOR +
       jarFile2.getName();
+    Path pathOnHDFS2 = new Path(jarFileOnHDFS2);
     assertTrue("Copy jar file to HDFS failed.",
-      fs.exists(new Path(jarFileOnHDFS2)));
+      fs.exists(pathOnHDFS2));
     LOG.info("Copied jar file to HDFS: " + jarFileOnHDFS2);
 
     // create a table that references the coprocessors
@@ -228,41 +223,78 @@ public class TestClassLoading {
       // with configuration values
     htd.setValue("COPROCESSOR$2", jarFileOnHDFS2.toString() + "|" + cpName2 +
       "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
+    // same jar but invalid class name (should fail to load this class)
+    htd.setValue("COPROCESSOR$3", jarFileOnHDFS2.toString() + "|" + cpNameInvalid +
+      "|" + Coprocessor.PRIORITY_USER);
     HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(tableName)) {
       admin.disableTable(tableName);
       admin.deleteTable(tableName);
     }
-    admin.createTable(htd);
+    CoprocessorHost.classLoadersCache.clear();
+    byte[] startKey = {10, 63};
+    byte[] endKey = {12, 43};
+    admin.createTable(htd, startKey, endKey, 4);
     waitForTable(htd.getName());
 
     // verify that the coprocessors were loaded
-    boolean found1 = false, found2 = false, found2_k1 = false,
-        found2_k2 = false, found2_k3 = false;
+    boolean foundTableRegion=false;
+    boolean found_invalid = true, found1 = true, found2 = true, found2_k1 = true,
+        found2_k2 = true, found2_k3 = true;
+    Map<HRegion, Set<ClassLoader>> regionsActiveClassLoaders =
+        new HashMap<HRegion, Set<ClassLoader>>();
     MiniHBaseCluster hbase = TEST_UTIL.getHBaseCluster();
     for (HRegion region:
         hbase.getRegionServer(0).getOnlineRegionsLocalContext()) {
       if (region.getRegionNameAsString().startsWith(tableName)) {
+        foundTableRegion = true;
         CoprocessorEnvironment env;
         env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName1);
-        if (env != null) {
-          found1 = true;
-        }
+        found1 = found1 && (env != null);
         env = region.getCoprocessorHost().findCoprocessorEnvironment(cpName2);
+        found2 = found2 && (env != null);
         if (env != null) {
-          found2 = true;
           Configuration conf = env.getConfiguration();
-          found2_k1 = conf.get("k1") != null;
-          found2_k2 = conf.get("k2") != null;
-          found2_k3 = conf.get("k3") != null;
+          found2_k1 = found2_k1 && (conf.get("k1") != null);
+          found2_k2 = found2_k2 && (conf.get("k2") != null);
+          found2_k3 = found2_k3 && (conf.get("k3") != null);
+        } else {
+          found2_k1 = found2_k2 = found2_k3 = false;
         }
+        env = region.getCoprocessorHost().findCoprocessorEnvironment(cpNameInvalid);
+        found_invalid = found_invalid && (env != null);
+
+        regionsActiveClassLoaders
+            .put(region, ((CoprocessorHost) region.getCoprocessorHost()).getExternalClassLoaders());
       }
     }
+
+    assertTrue("No region was found for table " + tableName, foundTableRegion);
     assertTrue("Class " + cpName1 + " was missing on a region", found1);
     assertTrue("Class " + cpName2 + " was missing on a region", found2);
+    //an invalid CP class name is defined for this table, validate that it is not loaded
+    assertFalse("Class " + cpNameInvalid + " was found on a region", found_invalid);
     assertTrue("Configuration key 'k1' was missing on a region", found2_k1);
     assertTrue("Configuration key 'k2' was missing on a region", found2_k2);
     assertTrue("Configuration key 'k3' was missing on a region", found2_k3);
+    // check if CP classloaders are cached
+    assertTrue(jarFileOnHDFS1 + " was not cached",
+      CoprocessorHost.classLoadersCache.containsKey(pathOnHDFS1));
+    assertTrue(jarFileOnHDFS2 + " was not cached",
+      CoprocessorHost.classLoadersCache.containsKey(pathOnHDFS2));
+    //two external jar used, should be one classloader per jar
+    assertEquals("The number of cached classloaders should be equal to the number" +
+      " of external jar files",
+      2, CoprocessorHost.classLoadersCache.size());
+    //check if region active classloaders are shared across all RS regions
+    Set<ClassLoader> externalClassLoaders = new HashSet<ClassLoader>(
+        CoprocessorHost.classLoadersCache.values());
+    for (Map.Entry<HRegion, Set<ClassLoader>> regionCP : regionsActiveClassLoaders.entrySet()) {
+      assertTrue("Some CP classloaders for region " + regionCP.getKey() + " are not cached."
+            + " ClassLoader Cache:" + externalClassLoaders
+            + " Region ClassLoaders:" + regionCP.getValue(),
+            externalClassLoaders.containsAll(regionCP.getValue()));
+    }
   }
 
   @Test
@@ -424,6 +456,8 @@ public class TestClassLoading {
     File outerJarFile = new File(TEST_UTIL.getDataTestDir().toString(), "outer.jar");
 
     byte buffer[] = new byte[BUFFER_SIZE];
+    // TODO: code here and elsewhere in this file is duplicated w/TestClassFinder.
+    //       Some refactoring may be in order...
     // Open archive file
     FileOutputStream stream = new FileOutputStream(outerJarFile);
     JarOutputStream out = new JarOutputStream(stream, new Manifest());
@@ -433,7 +467,7 @@ public class TestClassLoading {
       JarEntry jarAdd = new JarEntry("/lib/" + jarFile.getName());
       jarAdd.setTime(jarFile.lastModified());
       out.putNextEntry(jarAdd);
-  
+
       // Write file to archive
       FileInputStream in = new FileInputStream(jarFile);
       while (true) {
@@ -505,82 +539,12 @@ public class TestClassLoading {
 
   @Test
   public void testRegionServerCoprocessorsReported() throws Exception {
-    // HBASE 4070: Improve region server metrics to report loaded coprocessors
-    // to master: verify that each regionserver is reporting the correct set of
-    // loaded coprocessors.
-
-    // We rely on the fact that getCoprocessors() will return a sorted
-    // display of the coprocessors' names, so for example, regionCoprocessor1's
-    // name "ColumnAggregationEndpoint" will appear before regionCoprocessor2's
-    // name "GenericEndpoint" because "C" is before "G" lexicographically.
+    // This was a test for HBASE-4070.
+    // We are removing coprocessors from region load in HBASE-5258.
+    // Therefore, this test now only checks system coprocessors.
 
     HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
-
-    // disable all user tables, if any are loaded.
-    for (HTableDescriptor htd: admin.listTables()) {
-      if (!htd.isMetaTable()) {
-        String tableName = htd.getNameAsString();
-        if (admin.isTableEnabled(tableName)) {
-          try {
-            admin.disableTable(htd.getNameAsString());
-          } catch (TableNotEnabledException e) {
-            // ignoring this exception for now : not sure why it's happening.
-          }
-        }
-      }
-    }
-
-    // should only be system coprocessors loaded at this point.
     assertAllRegionServers(regionServerSystemCoprocessors,null);
-
-    // The next two tests enable and disable user tables to see if coprocessor
-    // load reporting changes as coprocessors are loaded and unloaded.
-    //
-
-    // Create a table.
-    // should cause regionCoprocessor2 to be loaded, since we've specified it
-    // for loading on any user table with USER_REGION_COPROCESSOR_CONF_KEY
-    // in setUpBeforeClass().
-    String userTable1 = "userTable1";
-    HTableDescriptor userTD1 = new HTableDescriptor(userTable1);
-    admin.createTable(userTD1);
-    waitForTable(userTD1.getName());
-
-    // table should be enabled now.
-    assertTrue(admin.isTableEnabled(userTable1));
-    assertAllRegionServers(regionServerSystemAndUserCoprocessors, userTable1);
-
-    // unload and make sure we're back to only system coprocessors again.
-    admin.disableTable(userTable1);
-    assertAllRegionServers(regionServerSystemCoprocessors,null);
-
-    // create another table, with its own specified coprocessor.
-    String userTable2 = "userTable2";
-    HTableDescriptor htd2 = new HTableDescriptor(userTable2);
-
-    String userTableCP = "userTableCP";
-    File jarFile1 = buildCoprocessorJar(userTableCP);
-    htd2.addFamily(new HColumnDescriptor("myfamily"));
-    htd2.setValue("COPROCESSOR$1", jarFile1.toString() + "|" + userTableCP +
-      "|" + Coprocessor.PRIORITY_USER);
-    admin.createTable(htd2);
-    waitForTable(htd2.getName());
-    // table should be enabled now.
-    assertTrue(admin.isTableEnabled(userTable2));
-
-    ArrayList<String> existingCPsPlusNew =
-        new ArrayList<String>(Arrays.asList(regionServerSystemAndUserCoprocessors));
-    existingCPsPlusNew.add(userTableCP);
-    String[] existingCPsPlusNewArray = new String[existingCPsPlusNew.size()];
-    assertAllRegionServers(existingCPsPlusNew.toArray(existingCPsPlusNewArray),
-        userTable2);
-
-    admin.disableTable(userTable2);
-    assertTrue(admin.isTableDisabled(userTable2));
-
-    // we should be back to only system coprocessors again.
-    assertAllRegionServers(regionServerSystemCoprocessors, null);
-
   }
 
   /**
@@ -627,7 +591,7 @@ public class TestClassLoading {
       }
       boolean any_failed = false;
       for(Map.Entry<ServerName,HServerLoad> server: servers.entrySet()) {
-        actualCoprocessors = server.getValue().getCoprocessors();
+        actualCoprocessors = server.getValue().getRsCoprocessors();
         if (!Arrays.equals(actualCoprocessors, expectedCoprocessors)) {
           LOG.debug("failed comparison: actual: " +
               Arrays.toString(actualCoprocessors) +

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorInterface.java Sun Dec 23 20:54:12 2012
@@ -85,6 +85,18 @@ public class TestCoprocessorInterface ex
     }
 
     @Override
+    public boolean nextRaw(List<KeyValue> result, int limit, String metric) 
+        throws IOException {
+      return delegate.nextRaw(result, limit, metric);
+    }
+
+    @Override
+    public boolean nextRaw(List<KeyValue> result, String metric) 
+        throws IOException {
+      return delegate.nextRaw(result, metric);
+    }
+
+    @Override
     public void close() throws IOException {
       delegate.close();
     }
@@ -104,6 +116,10 @@ public class TestCoprocessorInterface ex
       return false;
     }
 
+    @Override
+    public long getMvccReadPoint() {
+      return delegate.getMvccReadPoint();
+    }
   }
 
   public static class CoprocessorImpl extends BaseRegionObserver {

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java Sun Dec 23 20:54:12 2012
@@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.master.HM
 import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Threads;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -541,7 +542,7 @@ public class TestMasterObserver {
 
     // modify table
     htd.setMaxFileSize(512 * 1024 * 1024);
-    admin.modifyTable(TEST_TABLE, htd);
+    modifyTableSync(admin, TEST_TABLE, htd);
     // preModifyTable can't bypass default action.
     assertTrue("Test table should have been modified",
       cp.wasModifyTableCalled());
@@ -584,7 +585,7 @@ public class TestMasterObserver {
 
     // modify table
     htd.setMaxFileSize(512 * 1024 * 1024);
-    admin.modifyTable(TEST_TABLE, htd);
+    modifyTableSync(admin, TEST_TABLE, htd);
     assertTrue("Test table should have been modified",
         cp.wasModifyTableCalled());
 
@@ -629,6 +630,19 @@ public class TestMasterObserver {
         cp.wasDeleteTableCalled());
   }
 
+  private void modifyTableSync(HBaseAdmin admin, byte[] tableName, HTableDescriptor htd)
+      throws IOException {
+    admin.modifyTable(tableName, htd);
+    //wait until modify table finishes
+    for (int t = 0; t < 100; t++) { //10 sec timeout
+      HTableDescriptor td = admin.getTableDescriptor(htd.getName());
+      if (td.equals(htd)) {
+        break;
+      }
+      Threads.sleep(100);
+    }
+  }
+
   @Test
   public void testRegionTransitionOperations() throws Exception {
     MiniHBaseCluster cluster = UTIL.getHBaseCluster();

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java Sun Dec 23 20:54:12 2012
@@ -55,7 +55,6 @@ import org.apache.hadoop.hbase.util.Byte
 import org.apache.hadoop.hbase.util.ChecksumType;
 import org.apache.hadoop.hbase.util.ClassSize;
 import org.apache.hadoop.io.WritableUtils;
-import org.apache.hadoop.io.compress.CompressionOutputStream;
 import org.apache.hadoop.io.compress.Compressor;
 
 import static org.apache.hadoop.hbase.io.hfile.Compression.Algorithm.*;
@@ -719,7 +718,8 @@ public class TestHFileBlock {
       }
       BlockType bt = BlockType.values()[blockTypeOrdinal];
       DataOutputStream dos = hbw.startWriting(bt);
-      for (int j = 0; j < rand.nextInt(500); ++j) {
+      int size = rand.nextInt(500);
+      for (int j = 0; j < size; ++j) {
         // This might compress well.
         dos.writeShort(i + 1);
         dos.writeInt(j + 1);

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/ipc/TestPBOnWritableRpc.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/ipc/TestPBOnWritableRpc.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/ipc/TestPBOnWritableRpc.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/ipc/TestPBOnWritableRpc.java Sun Dec 23 20:54:12 2012
@@ -25,14 +25,17 @@ import java.io.IOException;
 import java.net.InetSocketAddress;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import com.google.protobuf.DescriptorProtos;
 import com.google.protobuf.DescriptorProtos.EnumDescriptorProto;
 
 /** Unit tests to test PB-based types on WritableRpcEngine. */
+@Category(MediumTests.class)
 public class TestPBOnWritableRpc {
 
   private static Configuration conf = new Configuration();

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java Sun Dec 23 20:54:12 2012
@@ -36,9 +36,9 @@ import org.apache.hadoop.hbase.HConstant
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HServerLoad;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.Server;
 import org.apache.hadoop.hbase.ServerName;
-import org.apache.hadoop.hbase.SmallTests;
 import org.apache.hadoop.hbase.ZooKeeperConnectionException;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.client.Get;
@@ -61,12 +61,12 @@ import org.apache.hadoop.hbase.util.Thre
 import org.apache.hadoop.hbase.util.Writables;
 import org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper;
 import org.apache.hadoop.hbase.zookeeper.ZKAssign;
+import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState;
 import org.apache.hadoop.hbase.zookeeper.ZKUtil;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
-import org.apache.hadoop.hbase.zookeeper.ZKTable.TableState;
 import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.KeeperException.NodeExistsException;
+import org.apache.zookeeper.Watcher;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -74,6 +74,7 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.mockito.Mockito;
+import org.mockito.internal.util.reflection.Whitebox;
 
 import com.google.protobuf.ServiceException;
 
@@ -81,7 +82,7 @@ import com.google.protobuf.ServiceExcept
 /**
  * Test {@link AssignmentManager}
  */
-@Category(SmallTests.class)
+@Category(MediumTests.class)
 public class TestAssignmentManager {
   private static final HBaseTestingUtility HTU = new HBaseTestingUtility();
   private static final ServerName SERVERNAME_A =
@@ -91,6 +92,10 @@ public class TestAssignmentManager {
   private static final HRegionInfo REGIONINFO =
     new HRegionInfo(Bytes.toBytes("t"),
       HConstants.EMPTY_START_ROW, HConstants.EMPTY_START_ROW);
+  private static final HRegionInfo REGIONINFO_2 = new HRegionInfo(Bytes.toBytes("t"),
+      Bytes.toBytes("a"),Bytes.toBytes( "b"));
+  private static int assignmentCount;
+  private static boolean enabling = false;  
 
   // Mocked objects or; get redone for each test.
   private Server server;
@@ -157,7 +162,7 @@ public class TestAssignmentManager {
 
   /**
    * Test a balance going on at same time as a master failover
-   * 
+   *
    * @throws IOException
    * @throws KeeperException
    * @throws InterruptedException
@@ -179,10 +184,8 @@ public class TestAssignmentManager {
       int versionid =
         ZKAssign.transitionNodeClosed(this.watcher, REGIONINFO, SERVERNAME_A, -1);
       assertNotSame(versionid, -1);
-      while (!ZKAssign.verifyRegionState(this.watcher, REGIONINFO,
-          EventType.M_ZK_REGION_OFFLINE)) {
-        Threads.sleep(1);
-      }
+      Mocking.waitForRegionPendingOpenInRIT(am, REGIONINFO.getEncodedName());
+
       // Get current versionid else will fail on transition from OFFLINE to
       // OPENING below
       versionid = ZKAssign.getVersion(this.watcher, REGIONINFO);
@@ -223,10 +226,8 @@ public class TestAssignmentManager {
         ZKAssign.transitionNodeClosed(this.watcher, REGIONINFO, SERVERNAME_A, -1);
       assertNotSame(versionid, -1);
       am.gate.set(false);
-      while (!ZKAssign.verifyRegionState(this.watcher, REGIONINFO,
-          EventType.M_ZK_REGION_OFFLINE)) {
-        Threads.sleep(1);
-      }
+      Mocking.waitForRegionPendingOpenInRIT(am, REGIONINFO.getEncodedName());
+
       // Get current versionid else will fail on transition from OFFLINE to
       // OPENING below
       versionid = ZKAssign.getVersion(this.watcher, REGIONINFO);
@@ -266,10 +267,8 @@ public class TestAssignmentManager {
       int versionid =
         ZKAssign.transitionNodeClosed(this.watcher, REGIONINFO, SERVERNAME_A, -1);
       assertNotSame(versionid, -1);
-      while (!ZKAssign.verifyRegionState(this.watcher, REGIONINFO,
-          EventType.M_ZK_REGION_OFFLINE)) {
-        Threads.sleep(1);
-      }
+      Mocking.waitForRegionPendingOpenInRIT(am, REGIONINFO.getEncodedName());
+
       am.gate.set(false);
       // Get current versionid else will fail on transition from OFFLINE to
       // OPENING below
@@ -308,10 +307,11 @@ public class TestAssignmentManager {
    * from one server to another mocking regionserver responding over zk.
    * @throws IOException
    * @throws KeeperException
+   * @throws InterruptedException
    */
-  @Test
+  @Test(timeout = 10000)
   public void testBalance()
-  throws IOException, KeeperException {
+  throws IOException, KeeperException, InterruptedException {
     // Create and startup an executor.  This is used by AssignmentManager
     // handling zk callbacks.
     ExecutorService executor = startupMasterExecutor("testBalanceExecutor");
@@ -345,11 +345,9 @@ public class TestAssignmentManager {
       // AM is going to notice above CLOSED and queue up a new assign.  The
       // assign will go to open the region in the new location set by the
       // balancer.  The zk node will be OFFLINE waiting for regionserver to
-      // transition it through OPENING, OPENED.  Wait till we see the OFFLINE
-      // zk node before we proceed.
-      while (!ZKAssign.verifyRegionState(this.watcher, REGIONINFO, EventType.M_ZK_REGION_OFFLINE)) {
-        Threads.sleep(1);
-      }
+      // transition it through OPENING, OPENED.  Wait till we see the RIT
+      // before we proceed.
+      Mocking.waitForRegionPendingOpenInRIT(am, REGIONINFO.getEncodedName());
       // Get current versionid else will fail on transition from OFFLINE to OPENING below
       versionid = ZKAssign.getVersion(this.watcher, REGIONINFO);
       assertNotSame(-1, versionid);
@@ -402,7 +400,7 @@ public class TestAssignmentManager {
 
   /**
    * To test closed region handler to remove rit and delete corresponding znode if region in pending
-   * close or closing while processing shutdown of a region server.(HBASE-5927). 
+   * close or closing while processing shutdown of a region server.(HBASE-5927).
    * @throws KeeperException
    * @throws IOException
    */
@@ -412,7 +410,7 @@ public class TestAssignmentManager {
     testCaseWithPartiallyDisabledState(TableState.DISABLING);
     testCaseWithPartiallyDisabledState(TableState.DISABLED);
   }
-  
+
   /**
    * To test if the split region is removed from RIT if the region was in SPLITTING state
    * but the RS has actually completed the splitting in META but went down. See HBASE-6070
@@ -446,7 +444,7 @@ public class TestAssignmentManager {
     am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
         State.SPLITTING, System.currentTimeMillis(), SERVERNAME_A));
     am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString());
-    
+
     RegionTransitionData data = new RegionTransitionData(EventType.RS_ZK_REGION_SPLITTING,
         REGIONINFO.getRegionName(), SERVERNAME_A);
     String node = ZKAssign.getNodeName(this.watcher, REGIONINFO.getEncodedName());
@@ -454,11 +452,11 @@ public class TestAssignmentManager {
     ZKUtil.createAndWatch(this.watcher, node, data.getBytes());
 
     try {
-      
+
       processServerShutdownHandler(ct, am, regionSplitDone);
       // check znode deleted or not.
       // In both cases the znode should be deleted.
-      
+
       if(regionSplitDone){
         assertTrue("Region state of region in SPLITTING should be removed from rit.",
             am.regionsInTransition.isEmpty());
@@ -501,7 +499,7 @@ public class TestAssignmentManager {
     } else {
       am.getZKTable().setDisabledTable(REGIONINFO.getTableNameAsString());
     }
-    
+
     RegionTransitionData data = new RegionTransitionData(EventType.M_ZK_REGION_CLOSING,
         REGIONINFO.getRegionName(), SERVERNAME_A);
     String node = ZKAssign.getNodeName(this.watcher, REGIONINFO.getEncodedName());
@@ -576,7 +574,7 @@ public class TestAssignmentManager {
    * @param hri Region to serialize into HRegionInfo
    * @return A mocked up Result that fakes a Get on a row in the
    * <code>.META.</code> table.
-   * @throws IOException 
+   * @throws IOException
    */
   private Result getMetaTableRowResult(final HRegionInfo hri,
       final ServerName sn)
@@ -595,13 +593,13 @@ public class TestAssignmentManager {
       Bytes.toBytes(sn.getStartcode())));
     return new Result(kvs);
   }
-  
+
   /**
    * @param sn ServerName to use making startcode and server in meta
    * @param hri Region to serialize into HRegionInfo
    * @return A mocked up Result that fakes a Get on a row in the
    * <code>.META.</code> table.
-   * @throws IOException 
+   * @throws IOException
    */
   private Result getMetaTableRowResultAsSplitRegion(final HRegionInfo hri, final ServerName sn)
       throws IOException {
@@ -663,12 +661,12 @@ public class TestAssignmentManager {
       am.shutdown();
     }
   }
-  
+
   /**
    * Tests the processDeadServersAndRegionsInTransition should not fail with NPE
    * when it failed to get the children. Let's abort the system in this
    * situation
-   * @throws ServiceException 
+   * @throws ServiceException
    */
   @Test(timeout = 5000)
   public void testProcessDeadServersAndRegionsInTransitionShouldNotFailWithNPE()
@@ -708,8 +706,8 @@ public class TestAssignmentManager {
    * @param region region to be created as offline
    * @param serverName server event originates from
    * @return Version of znode created.
-   * @throws KeeperException 
-   * @throws IOException 
+   * @throws KeeperException
+   * @throws IOException
    */
   // Copied from SplitTransaction rather than open the method over there in
   // the regionserver package.
@@ -768,14 +766,27 @@ public class TestAssignmentManager {
     // with an encoded name by doing a Get on .META.
     HRegionInterface ri = Mockito.mock(HRegionInterface.class);
     // Get a meta row result that has region up on SERVERNAME_A for REGIONINFO
+    Result[] result = null;
+    if (enabling) {
+      result = new Result[2];
+      result[0] = getMetaTableRowResult(REGIONINFO, SERVERNAME_A);
+      result[1] = getMetaTableRowResult(REGIONINFO_2, SERVERNAME_A);
+    }
     Result r = getMetaTableRowResult(REGIONINFO, SERVERNAME_A);
     Mockito.when(ri .openScanner((byte[]) Mockito.any(), (Scan) Mockito.any())).
       thenReturn(System.currentTimeMillis());
-    // Return good result 'r' first and then return null to indicate end of scan
-    Mockito.when(ri.next(Mockito.anyLong(), Mockito.anyInt())).thenReturn(new Result[] { r });
-    // If a get, return the above result too for REGIONINFO
-    Mockito.when(ri.get((byte[]) Mockito.any(), (Get) Mockito.any())).
-      thenReturn(r);
+   if (enabling) {
+      Mockito.when(ri.next(Mockito.anyLong(), Mockito.anyInt())).thenReturn(result, result, result,
+          (Result[]) null);
+      // If a get, return the above result too for REGIONINFO_2
+      Mockito.when(ri.get((byte[]) Mockito.any(), (Get) Mockito.any())).thenReturn(
+          getMetaTableRowResult(REGIONINFO_2, SERVERNAME_A));
+    } else {
+      // Return good result 'r' first and then return null to indicate end of scan
+      Mockito.when(ri.next(Mockito.anyLong(), Mockito.anyInt())).thenReturn(new Result[] { r });
+      // If a get, return the above result too for REGIONINFO
+      Mockito.when(ri.get((byte[]) Mockito.any(), (Get) Mockito.any())).thenReturn(r);
+    }
     // Get a connection w/ mocked up common methods.
     HConnection connection = HConnectionTestingUtility.
       getMockedConnectionAndDecorate(HTU.getConfiguration(), ri, SERVERNAME_B,
@@ -789,9 +800,9 @@ public class TestAssignmentManager {
         server, manager, ct, balancer, executor);
     return am;
   }
-  
+
   /**
-   * TestCase verifies that the regionPlan is updated whenever a region fails to open 
+   * TestCase verifies that the regionPlan is updated whenever a region fails to open
    * and the master tries to process RS_ZK_FAILED_OPEN state.(HBASE-5546).
    */
   @Test
@@ -839,17 +850,18 @@ public class TestAssignmentManager {
       assertNotSame("Same region plan should not come", regionPlan, newRegionPlan);
       assertTrue("Destnation servers should be different.", !(regionPlan.getDestination().equals(
         newRegionPlan.getDestination())));
+      Mocking.waitForRegionPendingOpenInRIT(am, REGIONINFO.getEncodedName());
     } finally {
       this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
         DefaultLoadBalancer.class, LoadBalancer.class);
       am.shutdown();
     }
   }
-  
+
   /**
    * Test verifies whether assignment is skipped for regions of tables in DISABLING state during
    * clean cluster startup. See HBASE-6281.
-   * 
+   *
    * @throws KeeperException
    * @throws IOException
    * @throws Exception
@@ -892,6 +904,53 @@ public class TestAssignmentManager {
   }
 
   /**
+   * Test verifies whether all the enabling table regions assigned only once during master startup.
+   * 
+   * @throws KeeperException
+   * @throws IOException
+   * @throws Exception
+   */
+  @Test
+  public void testMasterRestartWhenTableInEnabling() throws KeeperException, IOException, Exception {
+    enabling = true;
+    this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,
+        DefaultLoadBalancer.class, LoadBalancer.class);
+    Map<ServerName, HServerLoad> serverAndLoad = new HashMap<ServerName, HServerLoad>();
+    serverAndLoad.put(SERVERNAME_A, null);
+    Mockito.when(this.serverManager.getOnlineServers()).thenReturn(serverAndLoad);
+    Mockito.when(this.serverManager.isServerOnline(SERVERNAME_B)).thenReturn(false);
+    Mockito.when(this.serverManager.isServerOnline(SERVERNAME_A)).thenReturn(true);
+    HTU.getConfiguration().setInt(HConstants.MASTER_PORT, 0);
+    Server server = new HMaster(HTU.getConfiguration());
+    Whitebox.setInternalState(server, "serverManager", this.serverManager);
+    assignmentCount = 0;
+    AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(server,
+        this.serverManager);
+    am.regionOnline(new HRegionInfo("t1".getBytes(), HConstants.EMPTY_START_ROW,
+        HConstants.EMPTY_END_ROW), SERVERNAME_A);
+    am.gate.set(false);
+    try {
+      // set table in enabling state.
+      am.getZKTable().setEnablingTable(REGIONINFO.getTableNameAsString());
+      ZKAssign.createNodeOffline(this.watcher, REGIONINFO_2, SERVERNAME_B);
+
+      am.joinCluster();
+      while (!am.getZKTable().isEnabledTable(REGIONINFO.getTableNameAsString())) {
+        Thread.sleep(10);
+      }
+      assertEquals("Number of assignments should be equal.", 2, assignmentCount);
+      assertTrue("Table should be enabled.",
+          am.getZKTable().isEnabledTable(REGIONINFO.getTableNameAsString()));
+    } finally {
+      enabling = false;
+      am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString());
+      am.shutdown();
+      ZKAssign.deleteAllNodes(this.watcher);
+      assignmentCount = 0;
+    }
+  }
+
+  /**
    * Mocked load balancer class used in the testcase to make sure that the testcase waits until
    * random assignment is called and the gate variable is set to true.
    */
@@ -908,7 +967,7 @@ public class TestAssignmentManager {
       this.gate.set(true);
       return randomServerName;
     }
-    
+
     @Override
     public Map<ServerName, List<HRegionInfo>> retainAssignment(
         Map<HRegionInfo, ServerName> regions, List<ServerName> servers) {
@@ -960,8 +1019,13 @@ public class TestAssignmentManager {
     @Override
     public void assign(HRegionInfo region, boolean setOfflineInZK, boolean forceNewPlan,
         boolean hijack) {
-      assignInvoked = true;
-      super.assign(region, setOfflineInZK, forceNewPlan, hijack);
+      if (enabling) {
+        assignmentCount++;
+        this.regionOnline(region, SERVERNAME_A);
+      } else {
+        assignInvoked = true;
+        super.assign(region, setOfflineInZK, forceNewPlan, hijack);
+      }
     }
     
     @Override

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java Sun Dec 23 20:54:12 2012
@@ -241,13 +241,11 @@ public class TestCatalogJanitor {
       return new TableDescriptors() {
         @Override
         public HTableDescriptor remove(String tablename) throws IOException {
-          // TODO Auto-generated method stub
           return null;
         }
         
         @Override
         public Map<String, HTableDescriptor> getAll() throws IOException {
-          // TODO Auto-generated method stub
           return null;
         }
         
@@ -265,8 +263,6 @@ public class TestCatalogJanitor {
         
         @Override
         public void add(HTableDescriptor htd) throws IOException {
-          // TODO Auto-generated method stub
-          
         }
       };
     }
@@ -285,6 +281,34 @@ public class TestCatalogJanitor {
     public <T extends CoprocessorProtocol> boolean registerProtocol(Class<T> protocol, T handler) {
       return false;
     }
+
+    @Override
+    public void deleteTable(byte[] tableName) throws IOException {
+    }
+
+    @Override
+    public void modifyTable(byte[] tableName, HTableDescriptor descriptor) throws IOException {
+    }
+
+    @Override
+    public void enableTable(byte[] tableName) throws IOException {
+    }
+
+    @Override
+    public void disableTable(byte[] tableName) throws IOException {
+    }
+
+    @Override
+    public void addColumn(byte[] tableName, HColumnDescriptor column) throws IOException {
+    }
+
+    @Override
+    public void modifyColumn(byte[] tableName, HColumnDescriptor descriptor) throws IOException {
+    }
+
+    @Override
+    public void deleteColumn(byte[] tableName, byte[] columnName) throws IOException {
+    }
   }
 
   @Test

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMXBean.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMXBean.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMXBean.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMXBean.java Sun Dec 23 20:54:12 2012
@@ -25,11 +25,14 @@ import junit.framework.Assert;
 
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HServerLoad;
+import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
+@Category(MediumTests.class)
 public class TestMXBean {
 
   private static final HBaseTestingUtility TEST_UTIL =

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java Sun Dec 23 20:54:12 2012
@@ -35,7 +35,18 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.Abortable;
+import org.apache.hadoop.hbase.ClusterStatus;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.LargeTests;
+import org.apache.hadoop.hbase.MasterNotRunningException;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.executor.EventHandler.EventType;
 import org.apache.hadoop.hbase.executor.RegionTransitionData;
 import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
@@ -44,9 +55,9 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSTableDescriptors;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
-import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
 import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
+import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.hbase.zookeeper.ZKAssign;
 import org.apache.hadoop.hbase.zookeeper.ZKTable;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
@@ -382,7 +393,7 @@ public class TestMasterFailover {
     enabledAndAssignedRegions.add(enabledRegions.remove(0));
     enabledAndAssignedRegions.add(enabledRegions.remove(0));
     enabledAndAssignedRegions.add(closingRegion);
-    
+
     List<HRegionInfo> disabledAndAssignedRegions = new ArrayList<HRegionInfo>();
     disabledAndAssignedRegions.add(disabledRegions.remove(0));
     disabledAndAssignedRegions.add(disabledRegions.remove(0));
@@ -620,18 +631,18 @@ public class TestMasterFailover {
     // Create a ZKW to use in the test
     ZooKeeperWatcher zkw = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
         "unittest", new Abortable() {
-          
+
           @Override
           public void abort(String why, Throwable e) {
             LOG.error("Fatal ZK Error: " + why, e);
             org.junit.Assert.assertFalse("Fatal ZK error", true);
           }
-          
+
           @Override
           public boolean isAborted() {
             return false;
           }
-          
+
     });
 
     // get all the master threads

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java Sun Dec 23 20:54:12 2012
@@ -65,6 +65,7 @@ public class TestSplitLogManager {
   private static boolean stopped = false;
   private SplitLogManager slm;
   private Configuration conf;
+  private int to;
 
   private final static HBaseTestingUtility TEST_UTIL =
     new HBaseTestingUtility();
@@ -105,6 +106,11 @@ public class TestSplitLogManager {
 
     stopped = false;
     resetCounters();
+    to = 4000;
+    conf.setInt("hbase.splitlog.manager.timeout", to);
+    conf.setInt("hbase.splitlog.manager.unassigned.timeout", 2 * to);
+    conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
+    to = to + 4 * 100;
   }
 
   @After
@@ -194,26 +200,20 @@ public class TestSplitLogManager {
         TaskState.TASK_OWNED.get("dummy-worker"), Ids.OPEN_ACL_UNSAFE,
         CreateMode.PERSISTENT);
 
-    int to = 1000;
-    conf.setInt("hbase.splitlog.manager.timeout", to);
-    conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
-    to = to + 2 * 100;
-
-
     slm = new SplitLogManager(zkw, conf, stopper, "dummy-master", null);
     slm.finishInitialization();
     waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, 100);
     Task task = slm.findOrCreateOrphanTask(tasknode);
     assertTrue(task.isOrphan());
-    waitForCounter(tot_mgr_heartbeat, 0, 1, 100);
+    waitForCounter(tot_mgr_heartbeat, 0, 1, to/2);
     assertFalse(task.isUnassigned());
     long curt = System.currentTimeMillis();
     assertTrue((task.last_update <= curt) &&
         (task.last_update > (curt - 1000)));
     LOG.info("waiting for manager to resubmit the orphan task");
-    waitForCounter(tot_mgr_resubmit, 0, 1, to + 100);
+    waitForCounter(tot_mgr_resubmit, 0, 1, to + to/2);
     assertTrue(task.isUnassigned());
-    waitForCounter(tot_mgr_rescan, 0, 1, to + 100);
+    waitForCounter(tot_mgr_rescan, 0, 1, to + to/2);
   }
 
   @Test
@@ -229,12 +229,12 @@ public class TestSplitLogManager {
 
     slm = new SplitLogManager(zkw, conf, stopper, "dummy-master", null);
     slm.finishInitialization();
-    waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, 100);
+    waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, to/2);
     Task task = slm.findOrCreateOrphanTask(tasknode);
     assertTrue(task.isOrphan());
     assertTrue(task.isUnassigned());
     // wait for RESCAN node to be created
-    waitForCounter(tot_mgr_rescan, 0, 1, 500);
+    waitForCounter(tot_mgr_rescan, 0, 1, to/2);
     Task task2 = slm.findOrCreateOrphanTask(tasknode);
     assertTrue(task == task2);
     LOG.debug("task = " + task);
@@ -250,11 +250,6 @@ public class TestSplitLogManager {
   public void testMultipleResubmits() throws Exception {
     LOG.info("TestMultipleResbmits - no indefinite resubmissions");
 
-    int to = 1000;
-    conf.setInt("hbase.splitlog.manager.timeout", to);
-    conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
-    to = to + 2 * 100;
-
     conf.setInt("hbase.splitlog.max.resubmit", 2);
     slm = new SplitLogManager(zkw, conf, stopper, "dummy-master", null);
     slm.finishInitialization();
@@ -264,19 +259,19 @@ public class TestSplitLogManager {
     int version = ZKUtil.checkExists(zkw, tasknode);
 
     ZKUtil.setData(zkw, tasknode, TaskState.TASK_OWNED.get("worker1"));
-    waitForCounter(tot_mgr_heartbeat, 0, 1, 1000);
-    waitForCounter(tot_mgr_resubmit, 0, 1, to + 100);
+    waitForCounter(tot_mgr_heartbeat, 0, 1, to/2);
+    waitForCounter(tot_mgr_resubmit, 0, 1, to + to/2);
     int version1 = ZKUtil.checkExists(zkw, tasknode);
     assertTrue(version1 > version);
     ZKUtil.setData(zkw, tasknode, TaskState.TASK_OWNED.get("worker2"));
-    waitForCounter(tot_mgr_heartbeat, 1, 2, 1000);
-    waitForCounter(tot_mgr_resubmit, 1, 2, to + 100);
+    waitForCounter(tot_mgr_heartbeat, 1, 2, to/2);
+    waitForCounter(tot_mgr_resubmit, 1, 2, to + to/2);
     int version2 = ZKUtil.checkExists(zkw, tasknode);
     assertTrue(version2 > version1);
     ZKUtil.setData(zkw, tasknode, TaskState.TASK_OWNED.get("worker3"));
-    waitForCounter(tot_mgr_heartbeat, 1, 2, 1000);
-    waitForCounter(tot_mgr_resubmit_threshold_reached, 0, 1, to + 100);
-    Thread.sleep(to + 100);
+    waitForCounter(tot_mgr_heartbeat, 1, 2, to/2);
+    waitForCounter(tot_mgr_resubmit_threshold_reached, 0, 1, to + to/2);
+    Thread.sleep(to + to/2);
     assertEquals(2L, tot_mgr_resubmit.get());
   }
 
@@ -284,8 +279,6 @@ public class TestSplitLogManager {
   public void testRescanCleanup() throws Exception {
     LOG.info("TestRescanCleanup - ensure RESCAN nodes are cleaned up");
 
-    conf.setInt("hbase.splitlog.manager.timeout", 1000);
-    conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
     slm = new SplitLogManager(zkw, conf, stopper, "dummy-master", null);
     slm.finishInitialization();
     TaskBatch batch = new TaskBatch();
@@ -294,7 +287,7 @@ public class TestSplitLogManager {
     int version = ZKUtil.checkExists(zkw, tasknode);
 
     ZKUtil.setData(zkw, tasknode, TaskState.TASK_OWNED.get("worker1"));
-    waitForCounter(tot_mgr_heartbeat, 0, 1, 1000);
+    waitForCounter(tot_mgr_heartbeat, 0, 1, to/2);
     waitForCounter(new Expr() {
       @Override
       public long eval() {
@@ -308,7 +301,7 @@ public class TestSplitLogManager {
       assertTrue(Arrays.equals(TaskState.TASK_UNASSIGNED.get("dummy-master"),
           taskstate));
       
-      waitForCounter(tot_mgr_rescan_deleted, 0, 1, 1000);
+      waitForCounter(tot_mgr_rescan_deleted, 0, 1, to/2);
     } else {
       LOG.warn("Could not run test. Lost ZK connection?");
     }
@@ -330,7 +323,7 @@ public class TestSplitLogManager {
         batch.wait();
       }
     }
-    waitForCounter(tot_mgr_task_deleted, 0, 1, 1000);
+    waitForCounter(tot_mgr_task_deleted, 0, 1, to/2);
     assertTrue(ZKUtil.checkExists(zkw, tasknode) == -1);
   }
 
@@ -350,7 +343,7 @@ public class TestSplitLogManager {
         batch.wait();
       }
     }
-    waitForCounter(tot_mgr_task_deleted, 0, 1, 1000);
+    waitForCounter(tot_mgr_task_deleted, 0, 1, to/2);
     assertTrue(ZKUtil.checkExists(zkw, tasknode) == -1);
     conf.setInt("hbase.splitlog.max.resubmit", ZKSplitLog.DEFAULT_MAX_RESUBMIT);
   }
@@ -366,7 +359,7 @@ public class TestSplitLogManager {
     ZKUtil.setData(zkw, tasknode, TaskState.TASK_RESIGNED.get("worker"));
     int version = ZKUtil.checkExists(zkw, tasknode);
 
-    waitForCounter(tot_mgr_resubmit, 0, 1, 1000);
+    waitForCounter(tot_mgr_resubmit, 0, 1, to/2);
     int version1 = ZKUtil.checkExists(zkw, tasknode);
     assertTrue(version1 > version);
 
@@ -386,15 +379,9 @@ public class TestSplitLogManager {
         TaskState.TASK_OWNED.get("dummy-worker"), Ids.OPEN_ACL_UNSAFE,
         CreateMode.PERSISTENT);
 
-    int to = 4000;
-    conf.setInt("hbase.splitlog.manager.timeout", to);
-    conf.setInt("hbase.splitlog.manager.unassigned.timeout", 2 * to);
-    conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
-
-
     slm = new SplitLogManager(zkw, conf, stopper, "dummy-master", null);
     slm.finishInitialization();
-    waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, 100);
+    waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, to/2);
 
 
     // submit another task which will stay in unassigned mode
@@ -430,10 +417,10 @@ public class TestSplitLogManager {
     int version = ZKUtil.checkExists(zkw, tasknode);
 
     ZKUtil.setData(zkw, tasknode, TaskState.TASK_OWNED.get("worker1"));
-    waitForCounter(tot_mgr_heartbeat, 0, 1, 1000);
+    waitForCounter(tot_mgr_heartbeat, 0, 1, to/2);
     slm.handleDeadWorker("worker1");
-    waitForCounter(tot_mgr_resubmit, 0, 1, 3000);
-    waitForCounter(tot_mgr_resubmit_dead_server_task, 0, 1, 3000);
+    waitForCounter(tot_mgr_resubmit, 0, 1, to/2);
+    waitForCounter(tot_mgr_resubmit_dead_server_task, 0, 1, to + to/2);
 
     int version1 = ZKUtil.checkExists(zkw, tasknode);
     assertTrue(version1 > version);

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestHFileCleaner.java Sun Dec 23 20:54:12 2012
@@ -88,7 +88,7 @@ public class TestHFileCleaner {
         + status.getAccessTime();
   }
 
-  @Test
+  @Test(timeout = 60 *1000)
   public void testHFileCleaning() throws Exception {
     final EnvironmentEdge originalEdge = EnvironmentEdgeManager.getDelegate();
     String prefix = "someHFileThatWouldBeAUUID";

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExactCounterMetric.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExactCounterMetric.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExactCounterMetric.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExactCounterMetric.java Sun Dec 23 20:54:12 2012
@@ -22,9 +22,12 @@ import java.util.List;
 
 import junit.framework.Assert;
 
+import org.apache.hadoop.hbase.SmallTests;
 import org.apache.hadoop.hbase.util.Pair;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
+@Category(SmallTests.class)
 public class TestExactCounterMetric {
 
   @Test

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExponentiallyDecayingSample.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExponentiallyDecayingSample.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExponentiallyDecayingSample.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestExponentiallyDecayingSample.java Sun Dec 23 20:54:12 2012
@@ -22,8 +22,13 @@ import junit.framework.Assert;
 
 import com.yammer.metrics.stats.ExponentiallyDecayingSample;
 import com.yammer.metrics.stats.Snapshot;
+
+import org.apache.hadoop.hbase.SmallTests;
+
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
+@Category(SmallTests.class)
 public class TestExponentiallyDecayingSample {
   
   @Test

Modified: hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsHistogram.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsHistogram.java?rev=1425525&r1=1425524&r2=1425525&view=diff
==============================================================================
--- hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsHistogram.java (original)
+++ hbase/branches/0.94-test/src/test/java/org/apache/hadoop/hbase/metrics/TestMetricsHistogram.java Sun Dec 23 20:54:12 2012
@@ -22,10 +22,13 @@ import java.util.Arrays;
 import java.util.Random;
 
 import org.apache.hadoop.hbase.metrics.histogram.MetricsHistogram;
+import org.apache.hadoop.hbase.SmallTests;
 import com.yammer.metrics.stats.Snapshot;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
+@Category(SmallTests.class)
 public class TestMetricsHistogram {
 
   @Test



Mime
View raw message