Package org.apache.hadoop.hbase.thrift
Class TestThriftServer
java.lang.Object
org.apache.hadoop.hbase.thrift.TestThriftServer
Unit testing for ThriftServerRunner.HBaseServiceHandler, a part of the
org.apache.hadoop.hbase.thrift package.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static ByteBufferprivate static ByteBufferprivate static ByteBufferprivate static final org.slf4j.Loggerprotected static final intprivate static final MetricsAssertHelperorg.junit.rules.TestNameprivate static ByteBufferprivate static ByteBufferprivate static ByteBufferprivate static ByteBufferprivate static final HBaseTestingUtilprivate static ByteBufferprivate static ByteBufferprivate static ByteBufferprivate static ByteBufferprivate static ByteBuffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidprivate static ByteBufferasByteBuffer(long l) private static ByteBufferstatic voidstatic voidcheckTableList(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) private voidcloseScanner(int scannerId, org.apache.hadoop.hbase.thrift.ThriftHBaseServiceHandler handler) Asserts that the passed scanner is exhausted, and then closes the scanner.private static intcountTablesByStatus(Boolean isEnabled, org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) static voidcreateTestTables(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) static voidAppends the value to a cell and checks that the cell value is updated properly.static voidCheck that checkAndPut fails if the cell does not exist, then put in the cell, then check that the checkAndPut succeeds.voidvoidstatic voiddoTestGetRegionInfo(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) voidFor HBASE-2556 Tests for GetTableRegionsstatic voiddoTestGetTableRegions(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) voidstatic voiddoTestIncrements(org.apache.hadoop.hbase.thrift.ThriftHBaseServiceHandler handler) voidTests for creating, enabling, disabling, and deleting tables.static voiddoTestTableCreateDrop(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) voidTests adding a series of Mutations and BatchMutations, including a delete mutation.static voiddoTestTableMutations(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) voidTests the four different scanner-opening methods (with and without a stoprow, with and without a timestamp).voidSimilar to testTableMutations(), except Mutations are applied with specific timestamps and data retrieval uses these timestamps to extract specific versions of data.voidTests if the metrics for thrift handler work correctlystatic voiddropTestTables(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) private static List<org.apache.hadoop.hbase.thrift.generated.BatchMutation>private static List<org.apache.hadoop.hbase.thrift.generated.ColumnDescriptor>private List<ByteBuffer>getColumnList(boolean includeA, boolean includeB) private intgetCurrentCount(String name, int maybe, org.apache.hadoop.hbase.thrift.ThriftMetrics metrics) TODO: These counts are supposed to be zero but sometimes they are not, they are equal to the passed in maybe.private static org.apache.hadoop.hbase.thrift.generated.Hbase.IfacegetHandlerForMetricsTest(org.apache.hadoop.hbase.thrift.ThriftMetrics metrics, org.apache.hadoop.conf.Configuration conf) private static org.apache.hadoop.hbase.thrift.ThriftMetricsgetMetrics(org.apache.hadoop.conf.Configuration conf) private static List<org.apache.hadoop.hbase.thrift.generated.Mutation>Returns a List of Mutations for a row, with columnA having valueA and columnB having valueBvoidtestAll()Runs all of the tests under a single JUnit test method.private voidtestExceptionType(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler, org.apache.hadoop.hbase.thrift.ThriftMetrics metrics, ByteBuffer tTableName, String rowkey, ErrorThrowingGetObserver.ErrorType errorType) voidvoidVerify that thrift client calling thrift2 server can get the thrift2 server type correctly.voidvoid
-
Field Details
-
CLASS_RULE
-
UTIL
-
LOG
-
metricsHelper
-
MAXVERSIONS
- See Also:
-
tableAname
-
tableBname
-
columnAname
-
columnAAname
-
columnBname
-
rowAname
-
rowBname
-
valueAname
-
valueBname
-
valueCname
-
valueDname
-
valueEname
-
name
-
-
Constructor Details
-
TestThriftServer
public TestThriftServer()
-
-
Method Details
-
asByteBuffer
-
asByteBuffer
-
beforeClass
- Throws:
Exception
-
afterClass
- Throws:
Exception
-
testAll
Runs all of the tests under a single JUnit test method. We consolidate all testing to one method because HBaseClusterTestCase is prone to OutOfMemoryExceptions when there are three or more JUnit test methods.- Throws:
Exception
-
doTestTableCreateDrop
Tests for creating, enabling, disabling, and deleting tables. Also tests that creating a table with an invalid column name yields an IllegalArgument exception.- Throws:
Exception
-
doTestTableCreateDrop
public static void doTestTableCreateDrop(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
getCurrentCount
private int getCurrentCount(String name, int maybe, org.apache.hadoop.hbase.thrift.ThriftMetrics metrics) TODO: These counts are supposed to be zero but sometimes they are not, they are equal to the passed in maybe. Investigate why. My guess is they are set by the test that runs just previous to this one. Sometimes they are cleared. Sometimes not. -
doTestThriftMetrics
Tests if the metrics for thrift handler work correctly- Throws:
Exception
-
getHandlerForMetricsTest
private static org.apache.hadoop.hbase.thrift.generated.Hbase.Iface getHandlerForMetricsTest(org.apache.hadoop.hbase.thrift.ThriftMetrics metrics, org.apache.hadoop.conf.Configuration conf) throws Exception - Throws:
Exception
-
getMetrics
private static org.apache.hadoop.hbase.thrift.ThriftMetrics getMetrics(org.apache.hadoop.conf.Configuration conf) throws Exception - Throws:
Exception
-
createTestTables
public static void createTestTables(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
checkTableList
public static void checkTableList(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
dropTestTables
public static void dropTestTables(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
doTestIncrements
- Throws:
Exception
-
doTestIncrements
public static void doTestIncrements(org.apache.hadoop.hbase.thrift.ThriftHBaseServiceHandler handler) throws Exception - Throws:
Exception
-
doTestTableMutations
Tests adding a series of Mutations and BatchMutations, including a delete mutation. Also tests data retrieval, and getting back multiple versions.- Throws:
Exception
-
doTestTableMutations
public static void doTestTableMutations(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
doTestTableTimestampsAndColumns
Similar to testTableMutations(), except Mutations are applied with specific timestamps and data retrieval uses these timestamps to extract specific versions of data.- Throws:
Exception
-
doTestTableScanners
Tests the four different scanner-opening methods (with and without a stoprow, with and without a timestamp).- Throws:
Exception
-
doTestGetTableRegions
For HBASE-2556 Tests for GetTableRegions- Throws:
Exception
-
doTestGetTableRegions
public static void doTestGetTableRegions(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
doTestFilterRegistration
- Throws:
Exception
-
doTestGetRegionInfo
- Throws:
Exception
-
doTestGetRegionInfo
public static void doTestGetRegionInfo(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
doTestAppend
Appends the value to a cell and checks that the cell value is updated properly.- Throws:
Exception
-
doTestCheckAndPut
Check that checkAndPut fails if the cell does not exist, then put in the cell, then check that the checkAndPut succeeds.- Throws:
Exception
-
testGetTableNamesWithStatus
- Throws:
Exception
-
countTablesByStatus
private static int countTablesByStatus(Boolean isEnabled, org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) throws Exception - Throws:
Exception
-
testMetricsWithException
- Throws:
Exception
-
testExceptionType
private void testExceptionType(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler, org.apache.hadoop.hbase.thrift.ThriftMetrics metrics, ByteBuffer tTableName, String rowkey, ErrorThrowingGetObserver.ErrorType errorType) throws Exception - Throws:
Exception
-
getColumnDescriptors
private static List<org.apache.hadoop.hbase.thrift.generated.ColumnDescriptor> getColumnDescriptors()- Returns:
- a List of ColumnDescriptors for use in creating a table. Has one default ColumnDescriptor and one ColumnDescriptor with fewer versions
-
getColumnList
- Parameters:
includeA- whether or not to include columnAincludeB- whether or not to include columnB- Returns:
- a List of column names for use in retrieving a scanner
-
getMutations
Returns a List of Mutations for a row, with columnA having valueA and columnB having valueB -
getBatchMutations
- Returns:
- a List of BatchMutations with the following effects: (rowA, columnA): delete (rowA, columnB): place valueC (rowB, columnA): place valueC (rowB, columnB): place valueD
-
closeScanner
private void closeScanner(int scannerId, org.apache.hadoop.hbase.thrift.ThriftHBaseServiceHandler handler) throws Exception Asserts that the passed scanner is exhausted, and then closes the scanner.- Parameters:
scannerId- the scanner to closehandler- the HBaseServiceHandler interfacing to HBase- Throws:
Exception
-
testGetThriftServerType
- Throws:
Exception
-
testGetThriftServerOneType
Verify that thrift client calling thrift2 server can get the thrift2 server type correctly.- Throws:
Exception
-