PHOENIX-2335 Fix flapping MR-related tests
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.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 @@
@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();
}
}
}
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 @@
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 @@
@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();
}
}
}
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 @@
hbaseTestUtil.startMiniCluster();
hbaseTestUtil.startMiniMapReduceCluster();
Class.forName(PhoenixDriver.class.getName());
+ DriverManager.registerDriver(PhoenixDriver.INSTANCE);
zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort();
}
@@ -321,16 +322,12 @@
@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();
}
}
}