You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2014/12/09 16:25:50 UTC

hbase git commit: HBASE-12653 Move TestRegionServerOnlineConfigChange & TestConfigurationManager to Junit4 tests (Ashish)

Repository: hbase
Updated Branches:
  refs/heads/master 035412878 -> c42c36521


HBASE-12653 Move TestRegionServerOnlineConfigChange & TestConfigurationManager to Junit4 tests (Ashish)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c42c3652
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c42c3652
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c42c3652

Branch: refs/heads/master
Commit: c42c36521d67c1add6ea9024b584d3e40389c89b
Parents: 0354128
Author: tedyu <yu...@gmail.com>
Authored: Tue Dec 9 07:25:44 2014 -0800
Committer: tedyu <yu...@gmail.com>
Committed: Tue Dec 9 07:25:44 2014 -0800

----------------------------------------------------------------------
 .../hbase/conf/TestConfigurationManager.java    |  8 +++-
 .../TestRegionServerOnlineConfigChange.java     | 41 ++++++++++++--------
 2 files changed, 30 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c42c3652/hbase-server/src/test/java/org/apache/hadoop/hbase/conf/TestConfigurationManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/conf/TestConfigurationManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/conf/TestConfigurationManager.java
index 51552a5..fe56344 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/conf/TestConfigurationManager.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/conf/TestConfigurationManager.java
@@ -18,17 +18,19 @@
 
 package org.apache.hadoop.hbase.conf;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.testclassification.ClientTests;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({SmallTests.class, ClientTests.class})
-public class TestConfigurationManager extends TestCase {
+public class TestConfigurationManager {
   public static final Log LOG = LogFactory.getLog(TestConfigurationManager.class);
 
   class DummyConfigurationObserver implements ConfigurationObserver {
@@ -66,6 +68,7 @@ public class TestConfigurationManager extends TestCase {
    * Test if observers get notified by the <code>ConfigurationManager</code>
    * when the Configuration is reloaded.
    */
+  @Test
   public void testCheckIfObserversNotified() {
     Configuration conf = new Configuration();
     ConfigurationManager cm = new ConfigurationManager();
@@ -101,6 +104,7 @@ public class TestConfigurationManager extends TestCase {
   /**
    * Test if out-of-scope observers are deregistered on GC.
    */
+  @Test
   public void testDeregisterOnOutOfScope() {
     Configuration conf = new Configuration();
     ConfigurationManager cm = new ConfigurationManager();

http://git-wip-us.apache.org/repos/asf/hbase/blob/c42c3652/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java
index 6aa2526..c58e9c6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java
@@ -18,7 +18,9 @@
 
 package org.apache.hadoop.hbase.regionserver;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,6 +32,9 @@ import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.regionserver.compactions.CompactionConfiguration;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import java.io.IOException;
@@ -41,25 +46,25 @@ import java.io.IOException;
  */
 
 @Category({MediumTests.class})
-public class TestRegionServerOnlineConfigChange extends TestCase {
-  static final Log LOG =
+public class TestRegionServerOnlineConfigChange {
+  private static final Log LOG =
           LogFactory.getLog(TestRegionServerOnlineConfigChange.class.getName());
-  HBaseTestingUtility hbaseTestingUtility = new HBaseTestingUtility();
-  Configuration conf = null;
+  private static HBaseTestingUtility hbaseTestingUtility = new HBaseTestingUtility();
+  private static Configuration conf = null;
 
-  HTable t1 = null;
-  HRegionServer rs1 = null;
-  byte[] r1name = null;
-  HRegion r1 = null;
+  private static HTable t1 = null;
+  private static HRegionServer rs1 = null;
+  private static byte[] r1name = null;
+  private static HRegion r1 = null;
 
-  final String table1Str = "table1";
-  final String columnFamily1Str = "columnFamily1";
-  final byte[] TABLE1 = Bytes.toBytes(table1Str);
-  final byte[] COLUMN_FAMILY1 = Bytes.toBytes(columnFamily1Str);
+  private final static String table1Str = "table1";
+  private final static String columnFamily1Str = "columnFamily1";
+  private final static byte[] TABLE1 = Bytes.toBytes(table1Str);
+  private final static byte[] COLUMN_FAMILY1 = Bytes.toBytes(columnFamily1Str);
 
 
-  @Override
-  public void setUp() throws Exception {
+  @BeforeClass
+  public static void setUp() throws Exception {
     conf = hbaseTestingUtility.getConfiguration();
     hbaseTestingUtility.startMiniCluster(1,1);
     t1 = hbaseTestingUtility.createTable(TABLE1, COLUMN_FAMILY1);
@@ -71,8 +76,8 @@ public class TestRegionServerOnlineConfigChange extends TestCase {
     r1 = rs1.getRegion(r1name);
   }
 
-  @Override
-  public void tearDown() throws Exception {
+  @AfterClass
+  public static void tearDown() throws Exception {
     hbaseTestingUtility.shutdownMiniCluster();
   }
 
@@ -80,6 +85,7 @@ public class TestRegionServerOnlineConfigChange extends TestCase {
    * Check if the number of compaction threads changes online
    * @throws IOException
    */
+  @Test
   public void testNumCompactionThreadsOnlineChange() throws IOException {
     assertTrue(rs1.compactSplitThread != null);
     int newNumSmallThreads =
@@ -105,6 +111,7 @@ public class TestRegionServerOnlineConfigChange extends TestCase {
    *
    * @throws IOException
    */
+  @Test
   public void testCompactionConfigurationOnlineChange() throws IOException {
     String strPrefix = "hbase.hstore.compaction.";
     Store s = r1.getStore(COLUMN_FAMILY1);