hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1354256 - /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
Date Tue, 26 Jun 2012 22:02:15 GMT
Author: apurtell
Date: Tue Jun 26 22:02:14 2012
New Revision: 1354256

URL: http://svn.apache.org/viewvc?rev=1354256&view=rev
Log:
HBASE-6276. TestClassLoading is racy

Modified:
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java

Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java?rev=1354256&r1=1354255&r2=1354256&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
(original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
Tue Jun 26 22:02:14 2012
@@ -33,7 +33,6 @@ import org.apache.hadoop.fs.Path;
 import javax.tools.*;
 import java.io.*;
 import java.util.*;
-import java.util.Arrays;
 import java.util.jar.*;
 
 import org.junit.*;
@@ -51,7 +50,6 @@ public class TestClassLoading {
   private static final Log LOG = LogFactory.getLog(TestClassLoading.class);
   private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
 
-  private static Configuration conf;
   private static MiniDFSCluster cluster;
 
   static final int BUFFER_SIZE = 4096;
@@ -82,7 +80,7 @@ public class TestClassLoading {
 
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
-    conf = TEST_UTIL.getConfiguration();
+    Configuration conf = TEST_UTIL.getConfiguration();
 
     // regionCoprocessor1 will be loaded on all regionservers, since it is
     // loaded for any tables (user or meta).
@@ -229,12 +227,13 @@ public class TestClassLoading {
       // with configuration values
     htd.setValue("COPROCESSOR$2", jarFileOnHDFS2.toString() + "|" + cpName2 +
       "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
-    HBaseAdmin admin = new HBaseAdmin(this.conf);
+    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(tableName)) {
       admin.disableTable(tableName);
       admin.deleteTable(tableName);
     }
     admin.createTable(htd);
+    TEST_UTIL.waitTableAvailable(htd.getName(), 5000);
 
     // verify that the coprocessors were loaded
     boolean found1 = false, found2 = false, found2_k1 = false,
@@ -275,8 +274,9 @@ public class TestClassLoading {
     htd.addFamily(new HColumnDescriptor("test"));
     htd.setValue("COPROCESSOR$1", jarFile.toString() + "|" + cpName3 + "|" +
       Coprocessor.PRIORITY_USER);
-    HBaseAdmin admin = new HBaseAdmin(this.conf);
+    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
     admin.createTable(htd);
+    TEST_UTIL.waitTableAvailable(htd.getName(), 5000);
 
     // verify that the coprocessor was loaded
     boolean found = false;
@@ -331,12 +331,13 @@ public class TestClassLoading {
     htd.addCoprocessor(cpName5, new Path(jarFile5.getPath()),
         Coprocessor.PRIORITY_USER, kvs);
 
-    HBaseAdmin admin = new HBaseAdmin(this.conf);
+    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(tableName)) {
       admin.disableTable(tableName);
       admin.deleteTable(tableName);
     }
     admin.createTable(htd);
+    TEST_UTIL.waitTableAvailable(htd.getName(), 5000);
 
     // verify that the coprocessor was loaded
     boolean found_2 = false, found_1 = false, found_3 = false,
@@ -433,12 +434,13 @@ public class TestClassLoading {
       // with configuration values
     htd.setValue("COPROCESSOR$2", jarFileOnHDFS.toString() + "|" + cpName2 +
       "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
-    HBaseAdmin admin = new HBaseAdmin(this.conf);
+    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(tableName)) {
       admin.disableTable(tableName);
       admin.deleteTable(tableName);
     }
     admin.createTable(htd);
+    TEST_UTIL.waitTableAvailable(htd.getName(), 5000);
 
     // verify that the coprocessors were loaded
     boolean found1 = false, found2 = false, found2_k1 = false,
@@ -480,7 +482,7 @@ public class TestClassLoading {
     // name "ColumnAggregationEndpoint" will appear before regionCoprocessor2's
     // name "GenericEndpoint" because "C" is before "G" lexicographically.
 
-    HBaseAdmin admin = new HBaseAdmin(this.conf);
+    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
 
     // disable all user tables, if any are loaded.
     for (HTableDescriptor htd: admin.listTables()) {
@@ -510,6 +512,8 @@ public class TestClassLoading {
     String userTable1 = "userTable1";
     HTableDescriptor userTD1 = new HTableDescriptor(userTable1);
     admin.createTable(userTD1);
+    TEST_UTIL.waitTableAvailable(userTD1.getName(), 5000);
+
     // table should be enabled now.
     assertTrue(admin.isTableEnabled(userTable1));
     assertAllRegionServers(regionServerSystemAndUserCoprocessors, userTable1);
@@ -528,6 +532,7 @@ public class TestClassLoading {
     htd2.setValue("COPROCESSOR$1", jarFile1.toString() + "|" + userTableCP +
       "|" + Coprocessor.PRIORITY_USER);
     admin.createTable(htd2);
+    TEST_UTIL.waitTableAvailable(htd2.getName(), 5000);
     // table should be enabled now.
     assertTrue(admin.isTableEnabled(userTable2));
 



Mime
View raw message