You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2012/06/27 00:04:59 UTC
svn commit: r1354259 -
/hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
Author: apurtell
Date: Tue Jun 26 22:04:58 2012
New Revision: 1354259
URL: http://svn.apache.org/viewvc?rev=1354259&view=rev
Log:
HBASE-6276. TestClassLoading is racy
Modified:
hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
Modified: hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java?rev=1354259&r1=1354258&r2=1354259&view=diff
==============================================================================
--- hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java (original)
+++ hbase/branches/0.92/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java Tue Jun 26 22:04:58 2012
@@ -41,7 +41,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.*;
@@ -57,7 +56,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;
@@ -88,7 +86,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).
@@ -235,12 +233,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,
@@ -281,8 +280,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;
@@ -337,12 +337,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,
@@ -439,12 +440,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,
@@ -486,7 +488,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()) {
@@ -516,6 +518,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);
@@ -534,6 +538,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));