PHOENIX-3937 Remove @AfterClass methods from test classes annotated with @NeedsOwnMiniClusterTest
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 65d2d37..64bb9ec 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
@@ -73,12 +73,4 @@
assertEquals(1, rs.getInt(1));
}
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- try {
- DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
- } finally {
- hbaseTestUtil.shutdownMiniCluster();
- }
- }
}
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ContextClassloaderIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ContextClassloaderIT.java
index 4c67b32..8546231 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ContextClassloaderIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ContextClassloaderIT.java
@@ -80,15 +80,6 @@
return "jdbc:phoenix:localhost:" + hbaseTestUtil.getZkCluster().getClientPort() + ";test=true";
}
- @AfterClass
- public static void tearDown() throws Exception {
- try {
- destroyDriver(driver);
- } finally {
- hbaseTestUtil.shutdownMiniCluster();
- }
- }
-
@Test
public void testQueryWithDifferentContextClassloader() throws SQLException, InterruptedException {
Runnable target = new Runnable() {
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
index 53bf625..9634b8a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java
@@ -76,11 +76,6 @@
private final boolean mutable;
private final boolean useSnapshot;
- @AfterClass
- public static void doTeardown() throws Exception {
- tearDownMiniCluster();
- }
-
public IndexExtendedIT(boolean transactional, boolean mutable, boolean localIndex, boolean directApi, boolean useSnapshot) {
this.localIndex = localIndex;
this.transactional = transactional;
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
index 03afdfc..df59485 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
@@ -297,7 +297,7 @@
}
@Test
- public void testLikeExpressionWithLimitOffset() throws Exception {
+ public void testMultiCFLikeExpressionWithLimitOffset() throws Exception {
String tableName = generateUniqueName();
String ddl =
"create table " + tableName
@@ -355,4 +355,64 @@
assertEquals(expectedCount, i);
}
}
+
+ @Test
+ public void testSingleCFLikeExpressionWithLimitOffset() throws Exception {
+ String tableName = generateUniqueName();
+ String ddl =
+ "create table " + tableName
+ + " (id integer not null primary key, cf.col1 varchar, cf.col2 varchar, cf.col3 varchar, cf.col4 varchar)";
+ String upsert = "UPSERT INTO " + tableName + " VALUES (?, ?, ?, ?, ?)";
+ try (Connection conn = DriverManager.getConnection(getUrl())) {
+ conn.createStatement().execute(ddl);
+ PreparedStatement stmt = conn.prepareStatement(upsert);
+ for (int i = 1; i <= 10; i++) {
+ stmt.setInt(1, i);
+ stmt.setString(2, i + "col1");
+ stmt.setString(3, i + "col2");
+ stmt.setString(4, i + "col3");
+ stmt.setString(5, i + "col4");
+ stmt.executeUpdate();
+ }
+ conn.commit();
+
+ String query =
+ "select cf.* from " + tableName
+ + " where cf.col1 like '%col1%' limit 10 offset 2";
+ ResultSet rs = conn.createStatement().executeQuery(query);
+ int expectedCount = 8;
+ int i = 0;
+ while (rs.next()) {
+ i++;
+ assertTrue(rs.getString("COL1").contains("col1"));
+ assertTrue(rs.getString("COL2").contains("col2"));
+ }
+ assertEquals(expectedCount, i);
+
+ query =
+ "select cf.* from " + tableName
+ + " where cf.col1 like '%col1%' limit 10 offset 2";
+ rs = conn.createStatement().executeQuery(query);
+ i = 0;
+ while (rs.next()) {
+ i++;
+ assertTrue(rs.getString("COL1").contains("col1"));
+ assertTrue(rs.getString("COL2").contains("col2"));
+ assertTrue(rs.getString("COL3").contains("col3"));
+ assertTrue(rs.getString("COL4").contains("col4"));
+ }
+ assertEquals(expectedCount, i);
+ query = "select cf.* from " + tableName + " where cf.col1 like '%col1%' limit 10 offset 2";
+ rs = conn.createStatement().executeQuery(query);
+ i = 0;
+ while (rs.next()) {
+ i++;
+ assertTrue(rs.getString("COL1").contains("col1"));
+ assertTrue(rs.getString("COL2").contains("col2"));
+ assertTrue(rs.getString("COL3").contains("col3"));
+ assertTrue(rs.getString("COL4").contains("col4"));
+ }
+ assertEquals(expectedCount, i);
+ }
+ }
}
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
index 7622314..5855d37 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java
@@ -62,7 +62,6 @@
import org.apache.phoenix.util.ReadOnlyProps;
import org.apache.phoenix.util.SchemaUtil;
import org.apache.phoenix.util.StringUtil;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexReplicationIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexReplicationIT.java
index 2568566..48265ed 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexReplicationIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexReplicationIT.java
@@ -109,19 +109,6 @@
setupDriver();
}
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- try {
- destroyDriver(driver);
- } finally {
- try {
- utility2.shutdownMiniCluster();
- } finally {
- utility1.shutdownMiniCluster();
- }
- }
- }
-
private static void setupConfigsAndStartCluster() throws Exception {
// cluster-1 lives at regular HBase home, so we don't need to change how phoenix handles
// lookups
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
index 97d8f3e..8d127be 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java
@@ -107,11 +107,6 @@
UTIL.startMiniCluster();
}
- @AfterClass
- public static void shutdownCluster() throws Exception {
- UTIL.shutdownMiniCluster();
- }
-
@Before
public void setup() throws Exception {
this.state = setupTest(TestTable.getTableNameString());
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
index 5102dc8..9151577 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java
@@ -132,11 +132,6 @@
initDriver();
}
- @AfterClass
- public static void teardownCluster() throws Exception {
- UTIL.shutdownMiniCluster();
- }
-
@Before
public void setup() throws Exception {
setupColumns();
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/FailWithoutRetriesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/FailWithoutRetriesIT.java
index 6367945..6f60f7f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/FailWithoutRetriesIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/FailWithoutRetriesIT.java
@@ -84,11 +84,6 @@
UTIL.startMiniCluster();
}
- @AfterClass
- public static void teardownCluster() throws Exception {
- UTIL.shutdownMiniCluster();
- }
-
/**
* If this test times out, then we didn't fail quickly enough. {@link Indexer} maybe isn't rethrowing the exception
* correctly?
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/iterate/ScannerLeaseRenewalIT.java b/phoenix-core/src/it/java/org/apache/phoenix/iterate/ScannerLeaseRenewalIT.java
index 09fae45..4f5e55e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/iterate/ScannerLeaseRenewalIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/iterate/ScannerLeaseRenewalIT.java
@@ -93,15 +93,6 @@
}
}
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- try {
- DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
- } finally {
- hbaseTestUtil.shutdownMiniCluster();
- }
- }
-
@Test
public void testRenewLeasePreventsSelectQueryFromFailing() throws Exception {
String tableName = "testRenewLeasePreventsSelectQueryFromFailing";