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 org.apache.hadoop.hbase.client.ClusterConnection |
getMockedConnection(org.apache.hadoop.conf.Configuration conf)
Get a Mocked
ClusterConnection that goes with the passed conf
configuration instance. |
static org.apache.hadoop.hbase.client.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,
org.apache.hadoop.hbase.ServerName sn,
org.apache.hadoop.hbase.client.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 org.apache.hadoop.hbase.client.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 org.apache.hadoop.hbase.client.ClusterConnection getMockedConnection(org.apache.hadoop.conf.Configuration conf) throws org.apache.hadoop.hbase.ZooKeeperConnectionException
ClusterConnection
that goes with the passed conf
configuration instance. Minimally the mock will return
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
- configurationconf
org.apache.hadoop.hbase.ZooKeeperConnectionException
public static org.apache.hadoop.hbase.client.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, org.apache.hadoop.hbase.ServerName sn, org.apache.hadoop.hbase.client.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
connection
hri
- 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.IOException
public static org.apache.hadoop.hbase.client.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
- configurationconf
org.apache.hadoop.hbase.ZooKeeperConnectionException
IOException
{http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)}
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.