Repository: phoenix Updated Branches: refs/heads/master 993164b63 -> de6fbc4e2
PHOENIX-3937 Remove @AfterClass methods from test classes annotated with @NeedsOwnMiniClusterTest Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/de6fbc4e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/de6fbc4e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/de6fbc4e Branch: refs/heads/master Commit: de6fbc4e2a13cdc482cbc1c91e51c4bc526aa12f Parents: 993164b Author: Samarth Jain <[email protected]> Authored: Wed Jun 14 12:44:03 2017 -0700 Committer: Samarth Jain <[email protected]> Committed: Wed Jun 14 15:33:18 2017 -0700 ---------------------------------------------------------------------- .../phoenix/end2end/ConnectionUtilIT.java | 8 --- .../phoenix/end2end/ContextClassloaderIT.java | 9 --- .../apache/phoenix/end2end/IndexExtendedIT.java | 5 -- .../phoenix/end2end/LikeExpressionIT.java | 62 +++++++++++++++++++- .../end2end/index/MutableIndexFailureIT.java | 1 - .../index/MutableIndexReplicationIT.java | 13 ---- .../EndToEndCoveredColumnsIndexBuilderIT.java | 5 -- .../example/EndToEndCoveredIndexingIT.java | 5 -- .../covered/example/FailWithoutRetriesIT.java | 5 -- .../phoenix/iterate/ScannerLeaseRenewalIT.java | 9 --- 10 files changed, 61 insertions(+), 61 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/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 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 @@ public class ConnectionUtilIT { assertEquals(1, rs.getInt(1)); } - @AfterClass - public static void tearDownAfterClass() throws Exception { - try { - DriverManager.deregisterDriver(PhoenixDriver.INSTANCE); - } finally { - hbaseTestUtil.shutdownMiniCluster(); - } - } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/end2end/ContextClassloaderIT.java ---------------------------------------------------------------------- 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 @@ public class ContextClassloaderIT extends BaseTest { 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() { http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexExtendedIT.java ---------------------------------------------------------------------- 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 @@ public class IndexExtendedIT extends BaseTest { 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; http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java ---------------------------------------------------------------------- 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 @@ public class LikeExpressionIT extends ParallelStatsDisabledIT { } @Test - public void testLikeExpressionWithLimitOffset() throws Exception { + public void testMultiCFLikeExpressionWithLimitOffset() throws Exception { String tableName = generateUniqueName(); String ddl = "create table " + tableName @@ -355,4 +355,64 @@ public class LikeExpressionIT extends ParallelStatsDisabledIT { 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); + } + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java ---------------------------------------------------------------------- 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.QueryUtil; 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; http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexReplicationIT.java ---------------------------------------------------------------------- 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 @@ public class MutableIndexReplicationIT extends BaseTest { 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 http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/EndToEndCoveredColumnsIndexBuilderIT.java ---------------------------------------------------------------------- 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 @@ public class EndToEndCoveredColumnsIndexBuilderIT { UTIL.startMiniCluster(); } - @AfterClass - public static void shutdownCluster() throws Exception { - UTIL.shutdownMiniCluster(); - } - @Before public void setup() throws Exception { this.state = setupTest(TestTable.getTableNameString()); http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/EndToEndCoveredIndexingIT.java ---------------------------------------------------------------------- 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 @@ public class EndToEndCoveredIndexingIT { initDriver(); } - @AfterClass - public static void teardownCluster() throws Exception { - UTIL.shutdownMiniCluster(); - } - @Before public void setup() throws Exception { setupColumns(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/covered/example/FailWithoutRetriesIT.java ---------------------------------------------------------------------- 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 @@ public class FailWithoutRetriesIT { 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? http://git-wip-us.apache.org/repos/asf/phoenix/blob/de6fbc4e/phoenix-core/src/it/java/org/apache/phoenix/iterate/ScannerLeaseRenewalIT.java ---------------------------------------------------------------------- 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 @@ public class ScannerLeaseRenewalIT { } } - @AfterClass - public static void tearDownAfterClass() throws Exception { - try { - DriverManager.deregisterDriver(PhoenixDriver.INSTANCE); - } finally { - hbaseTestUtil.shutdownMiniCluster(); - } - } - @Test public void testRenewLeasePreventsSelectQueryFromFailing() throws Exception { String tableName = "testRenewLeasePreventsSelectQueryFromFailing";
