You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by el...@apache.org on 2017/11/22 22:32:17 UTC

[3/4] hbase git commit: HBASE-19310 Avoid an NPE IntegrationTestImportTsv when outside of the context of JUnit

HBASE-19310 Avoid an NPE IntegrationTestImportTsv when outside of the context of JUnit

Signed-off-by: Michael Stack <st...@apache.org>
Signed-off-by: Ted Yu <te...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/46cb5d59
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/46cb5d59
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/46cb5d59

Branch: refs/heads/branch-2
Commit: 46cb5d598689577b01cc7690587ae94579b70a11
Parents: 0ef7a24
Author: Josh Elser <el...@apache.org>
Authored: Tue Nov 21 13:34:51 2017 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Wed Nov 22 17:23:53 2017 -0500

----------------------------------------------------------------------
 .../hbase/mapreduce/IntegrationTestImportTsv.java       | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/46cb5d59/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestImportTsv.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestImportTsv.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestImportTsv.java
index 887dd8b..dfc54e0 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestImportTsv.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestImportTsv.java
@@ -185,13 +185,15 @@ public class IntegrationTestImportTsv extends Configured implements Tool {
 
   @Test
   public void testGenerateAndLoad() throws Exception {
+    generateAndLoad(TableName.valueOf(name.getMethodName()));
+  }
+
+  void generateAndLoad(final TableName table) throws Exception {
     LOG.info("Running test testGenerateAndLoad.");
-    final TableName table = TableName.valueOf(name.getMethodName());
     String cf = "d";
     Path hfiles = new Path(
         util.getDataTestDirOnTestFS(table.getNameAsString()), "hfiles");
 
-
     Map<String, String> args = new HashMap<>();
     args.put(ImportTsv.BULK_OUTPUT_CONF_KEY, hfiles.toString());
     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
     // IntegrationTestsDriver does.
     provisionCluster();
-    testGenerateAndLoad();
+    TableName tableName = TableName.valueOf("IntegrationTestImportTsv");
+    if (util.getAdmin().tableExists(tableName)) {
+      util.deleteTable(tableName);
+    }
+    generateAndLoad(tableName);
     releaseCluster();
 
     return 0;