PHOENIX-2335 Fix flapping MR-related tests

Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/18d06335
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/18d06335
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/18d06335

Branch: refs/heads/txn
Commit: 18d063353d8857898b29f68aa7789d33c16b1960
Parents: 7bc93f4
Author: James Taylor <[email protected]>
Authored: Sun Oct 18 17:05:30 2015 -0700
Committer: James Taylor <[email protected]>
Committed: Sun Oct 18 17:05:30 2015 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/end2end/ConnectionUtilIT.java | 11 +++--------
 .../apache/phoenix/mapreduce/CsvBulkLoadToolIT.java  | 15 ++++++---------
 .../org/apache/phoenix/mapreduce/IndexToolIT.java    | 13 +++++--------
 3 files changed, 14 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/18d06335/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionUtilIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionUtilIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionUtilIT.java
index babad81..65d2d37 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionUtilIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConnectionUtilIT.java
@@ -19,7 +19,7 @@
 package org.apache.phoenix.end2end;
 
 import static org.apache.phoenix.query.BaseTest.setUpConfigForMiniCluster;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -32,7 +32,6 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.phoenix.jdbc.PhoenixDriver;
 import org.apache.phoenix.mapreduce.util.ConnectionUtil;
-import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -77,13 +76,9 @@ public class ConnectionUtilIT {
        @AfterClass
        public static void tearDownAfterClass() throws Exception {
                try {
-                       PhoenixDriver.INSTANCE.close();
+            DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
                } finally {
-                       try {
-                               
DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
-                       } finally {
-                               hbaseTestUtil.shutdownMiniCluster();
-                       }
+                   hbaseTestUtil.shutdownMiniCluster();
                }
        }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/18d06335/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java
index 276bc47..e2ebad4 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java
@@ -62,6 +62,7 @@ public class CsvBulkLoadToolIT {
         hbaseTestUtil.startMiniMapReduceCluster();
 
         Class.forName(PhoenixDriver.class.getName());
+        DriverManager.registerDriver(PhoenixDriver.INSTANCE);
         zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort();
         conn = DriverManager.getConnection(PhoenixRuntime.JDBC_PROTOCOL
                 + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum);
@@ -70,19 +71,15 @@ public class CsvBulkLoadToolIT {
     @AfterClass
     public static void tearDownAfterClass() throws Exception {
         try {
-            conn.close();
+            if (conn != null) conn.close();
         } finally {
             try {
-                PhoenixDriver.INSTANCE.close();
+                DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
             } finally {
                 try {
-                    DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
-                } finally {                    
-                    try {
-                        hbaseTestUtil.shutdownMiniMapReduceCluster();
-                    } finally {
-                        hbaseTestUtil.shutdownMiniCluster();
-                    }
+                    hbaseTestUtil.shutdownMiniMapReduceCluster();
+                } finally {
+                    hbaseTestUtil.shutdownMiniCluster();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/18d06335/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java
index bc85c6a..30cae36 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java
@@ -67,6 +67,7 @@ public class IndexToolIT {
         hbaseTestUtil.startMiniCluster();
         hbaseTestUtil.startMiniMapReduceCluster();
         Class.forName(PhoenixDriver.class.getName());
+        DriverManager.registerDriver(PhoenixDriver.INSTANCE);
         zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort();
     }
     
@@ -321,16 +322,12 @@ public class IndexToolIT {
     @AfterClass
     public static void tearDownAfterClass() throws Exception {
         try {
-            PhoenixDriver.INSTANCE.close();
+            DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
         } finally {
             try {
-                DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
-            } finally {                    
-                try {
-                    hbaseTestUtil.shutdownMiniMapReduceCluster();
-                } finally {
-                    hbaseTestUtil.shutdownMiniCluster();
-                }
+                hbaseTestUtil.shutdownMiniMapReduceCluster();
+            } finally {
+                hbaseTestUtil.shutdownMiniCluster();
             }
         }
     }

Reply via email to