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

svn commit: r1588332 - /hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestSimpleOperations.java

Author: liyin
Date: Thu Apr 17 18:18:26 2014
New Revision: 1588332

URL: http://svn.apache.org/r1588332
Log:
[HBASE-10986] Fix TestSimpleOperations now that setup is @BeforeClass

Author: elliott

Summary: TestSimpleOperations should now pass after setUp is annotated with @BeforeClass

Test Plan: mvn test -Dtest=TestSimpleOperations

Reviewers: daviddeng, liyintang

Reviewed By: daviddeng

CC: hbase-eng@

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

Task ID: 4158408

Modified:
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestSimpleOperations.java

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestSimpleOperations.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestSimpleOperations.java?rev=1588332&r1=1588331&r2=1588332&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestSimpleOperations.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/swift/TestSimpleOperations.java Thu Apr 17 18:18:26 2014
@@ -15,8 +15,10 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.HTableAsyncInterface;
 import org.apache.hadoop.hbase.client.Mutation;
@@ -37,9 +39,10 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 
 public class TestSimpleOperations {
-  private final Log LOG = LogFactory.getLog(TestSimpleOperations.class);
-  private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-  private final int SLAVES = 1;
+  private static final Log LOG = LogFactory.getLog(TestSimpleOperations.class);
+  private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+  private static final int SLAVES = 1;
+
   static final String ROW_PREFIX = "row";
   static final byte[] TABLE = Bytes.toBytes("testTable");
   static final byte[] FAMILY = Bytes.toBytes("family");
@@ -53,7 +56,7 @@ public class TestSimpleOperations {
   static final byte[] QUALIFIER2 = Bytes.toBytes("q2");
 
   @BeforeClass
-  public void setUp() throws Exception {
+  public static void setUp() throws Exception {
     TEST_UTIL.getConfiguration().setBoolean(
         HConstants.REGION_SERVER_WRITE_THRIFT_INFO_TO_META, true);
     TEST_UTIL.getConfiguration().setBoolean(HConstants.CLIENT_TO_RS_USE_THRIFT,
@@ -64,10 +67,19 @@ public class TestSimpleOperations {
   }
 
   @AfterClass
-  public void tearDown() throws Exception {
+  public static void tearDown() throws Exception {
     TEST_UTIL.shutdownMiniCluster();
   }
 
+  @After
+  public void cleanUp() throws IOException {
+    final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    if (admin.tableExists(TABLE)) {
+      admin.disableTable(TABLE);
+      admin.deleteTable(TABLE);
+    }
+  }
+
   /**
    * Test if doing a simple put using Hadoop RPC, followed by doing a simple get
    * on that row (using thrift, this time), works or not.
@@ -455,7 +467,7 @@ public class TestSimpleOperations {
    */
   @Test(timeout=180000)
   public void testGetRowOrBeforeAsync() throws Exception {
-    HTableAsyncInterface table = TEST_UTIL.createTable(Bytes.toBytes("testGetRowOrBefore"),
+    HTableAsyncInterface table = TEST_UTIL.createTable(Bytes.toBytes("testGetRowOrBeforeAsync"),
         FAMILY);
     byte[] value = Bytes.toBytes("value");
     Put p = new Put(Bytes.toBytes("bb"));