@Override public AdminService.BlockingInterface getAdmin(ServerName sn) throws IOException { return serverName.equals(sn) ? this.localHostAdmin : super.getAdmin(sn); }
@Override public AdminProtos.AdminService.BlockingInterface getAdminForMaster() throws IOException { return getAdmin(get(registry.getMasterAddress())); }
@Test(expected = UnknownHostException.class) public void testGetAdminBadHostname() throws Exception { // verify that we can get an instance with the cluster hostname ServerName master = testUtil.getHBaseCluster().getMaster().getServerName(); try { conn.getAdmin(master); } catch (UnknownHostException uhe) { fail("Obtaining admin to the cluster master should have succeeded"); } // test that we fail to get a client to an unresolvable hostname, which // means it won't be cached ServerName badHost = ServerName.valueOf("unknownhost.invalid:" + HConstants.DEFAULT_MASTER_PORT, System.currentTimeMillis()); conn.getAdmin(badHost); fail("Obtaining admin to unresolvable hostname should have failed"); }
if (admin != null) { Mockito.when(c.getAdmin(Mockito.any())). thenReturn(admin);
@Test(expected = UnknownHostException.class) public void testGetClientBadHostname() throws Exception { // verify that we can get an instance with the cluster hostname ServerName rs = testUtil.getHBaseCluster().getRegionServer(0).getServerName(); try { conn.getClient(rs); } catch (UnknownHostException uhe) { fail("Obtaining client to the cluster regionserver should have succeeded"); } // test that we fail to get a client to an unresolvable hostname, which // means it won't be cached ServerName badHost = ServerName.valueOf("unknownhost.invalid:" + HConstants.DEFAULT_REGIONSERVER_PORT, System.currentTimeMillis()); conn.getAdmin(badHost); fail("Obtaining client to unresolvable hostname should have failed"); } }
@Override public AdminService.BlockingInterface getAdmin(ServerName sn) throws IOException { return serverName.equals(sn) ? this.localHostAdmin : super.getAdmin(sn); }
@Override public AdminProtos.AdminService.BlockingInterface getAdminForMaster() throws IOException { return getAdmin(get(registry.getMasterAddress())); }
@Override public AdminService.BlockingInterface getAdmin(ServerName sn) throws IOException { return serverName.equals(sn) ? this.localHostAdmin : super.getAdmin(sn); }
@Override public AdminProtos.AdminService.BlockingInterface getAdminForMaster() throws IOException { return getAdmin(get(registry.getMasterAddress())); }
@Test(expected = UnknownHostException.class) public void testGetAdminBadHostname() throws Exception { // verify that we can get an instance with the cluster hostname ServerName master = testUtil.getHBaseCluster().getMaster().getServerName(); try { conn.getAdmin(master); } catch (UnknownHostException uhe) { fail("Obtaining admin to the cluster master should have succeeded"); } // test that we fail to get a client to an unresolvable hostname, which // means it won't be cached ServerName badHost = ServerName.valueOf("unknownhost.invalid:" + HConstants.DEFAULT_MASTER_PORT, System.currentTimeMillis()); conn.getAdmin(badHost); fail("Obtaining admin to unresolvable hostname should have failed"); }
if (admin != null) { Mockito.when(c.getAdmin(Mockito.any())). thenReturn(admin);
@Test(expected = UnknownHostException.class) public void testGetClientBadHostname() throws Exception { // verify that we can get an instance with the cluster hostname ServerName rs = testUtil.getHBaseCluster().getRegionServer(0).getServerName(); try { conn.getClient(rs); } catch (UnknownHostException uhe) { fail("Obtaining client to the cluster regionserver should have succeeded"); } // test that we fail to get a client to an unresolvable hostname, which // means it won't be cached ServerName badHost = ServerName.valueOf("unknownhost.invalid:" + HConstants.DEFAULT_REGIONSERVER_PORT, System.currentTimeMillis()); conn.getAdmin(badHost); fail("Obtaining client to unresolvable hostname should have failed"); } }