Class TestImportTsv
java.lang.Object
org.apache.hadoop.hbase.mapreduce.TestImportTsv
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
protected static final String
org.junit.rules.ExpectedException
private final String
protected static final String
Force use of combiner in doMROnTableTest.private static final org.slf4j.Logger
protected static final String
private org.apache.hadoop.hbase.TableName
protected static HBaseTestingUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.hadoop.util.Tool
doMROnTableTest
(String data, int valueMultiplier) protected static org.apache.hadoop.util.Tool
doMROnTableTest
(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args) protected static org.apache.hadoop.util.Tool
doMROnTableTest
(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args, int valueMultiplier, int expectedKVCount) Run an ImportTsv job and perform basic validation on the results.org.apache.hadoop.conf.Configuration
getConf()
private static int
getKVCountFromHfile
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p) Method returns the total KVs in given hfilestatic void
static void
void
setConf
(org.apache.hadoop.conf.Configuration conf) void
setup()
void
void
void
void
void
void
If table is not present in bulk mode and create.table is not set to yes, import should fail with TableNotFoundException.void
void
If table is not present in non-bulk mode, dry run should fail just like normal mode.void
void
void
void
void
void
void
void
void
void
If there are invalid data rows as inputs, then only those rows should be ignored.void
private static void
validateHFiles
(org.apache.hadoop.fs.FileSystem fs, String outputPath, String family, int expectedKVCount) Confirm ImportTsv via HFiles on fs.private static void
validateTable
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String family, int valueMultiplier, boolean isDryRun) Confirm ImportTsv via data in online table.
-
Field Details
-
CLASS_RULE
-
LOG
-
NAME
-
util
-
DELETE_AFTER_LOAD_CONF
-
FORCE_COMBINER_CONF
Force use of combiner in doMROnTableTest. Boolean. Default is true. -
FAMILY
- See Also:
-
tn
-
args
-
exception
-
-
Constructor Details
-
TestImportTsv
public TestImportTsv()
-
-
Method Details
-
getConf
- Specified by:
getConf
in interfaceorg.apache.hadoop.conf.Configurable
-
setConf
- Specified by:
setConf
in interfaceorg.apache.hadoop.conf.Configurable
-
provisionCluster
- Throws:
Exception
-
releaseCluster
- Throws:
Exception
-
setup
- Throws:
Exception
-
testMROnTable
- Throws:
Exception
-
testMROnTableWithTimestamp
- Throws:
Exception
-
testMROnTableWithCustomMapper
- Throws:
Exception
-
testBulkOutputWithoutAnExistingTable
- Throws:
Exception
-
testBulkOutputWithAnExistingTable
- Throws:
Exception
-
testBulkOutputWithAnExistingTableNoStrictTrue
- Throws:
Exception
-
testJobConfigurationsWithTsvImporterTextMapper
- Throws:
Exception
-
testBulkOutputWithTsvImporterTextMapper
- Throws:
Exception
-
testWithoutAnExistingTableAndCreateTableSetToNo
- Throws:
Exception
-
testMRNoMatchedColumnFamily
- Throws:
Exception
-
testMRWithoutAnExistingTable
- Throws:
Exception
-
testJobConfigurationsWithDryMode
- Throws:
Exception
-
testDryModeWithoutBulkOutputAndTableExists
- Throws:
Exception
-
testDryModeWithoutBulkOutputAndTableDoesNotExists
If table is not present in non-bulk mode, dry run should fail just like normal mode.- Throws:
Exception
-
testDryModeWithBulkOutputAndTableExists
- Throws:
Exception
-
testDryModeWithBulkOutputAndTableDoesNotExistsCreateTableSetToNo
If table is not present in bulk mode and create.table is not set to yes, import should fail with TableNotFoundException.- Throws:
Exception
-
testDryModeWithBulkModeAndTableDoesNotExistsCreateTableSetToYes
- Throws:
Exception
-
testTsvImporterTextMapperWithInvalidData
If there are invalid data rows as inputs, then only those rows should be ignored.- Throws:
Exception
-
testSkipEmptyColumns
- Throws:
Exception
-
doMROnTableTest
private org.apache.hadoop.util.Tool doMROnTableTest(String data, int valueMultiplier) throws Exception - Throws:
Exception
-
doMROnTableTest
protected static org.apache.hadoop.util.Tool doMROnTableTest(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args) throws Exception- Throws:
Exception
-
doMROnTableTest
protected static org.apache.hadoop.util.Tool doMROnTableTest(HBaseTestingUtil util, org.apache.hadoop.hbase.TableName table, String family, String data, Map<String, String> args, int valueMultiplier, int expectedKVCount) throws ExceptionRun an ImportTsv job and perform basic validation on the results. Returns the ImportTsvTool
instance so that other tests can inspect it for further validation as necessary. This method is static to insure non-reliance on instance's util/conf facilities.- Parameters:
args
- Any arguments to pass BEFORE inputFile path is appended.- Returns:
- The Tool instance used to run the test.
- Throws:
Exception
-
validateTable
private static void validateTable(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.TableName tableName, String family, int valueMultiplier, boolean isDryRun) throws IOException Confirm ImportTsv via data in online table.- Throws:
IOException
-
validateHFiles
private static void validateHFiles(org.apache.hadoop.fs.FileSystem fs, String outputPath, String family, int expectedKVCount) throws IOException Confirm ImportTsv via HFiles on fs.- Throws:
IOException
-
getKVCountFromHfile
private static int getKVCountFromHfile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p) throws IOException Method returns the total KVs in given hfile- Parameters:
fs
- File Systemp
- HFile path- Returns:
- KV count in the given hfile
- Throws:
IOException
-