HBASE-3262 TestHMasterRPCException uses non-ephemeral port for master

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1038353 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-11-23 21:53:09 +00:00
parent e0d13d4839
commit ea6311a33c
2 changed files with 9 additions and 10 deletions

View File

@ -706,6 +706,7 @@ Release 0.90.0 - Unreleased
HBASE-3259 Can't kill the region servers when they wait on the master or HBASE-3259 Can't kill the region servers when they wait on the master or
the cluster state znode the cluster state znode
HBASE-3249 Typing 'help shutdown' in the shell shouldn't shutdown the cluster HBASE-3249 Typing 'help shutdown' in the shell shouldn't shutdown the cluster
HBASE-3262 TestHMasterRPCException uses non-ephemeral port for master
IMPROVEMENTS IMPROVEMENTS

View File

@ -20,38 +20,36 @@
package org.apache.hadoop.hbase.master; package org.apache.hadoop.hbase.master;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HServerAddress; import org.apache.hadoop.hbase.HServerAddress;
import org.apache.hadoop.hbase.avro.generated.HBase;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.ipc.HBaseRPC; import org.apache.hadoop.hbase.ipc.HBaseRPC;
import org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion; import org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion;
import org.apache.hadoop.hbase.ipc.HMasterInterface; import org.apache.hadoop.hbase.ipc.HMasterInterface;
import org.apache.hadoop.hbase.ipc.ServerNotRunningException;
import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.ipc.RemoteException;
import org.junit.Test; import org.junit.Test;
import java.lang.reflect.UndeclaredThrowableException;
import static org.junit.Assert.*;
public class TestHMasterRPCException { public class TestHMasterRPCException {
@Test @Test
public void testRPCException() throws Exception { public void testRPCException() throws Exception {
HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
TEST_UTIL.startMiniZKCluster(); TEST_UTIL.startMiniZKCluster();
Configuration conf = TEST_UTIL.getConfiguration();
conf.set(HConstants.MASTER_PORT, "0");
HMaster hm = new HMaster(TEST_UTIL.getConfiguration()); HMaster hm = new HMaster(conf);
HServerAddress hma = hm.getMasterAddress(); HServerAddress hma = hm.getMasterAddress();
try { try {
HMasterInterface inf = HMasterInterface inf =
(HMasterInterface) HBaseRPC.getProxy( (HMasterInterface) HBaseRPC.getProxy(
HMasterInterface.class, HBaseRPCProtocolVersion.versionID, HMasterInterface.class, HBaseRPCProtocolVersion.versionID,
hma.getInetSocketAddress(), TEST_UTIL.getConfiguration(), hma.getInetSocketAddress(), conf, 100);
100);
inf.isMasterRunning(); inf.isMasterRunning();
fail(); fail();
} catch (RemoteException ex) { } catch (RemoteException ex) {