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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private static ByteBuffer
private static ByteBuffer
private static ByteBuffer
private static final org.slf4j.Logger
protected static final int
private static final MetricsAssertHelper
org.junit.rules.TestName
private static ByteBuffer
private static ByteBuffer
private static ByteBuffer
private static ByteBuffer
private static final HBaseTestingUtil
private static ByteBuffer
private static ByteBuffer
private static ByteBuffer
private static ByteBuffer
private static ByteBuffer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
private static ByteBuffer
asByteBuffer
(long l) private static ByteBuffer
static void
static void
checkTableList
(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) private void
closeScanner
(int scannerId, org.apache.hadoop.hbase.thrift.ThriftHBaseServiceHandler handler) Asserts that the passed scanner is exhausted, and then closes the scanner.private static int
countTablesByStatus
(Boolean isEnabled, org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) static void
createTestTables
(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) static void
Appends the value to a cell and checks that the cell value is updated properly.static void
Check that checkAndPut fails if the cell does not exist, then put in the cell, then check that the checkAndPut succeeds.void
void
static void
doTestGetRegionInfo
(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) void
For HBASE-2556 Tests for GetTableRegionsstatic void
doTestGetTableRegions
(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) void
static void
doTestIncrements
(org.apache.hadoop.hbase.thrift.ThriftHBaseServiceHandler handler) void
Tests for creating, enabling, disabling, and deleting tables.static void
doTestTableCreateDrop
(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) void
Tests adding a series of Mutations and BatchMutations, including a delete mutation.static void
doTestTableMutations
(org.apache.hadoop.hbase.thrift.generated.Hbase.Iface handler) void
Tests the four different scanner-opening methods (with and without a stoprow, with and without a timestamp).void
Similar to testTableMutations(), except Mutations are applied with specific timestamps and data retrieval uses these timestamps to extract specific versions of data.void
Tests if the metrics for thrift handler work correctlystatic void
dropTestTables
(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 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.private static org.apache.hadoop.hbase.thrift.generated.Hbase.Iface
getHandlerForMetricsTest
(org.apache.hadoop.hbase.thrift.ThriftMetrics metrics, org.apache.hadoop.conf.Configuration conf) private static org.apache.hadoop.hbase.thrift.ThriftMetrics
getMetrics
(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 valueBvoid
testAll()
Runs all of the tests under a single JUnit test method.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) void
void
Verify that thrift client calling thrift2 server can get the thrift2 server type correctly.void
void
-
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
-