public class HConnectionTestingUtility extends Object
ClusterConnection testing utility.| Modifier and Type | Class and Description |
|---|---|
static class |
HConnectionTestingUtility.SleepAtFirstRpcCall
This coproceesor sleep 2s at first increment/append rpc call.
|
| Constructor and Description |
|---|
HConnectionTestingUtility() |
| Modifier and Type | Method and Description |
|---|---|
static ClusterConnection |
getMockedConnection(org.apache.hadoop.conf.Configuration conf)
Get a Mocked
ClusterConnection that goes with the passed conf
configuration instance. |
static ClusterConnection |
getMockedConnectionAndDecorate(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface client,
ServerName sn,
RegionInfo hri)
Calls
getMockedConnection(Configuration) and then mocks a few
more of the popular ClusterConnection methods so they do 'normal'
operation (see return doc below for list). |
static ClusterConnection |
getSpiedConnection(org.apache.hadoop.conf.Configuration conf)
Get a Mockito spied-upon
ClusterConnection that goes with the passed
conf configuration instance. |
public HConnectionTestingUtility()
public static ClusterConnection getMockedConnection(org.apache.hadoop.conf.Configuration conf) throws ZooKeeperConnectionException
ClusterConnection that goes with the passed conf
configuration instance. Minimally the mock will return
<code>conf</conf> when Connection.getConfiguration() is invoked.
Be sure to shutdown the connection when done by calling
Connection.close() else it will stick around; this is probably not what you want.conf - configurationconfZooKeeperConnectionExceptionpublic static ClusterConnection getMockedConnectionAndDecorate(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface client, ServerName sn, RegionInfo hri) throws IOException
getMockedConnection(Configuration) and then mocks a few
more of the popular ClusterConnection methods so they do 'normal'
operation (see return doc below for list). Be sure to shutdown the
connection when done by calling Connection.close() else it will stick around;
this is probably not what you want.conf - Configuration to useadmin - An AdminProtocol; can be null but is usually
itself a mock.client - A ClientProtocol; can be null but is usually
itself a mock.sn - ServerName to include in the region location returned by this
connectionhri - RegionInfo to include in the location returned when
getRegionLocator is called on the mocked connectionConfiguration when
Connection.getConfiguration() is called, a 'location' when
ClusterConnection.getRegionLocation(org.apache.hadoop.hbase.TableName, byte[], boolean)
is called,
and that returns the passed AdminProtos.AdminService.BlockingInterface instance when
ClusterConnection.getAdmin(ServerName) is called, returns the passed
ClientProtos.ClientService.BlockingInterface instance when
ClusterConnection.getClient(ServerName) is called (Be sure to call
Connection.close() when done with this mocked Connection.IOExceptionpublic static ClusterConnection getSpiedConnection(org.apache.hadoop.conf.Configuration conf) throws IOException
ClusterConnection that goes with the passed
conf configuration instance.
Be sure to shutdown the connection when done by calling
Connection.close() else it will stick around; this is probably not what you want.conf - configurationconfZooKeeperConnectionException - [Dead link]: See also
{http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)}IOExceptionCopyright © 2007–2019 Cloudera. All rights reserved.