Package org.apache.hadoop.hbase.client
Class HConnectionTestingUtility
java.lang.Object
org.apache.hadoop.hbase.client.HConnectionTestingUtility
Connection testing utility.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis coproceesor sleep 2s at first increment/append rpc call. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.hbase.client.ClusterConnectiongetMockedConnection(org.apache.hadoop.conf.Configuration conf) <<<<<<< HEAD Get a MockedClusterConnectionthat goes with the passedconfconfiguration instance.static org.apache.hadoop.hbase.client.ClusterConnectiongetMockedConnectionAndDecorate(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 popularClusterConnectionmethods so they do 'normal' operation (see return doc below for list).static org.apache.hadoop.hbase.client.ClusterConnectiongetSpiedConnection(org.apache.hadoop.conf.Configuration conf) Get a Mockito spied-uponClusterConnectionthat goes with the passedconfconfiguration 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 MockedClusterConnectionthat goes with the passedconfconfiguration 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 MockedConnectionthat goes with the passedconfconfiguration 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 popularClusterConnectionmethods 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 thisconnectionhri- RegionInfo to include in the location returned when getRegionLocator is called on the mocked connection- Returns:
- Mock up a connection that returns a
ConfigurationwhenConnection.getConfiguration()is called, a 'location' whenClusterConnection.getRegionLocation(org.apache.hadoop.hbase.TableName, byte[], boolean)is called, and that returns the passedAdminProtos.AdminService.BlockingInterfaceinstance whenClusterConnection.getAdmin(ServerName)is called, returns the passedClientProtos.ClientService.BlockingInterfaceinstance 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-uponClusterConnectionthat goes with the passedconfconfiguration 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
-