HBASE-19310 Avoid an NPE IntegrationTestImportTsv when outside of the context of JUnit
Signed-off-by: Michael Stack <stack@apache.org> Signed-off-by: Ted Yu <tedyu@apache.org>
This commit is contained in:
parent
0ef7a24245
commit
46cb5d5986
|
@ -185,13 +185,15 @@ public class IntegrationTestImportTsv extends Configured implements Tool {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateAndLoad() throws Exception {
|
public void testGenerateAndLoad() throws Exception {
|
||||||
|
generateAndLoad(TableName.valueOf(name.getMethodName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void generateAndLoad(final TableName table) throws Exception {
|
||||||
LOG.info("Running test testGenerateAndLoad.");
|
LOG.info("Running test testGenerateAndLoad.");
|
||||||
final TableName table = TableName.valueOf(name.getMethodName());
|
|
||||||
String cf = "d";
|
String cf = "d";
|
||||||
Path hfiles = new Path(
|
Path hfiles = new Path(
|
||||||
util.getDataTestDirOnTestFS(table.getNameAsString()), "hfiles");
|
util.getDataTestDirOnTestFS(table.getNameAsString()), "hfiles");
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> args = new HashMap<>();
|
Map<String, String> args = new HashMap<>();
|
||||||
args.put(ImportTsv.BULK_OUTPUT_CONF_KEY, hfiles.toString());
|
args.put(ImportTsv.BULK_OUTPUT_CONF_KEY, hfiles.toString());
|
||||||
args.put(ImportTsv.COLUMNS_CONF_KEY,
|
args.put(ImportTsv.COLUMNS_CONF_KEY,
|
||||||
|
@ -226,7 +228,11 @@ public class IntegrationTestImportTsv extends Configured implements Tool {
|
||||||
// adding more test methods? Don't forget to add them here... or consider doing what
|
// adding more test methods? Don't forget to add them here... or consider doing what
|
||||||
// IntegrationTestsDriver does.
|
// IntegrationTestsDriver does.
|
||||||
provisionCluster();
|
provisionCluster();
|
||||||
testGenerateAndLoad();
|
TableName tableName = TableName.valueOf("IntegrationTestImportTsv");
|
||||||
|
if (util.getAdmin().tableExists(tableName)) {
|
||||||
|
util.deleteTable(tableName);
|
||||||
|
}
|
||||||
|
generateAndLoad(tableName);
|
||||||
releaseCluster();
|
releaseCluster();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue