Repository: phoenix Updated Branches: refs/heads/4.4-HBase-1.0 ad2571306 -> 4b7de8c1a
PHOENIX-2063 Addendum patch to fix connection usage Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4b7de8c1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4b7de8c1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4b7de8c1 Branch: refs/heads/4.4-HBase-1.0 Commit: 4b7de8c1a447e502c35d3e4a29593981dab5a8f0 Parents: ad25713 Author: James Taylor <jtay...@salesforce.com> Authored: Thu Jul 9 22:55:25 2015 -0700 Committer: ramkrishna <ramkrishna.s.vasude...@gmail.com> Committed: Fri Jul 10 13:18:15 2015 +0530 ---------------------------------------------------------------------- .../phoenix/end2end/RowValueConstructorIT.java | 28 +++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4b7de8c1/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java index 0cf5455..b9e50a4 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java @@ -1426,10 +1426,11 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { @Test public void testCountDistinct1() throws Exception { - Connection conn = DriverManager.getConnection(getUrl()); + Connection conn = nextConnection(getUrl()); String ddl = "CREATE TABLE regions1 (region_name VARCHAR PRIMARY KEY, a INTEGER, b INTEGER)"; conn.createStatement().execute(ddl); - conn.commit(); + + conn = nextConnection(getUrl()); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO regions1(region_name, a, b) VALUES('a', 6,3)"); stmt.execute(); stmt = conn.prepareStatement("UPSERT INTO regions1(region_name, a, b) VALUES('b', 2,4)"); @@ -1437,18 +1438,23 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { stmt = conn.prepareStatement("UPSERT INTO regions1(region_name, a, b) VALUES('c', 6,3)"); stmt.execute(); conn.commit(); + + conn = nextConnection(getUrl()); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(DISTINCT (a,b)) from regions1"); assertTrue(rs.next()); assertEquals(2, rs.getInt(1)); + conn.close(); } @Test public void testCountDistinct2() throws Exception { - Connection conn = DriverManager.getConnection(getUrl()); + Connection conn = nextConnection(getUrl()); String ddl = "CREATE TABLE regions2 (region_name VARCHAR PRIMARY KEY, a VARCHAR, b VARCHAR)"; conn.createStatement().execute(ddl); conn.commit(); + + conn = nextConnection(getUrl()); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO regions2(region_name, a, b) VALUES('a', 'fooo','abc')"); stmt.execute(); stmt = conn.prepareStatement("UPSERT INTO regions2(region_name, a, b) VALUES('b', 'off','bac')"); @@ -1456,6 +1462,8 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { stmt = conn.prepareStatement("UPSERT INTO regions2(region_name, a, b) VALUES('c', 'fooo', 'abc')"); stmt.execute(); conn.commit(); + + conn = nextConnection(getUrl()); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(DISTINCT (a,b)) from regions2"); assertTrue(rs.next()); @@ -1464,10 +1472,11 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { @Test public void testCountDistinct3() throws Exception { - Connection conn = DriverManager.getConnection(getUrl()); + Connection conn = nextConnection(getUrl()); String ddl = "CREATE TABLE regions3 (region_name VARCHAR PRIMARY KEY, a Boolean, b Boolean)"; conn.createStatement().execute(ddl); - conn.commit(); + + conn = nextConnection(getUrl()); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO regions3(region_name, a, b) VALUES('a', true, true)"); stmt.execute(); stmt = conn.prepareStatement("UPSERT INTO regions3(region_name, a, b) VALUES('b', true, False)"); @@ -1477,6 +1486,8 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { stmt = conn.prepareStatement("UPSERT INTO regions3(region_name, a, b) VALUES('d', true, false)"); stmt.execute(); conn.commit(); + + conn = nextConnection(getUrl()); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(DISTINCT (a,b)) from regions3"); assertTrue(rs.next()); @@ -1485,10 +1496,11 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { @Test public void testCountDistinct4() throws Exception { - Connection conn = DriverManager.getConnection(getUrl()); + Connection conn = nextConnection(getUrl()); String ddl = "CREATE TABLE regions4 (region_name VARCHAR PRIMARY KEY, a VARCHAR, b VARCHAR)"; conn.createStatement().execute(ddl); - conn.commit(); + + conn = nextConnection(getUrl()); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO regions4(region_name, a, b) VALUES('a', 'fooo','abc')"); stmt.execute(); stmt = conn.prepareStatement("UPSERT INTO regions4(region_name, a, b) VALUES('b', 'off','bac')"); @@ -1496,6 +1508,8 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { stmt = conn.prepareStatement("UPSERT INTO regions4(region_name, a, b) VALUES('c', 'foo', 'abc')"); stmt.execute(); conn.commit(); + + conn = nextConnection(getUrl()); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(DISTINCT (a,b)) from regions4"); assertTrue(rs.next());