Package org.apache.hadoop.hbase.client
Class HConnectionTestingUtility
java.lang.Object
org.apache.hadoop.hbase.client.HConnectionTestingUtility
Connection
testing utility.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This coproceesor sleep 2s at first increment/append rpc call. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.hbase.client.ClusterConnection
getMockedConnection
(org.apache.hadoop.conf.Configuration conf) <<<<<<< HEAD Get a MockedClusterConnection
that goes with the passedconf
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) CallsgetMockedConnection(Configuration)
and then mocks a few more of the popularClusterConnection
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-uponClusterConnection
that goes with the passedconf
configuration instance.
-
Constructor Details
-
HConnectionTestingUtility
public HConnectionTestingUtility()
-
-
Method Details
-
getMockedConnection
public static org.apache.hadoop.hbase.client.ClusterConnection getMockedConnection(org.apache.hadoop.conf.Configuration conf) throws org.apache.hadoop.hbase.ZooKeeperConnectionException <<<<<<< HEAD Get a MockedClusterConnection
that goes with the passedconf
configuration instance. Minimally the mock will return <code>conf</conf> whenConnection.getConfiguration()
is invoked. Be sure to shutdown the connection when done by callingConnection.close()
else it will stick around; this is probably not what you want. ======= Get a MockedConnection
that goes with the passedconf
configuration instance. Minimally the mock will return <code>conf</conf> whenConnection.getConfiguration()
is invoked. Be sure to shutdown the connection when done by callingConnection.close()
else it will stick around; this is probably not what you want. >>>>>>> fabf2b8282... HBASE-22572 Javadoc Warnings: @link reference not found (#306)- Parameters:
conf
- configuration- Returns:
- ClusterConnection object for
conf
- Throws:
org.apache.hadoop.hbase.ZooKeeperConnectionException
-
getMockedConnectionAndDecorate
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 CallsgetMockedConnection(Configuration)
and then mocks a few more of the popularClusterConnection
methods so they do 'normal' operation (see return doc below for list). Be sure to shutdown the connection when done by callingConnection.close()
else it will stick around; this is probably not what you want.- Parameters:
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 thisconnection
hri
- RegionInfo to include in the location returned when getRegionLocator is called on the mocked connection- Returns:
- Mock up a connection that returns a
Configuration
whenConnection.getConfiguration()
is called, a 'location' whenClusterConnection.getRegionLocation(org.apache.hadoop.hbase.TableName, byte[], boolean)
is called, and that returns the passedAdminProtos.AdminService.BlockingInterface
instance whenClusterConnection.getAdmin(ServerName)
is called, returns the passedClientProtos.ClientService.BlockingInterface
instance whenClusterConnection.getClient(ServerName)
is called (Be sure to callConnection.close()
when done with this mocked Connection. - Throws:
IOException
-
getSpiedConnection
public static org.apache.hadoop.hbase.client.ClusterConnection getSpiedConnection(org.apache.hadoop.conf.Configuration conf) throws IOException Get a Mockito spied-uponClusterConnection
that goes with the passedconf
configuration instance. Be sure to shutdown the connection when done by callingConnection.close()
else it will stick around; this is probably not what you want.- Parameters:
conf
- configuration- Returns:
- ClusterConnection object for
conf
[Dead link]: See also {http://mockito.googlecode.com/svn/branches/1.6/javadoc/org/mockito/Mockito.html#spy(T)} - Throws:
IOException
-