You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/10/20 21:13:40 UTC

svn commit: r1186997 - in /hbase/trunk: CHANGES.txt src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java

Author: stack
Date: Thu Oct 20 19:13:40 2011
New Revision: 1186997

URL: http://svn.apache.org/viewvc?rev=1186997&view=rev
Log:
HBASE-4604 hbase.client.TestHTablePool could start a single cluster instead of one per method

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1186997&r1=1186996&r2=1186997&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Oct 20 19:13:40 2011
@@ -643,6 +643,8 @@ Release 0.92.0 - Unreleased
    HBASE-3581  hbase rpc should send size of response
    HBASE-4585  Avoid seek operation when current kv is deleted(Liyin Tang)
    HBASE-4486  Improve Javadoc for HTableDescriptor (Akash Ashok)
+   HBASE-4604  hbase.client.TestHTablePool could start a single
+               cluster instead of one per method (nkeywal)
        
 
   TASKS

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java?rev=1186997&r1=1186996&r2=1186997&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestHTablePool.java Thu Oct 20 19:13:40 2011
@@ -31,25 +31,31 @@ import org.apache.hadoop.hbase.HConstant
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.PoolMap.PoolType;
-import org.junit.Test;
+import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
 
 /**
  * Tests HTablePool.
  */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({TestHTablePool.TestHTableReusablePool.class, TestHTablePool.TestHTableThreadLocalPool.class})
 public class TestHTablePool {
 	private static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
 	private final static byte[] TABLENAME = Bytes.toBytes("TestHTablePool");
 
-	public abstract static class TestHTablePoolType extends TestCase {
-		protected void setUp() throws Exception {
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
 			TEST_UTIL.startMiniCluster(1);
 			TEST_UTIL.createTable(TABLENAME, HConstants.CATALOG_FAMILY);
 		}
 
-		protected void tearDown() throws IOException {
+    @AfterClass
+		public static void tearDownAfterClass() throws IOException {
 			TEST_UTIL.shutdownMiniCluster();
 		}
 
+	public abstract static class TestHTablePoolType extends TestCase {
 		protected abstract PoolType getPoolType();
 
 		@Test
@@ -95,7 +101,11 @@ public class TestHTablePool {
 		public void testTablesWithDifferentNames() throws IOException {
 			HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(),
 					Integer.MAX_VALUE, getPoolType());
-			byte[] otherTable = Bytes.toBytes("OtherTable");
+      // We add the class to the table name as the HBase cluster is reused
+      //  during the tests: this gives naming unicity.
+			byte[] otherTable = Bytes.toBytes(
+        "OtherTable_" + getClass().getSimpleName()
+      );
 			TEST_UTIL.createTable(otherTable, HConstants.CATALOG_FAMILY);
 
 			// Request a table from an empty pool
@@ -341,12 +351,4 @@ public class TestHTablePool {
 					pool.getCurrentPoolSize(Bytes.toString(TABLENAME)));
 		}
 	}
-
-	public static junit.framework.Test suite() {
-		TestSuite suite = new TestSuite();
-		suite.addTestSuite(TestHTableReusablePool.class);
-		suite.addTestSuite(TestHTableThreadLocalPool.class);
-		return suite;
-	}
-
 }