Class HConnectionTestingUtility

java.lang.Object
org.apache.hadoop.hbase.client.HConnectionTestingUtility

public class HConnectionTestingUtility extends Object
Connection testing utility.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This coproceesor sleep 2s at first increment/append rpc call.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.hadoop.hbase.client.ClusterConnection
    getMockedConnection(org.apache.hadoop.conf.Configuration conf)
    <<<<<<< HEAD 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • 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 Mocked 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. ======= Get a Mocked Connection 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. >>>>>>> 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
      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). Be sure to shutdown the connection when done by calling Connection.close() else it will stick around; this is probably not what you want.
      Parameters:
      conf - Configuration to use
      admin - 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 connection
      Returns:
      Mock up a connection that returns a Configuration 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.
      Throws:
      IOException
    • getSpiedConnection

      public static org.apache.hadoop.hbase.client.ClusterConnection getSpiedConnection(org.apache.hadoop.conf.Configuration conf) throws IOException
      Get a Mockito spied-upon 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.
      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