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 2013/03/08 05:34:48 UTC

svn commit: r1454245 - /hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHalfStoreFileReader.java

Author: tedyu
Date: Fri Mar  8 04:34:48 2013
New Revision: 1454245

URL: http://svn.apache.org/r1454245
Log:
HBASE-7960 cleanup TestDir in TestHalfStoreFileReader (Liang Xie)


Modified:
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHalfStoreFileReader.java

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHalfStoreFileReader.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHalfStoreFileReader.java?rev=1454245&r1=1454244&r2=1454245&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHalfStoreFileReader.java (original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHalfStoreFileReader.java Fri Mar  8 04:34:48 2013
@@ -36,11 +36,24 @@ import org.apache.hadoop.hbase.io.encodi
 import org.apache.hadoop.hbase.io.hfile.HFile;
 import org.apache.hadoop.hbase.io.hfile.HFileScanner;
 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;
 
 @Category(SmallTests.class)
 public class TestHalfStoreFileReader {
+  private static HBaseTestingUtility TEST_UTIL;
+
+  @BeforeClass
+  public static void setupBeforeClass() throws Exception {
+    TEST_UTIL = new HBaseTestingUtility();
+  }
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+    TEST_UTIL.cleanupTestDir();
+  }
 
   /**
    * Test the scanner and reseek of a half hfile scanner. The scanner API
@@ -60,11 +73,10 @@ public class TestHalfStoreFileReader {
    */
   @Test
   public void testHalfScanAndReseek() throws IOException {
-    HBaseTestingUtility test_util = new HBaseTestingUtility();
-    String root_dir = test_util.getDataTestDir("TestHalfStoreFile").toString();
+    String root_dir = TEST_UTIL.getDataTestDir("TestHalfStoreFile").toString();
     Path p = new Path(root_dir, "test");
 
-    Configuration conf = test_util.getConfiguration();
+    Configuration conf = TEST_UTIL.getConfiguration();
     FileSystem fs = FileSystem.get(conf);
     CacheConfig cacheConf = new CacheConfig(conf);
 
@@ -128,10 +140,9 @@ public class TestHalfStoreFileReader {
   // Tests the scanner on an HFile that is backed by HalfStoreFiles
   @Test
   public void testHalfScanner() throws IOException {
-      HBaseTestingUtility test_util = new HBaseTestingUtility();
-      String root_dir = test_util.getDataTestDir("TestHalfStoreFileScanBefore").toString();
+      String root_dir = TEST_UTIL.getDataTestDir("TestHalfStoreFileScanBefore").toString();
       Path p = new Path(root_dir, "test");
-      Configuration conf = test_util.getConfiguration();
+      Configuration conf = TEST_UTIL.getConfiguration();
       FileSystem fs = FileSystem.get(conf);
       CacheConfig cacheConf = new CacheConfig(conf);