HBASE-6202 Medium tests fail with jdk1.7

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1351423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2012-06-18 17:47:46 +00:00
parent 8ee16d9aad
commit 52f7000373
5 changed files with 94 additions and 71 deletions

View File

@ -235,7 +235,9 @@ public class TestClassLoading {
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
HBaseAdmin admin = new HBaseAdmin(this.conf);
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);
}
admin.deleteTable(tableName);
}
admin.createTable(htd);
@ -337,7 +339,9 @@ public class TestClassLoading {
HBaseAdmin admin = new HBaseAdmin(this.conf);
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);
}
admin.deleteTable(tableName);
}
admin.createTable(htd);
@ -439,7 +443,9 @@ public class TestClassLoading {
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
HBaseAdmin admin = new HBaseAdmin(this.conf);
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);
}
admin.deleteTable(tableName);
}
admin.createTable(htd);

View File

@ -916,6 +916,8 @@ public class TestMasterObserver {
cp.resetStates();
HTable table = UTIL.createTable(TEST_TABLE, TEST_FAMILY);
try {
int countOfRegions = UTIL.createMultiRegions(table, TEST_FAMILY);
UTIL.waitUntilAllRegionsAssigned(countOfRegions);
@ -956,8 +958,17 @@ public class TestMasterObserver {
assertTrue("Coprocessor should have been called on balance switch",
cp.wasBalanceSwitchCalled());
// force region rebalancing
// turn balancer off
master.balanceSwitch(false);
// wait for assignments to finish, if any
AssignmentManager mgr = master.getAssignmentManager();
Collection<AssignmentManager.RegionState> transRegions =
mgr.copyRegionsInTransition().values();
for (AssignmentManager.RegionState state : transRegions) {
mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
}
// move half the open regions from RS 0 to RS 1
HRegionServer rs = cluster.getRegionServer(0);
byte[] destRS = Bytes.toBytes(cluster.getRegionServer(1).getServerName().toString());
@ -972,9 +983,7 @@ public class TestMasterObserver {
}
// wait for assignments to finish
AssignmentManager mgr = master.getAssignmentManager();
Collection<AssignmentManager.RegionState> transRegions =
mgr.copyRegionsInTransition().values();
transRegions = mgr.copyRegionsInTransition().values();
for (AssignmentManager.RegionState state : transRegions) {
mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
}
@ -985,6 +994,9 @@ public class TestMasterObserver {
assertTrue("Coprocessor should be called on region rebalancing",
cp.wasBalanceCalled());
table.close();
} finally {
UTIL.deleteTable(TEST_TABLE);
}
}
@org.junit.Rule

View File

@ -83,8 +83,7 @@ public class TestSplitLogManager {
private SplitLogManager slm;
private Configuration conf;
private final static HBaseTestingUtility TEST_UTIL =
new HBaseTestingUtility();
private static HBaseTestingUtility TEST_UTIL;
/**
* Additional amount of time we wait for events to happen. Added where unit
@ -115,6 +114,7 @@ public class TestSplitLogManager {
@Before
public void setup() throws Exception {
TEST_UTIL = new HBaseTestingUtility();
TEST_UTIL.startMiniZKCluster();
conf = TEST_UTIL.getConfiguration();
// Use a different ZK wrapper instance for each tests.
@ -222,7 +222,6 @@ public class TestSplitLogManager {
conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
to = to + 2 * 100;
slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
slm.finishInitialization();
waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, 100);
@ -504,7 +503,12 @@ public class TestSplitLogManager {
@Test(timeout=45000)
public void testVanishingTaskZNode() throws Exception {
LOG.info("testVanishingTaskZNode");
int to = 1000;
conf.setInt("hbase.splitlog.manager.timeout", to);
conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
conf.setInt("hbase.splitlog.manager.unassigned.timeout", 0);
slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
slm.finishInitialization();
FileSystem fs = TEST_UTIL.getTestFileSystem();

View File

@ -37,6 +37,7 @@ public class TestEnvironmentEdgeManager {
@Test
public void testManageSingleton() {
EnvironmentEdgeManager.reset();
EnvironmentEdge edge = EnvironmentEdgeManager.getDelegate();
assertNotNull(edge);
assertTrue(edge instanceof DefaultEnvironmentEdge);

View File

@ -54,7 +54,7 @@ public class TestFSTableDescriptors {
@Test
public void testCreateAndUpdate() throws IOException {
Path testdir = UTIL.getDataTestDir();
Path testdir = UTIL.getDataTestDir("testCreateAndUpdate");
HTableDescriptor htd = new HTableDescriptor("testCreate");
FileSystem fs = FileSystem.get(UTIL.getConfiguration());
assertTrue(FSTableDescriptors.createTableDescriptor(fs, testdir, htd));