hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1528984 [3/3] - in /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase: ./ io/hfile/ master/handler/ regionserver/ security/access/
Date Thu, 03 Oct 2013 19:47:09 GMT
Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionBusyWait.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionBusyWait.java?rev=1528984&r1=1528983&r2=1528984&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionBusyWait.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionBusyWait.java
Thu Oct  3 19:47:09 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
+import static org.junit.Assert.fail;
+
 import java.io.IOException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -25,6 +27,7 @@ import org.apache.hadoop.hbase.MediumTes
 import org.apache.hadoop.hbase.RegionTooBusyException;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -33,11 +36,12 @@ import org.junit.experimental.categories
  * We can't use parameterized test since TestHRegion is old fashion.
  */
 @Category(MediumTests.class)
-@SuppressWarnings("deprecation")
 public class TestHRegionBusyWait extends TestHRegion {
   // TODO: This subclass runs all the tests in TestHRegion as well as the test below which
means
   // all TestHRegion tests are run twice.
-  public TestHRegionBusyWait() {
+  @Before
+  public void setup() throws IOException {
+    super.setup();
     conf.set("hbase.busy.wait.duration", "1000");
   }
 

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java?rev=1528984&r1=1528983&r2=1528984&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestParallelPut.java
Thu Oct  3 19:47:09 2013
@@ -17,23 +17,35 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
+import static org.apache.hadoop.hbase.HBaseTestingUtility.fam1;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Random;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.*;
-import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants.OperationStatusCode;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper;
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
 
 
 /**
@@ -41,15 +53,15 @@ import org.junit.experimental.categories
  *
  */
 @Category(MediumTests.class)
-public class TestParallelPut extends HBaseTestCase {
+public class TestParallelPut {
   static final Log LOG = LogFactory.getLog(TestParallelPut.class);
-
+  @Rule public TestName name = new TestName(); 
+  
   private static HRegion region = null;
   private static HBaseTestingUtility hbtu = new HBaseTestingUtility();
-  private static final String DIR = hbtu.getDataTestDir() + "/TestParallelPut/";
 
   // Test names
-  static final byte[] tableName = Bytes.toBytes("testtable");;
+  static byte[] tableName;
   static final byte[] qual1 = Bytes.toBytes("qual1");
   static final byte[] qual2 = Bytes.toBytes("qual2");
   static final byte[] qual3 = Bytes.toBytes("qual3");
@@ -61,16 +73,19 @@ public class TestParallelPut extends HBa
   /**
    * @see org.apache.hadoop.hbase.HBaseTestCase#setUp()
    */
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
+  @Before
+  public void setUp() throws Exception {
+    tableName = Bytes.toBytes(name.getMethodName());
   }
 
-  @Override
-  protected void tearDown() throws Exception {
-    super.tearDown();
+  @After
+  public void tearDown() throws Exception {
     EnvironmentEdgeManagerTestHelper.reset();
   }
+  
+  public String getName() {
+    return name.getMethodName();
+  }
 
   //////////////////////////////////////////////////////////////////////////////
   // New tests that don't spin up a mini cluster but rather just test the
@@ -80,6 +95,7 @@ public class TestParallelPut extends HBa
   /**
    * Test one put command.
    */
+  @Test
   public void testPut() throws IOException {
     LOG.info("Starting testPut");
     initHRegion(tableName, getName(), fam1);
@@ -96,6 +112,7 @@ public class TestParallelPut extends HBa
   /**
    * Test multi-threaded Puts.
    */
+  @Test
   public void testParallelPuts() throws IOException {
 
     LOG.info("Starting testParallelPuts");
@@ -148,24 +165,12 @@ public class TestParallelPut extends HBa
   private void initHRegion(byte [] tableName, String callingMethod,
     byte[] ... families)
   throws IOException {
-    initHRegion(tableName, callingMethod, HBaseConfiguration.create(), families);
-  }
-
-  private void initHRegion(byte [] tableName, String callingMethod,
-    Configuration conf, byte [] ... families)
-  throws IOException{
     HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
     for(byte [] family : families) {
       htd.addFamily(new HColumnDescriptor(family));
     }
     HRegionInfo info = new HRegionInfo(htd.getTableName(), null, null, false);
-    Path path = new Path(DIR + callingMethod);
-    if (fs.exists(path)) {
-      if (!fs.delete(path, true)) {
-        throw new IOException("Failed delete of " + path);
-      }
-    }
-    region = HRegion.createHRegion(info, path, conf, htd);
+    region = hbtu.createLocalHRegion(info, htd);
   }
 
   /**

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java?rev=1528984&r1=1528983&r2=1528984&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessControlFilter.java
Thu Oct  3 19:47:09 2013
@@ -23,18 +23,18 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.IOException;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
-import java.io.IOException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.LargeTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -46,14 +46,18 @@ import org.apache.hadoop.hbase.security.
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
 
 import com.google.protobuf.BlockingRpcChannel;
 
 @Category(LargeTests.class)
 public class TestAccessControlFilter {
+  @Rule public TestName name = new TestName();
   private static Log LOG = LogFactory.getLog(TestAccessControlFilter.class);
   private static HBaseTestingUtility TEST_UTIL;
 
@@ -62,12 +66,17 @@ public class TestAccessControlFilter {
   private static User LIMITED;
   private static User DENIED;
 
-  private static TableName TABLE =
-      TableName.valueOf("testtable");
+  
+  private static TableName TABLE;
   private static byte[] FAMILY = Bytes.toBytes("f1");
   private static byte[] PRIVATE_COL = Bytes.toBytes("private");
   private static byte[] PUBLIC_COL = Bytes.toBytes("public");
 
+  @Before 
+  public void setup () {
+    TABLE = TableName.valueOf(name.getMethodName());
+  }
+  
   @BeforeClass
   public static void setupBeforeClass() throws Exception {
     TEST_UTIL = new HBaseTestingUtility();
@@ -107,7 +116,7 @@ public class TestAccessControlFilter {
       public Object run() throws Exception {
         HTable aclmeta = new HTable(TEST_UTIL.getConfiguration(),
             AccessControlLists.ACL_TABLE_NAME);
-        byte[] table = Bytes.toBytes("testtable");
+        byte[] table = Bytes.toBytes(name.getMethodName());
         BlockingRpcChannel service = aclmeta.coprocessorService(table);
         AccessControlService.BlockingInterface protocol =
           AccessControlService.newBlockingStub(service);



Mime
View raw message