Return-Path: X-Original-To: apmail-phoenix-commits-archive@minotaur.apache.org Delivered-To: apmail-phoenix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9E32A11153 for ; Sat, 26 Jul 2014 16:24:01 +0000 (UTC) Received: (qmail 31753 invoked by uid 500); 26 Jul 2014 16:24:01 -0000 Delivered-To: apmail-phoenix-commits-archive@phoenix.apache.org Received: (qmail 31705 invoked by uid 500); 26 Jul 2014 16:24:01 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 31692 invoked by uid 99); 26 Jul 2014 16:24:01 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jul 2014 16:24:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1B7D49B6876; Sat, 26 Jul 2014 16:24:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jamestaylor@apache.org To: commits@phoenix.apache.org Date: Sat, 26 Jul 2014 16:24:01 -0000 Message-Id: <2b507658ff90403a89bfdd2ceaeb9032@git.apache.org> In-Reply-To: <957c3a8176354548b4e285dabbc5dbd6@git.apache.org> References: <957c3a8176354548b4e285dabbc5dbd6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/9] PHOENIX-1122 Ensure TEST_PROPERTIES is not updated to prevent test flapping http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/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 dec44c2..bdae151 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 @@ -52,6 +52,7 @@ import java.util.Properties; import org.apache.phoenix.util.DateUtil; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.TestUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -65,7 +66,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) = (7, 5)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -90,7 +91,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) >= (4, 4)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -116,7 +117,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer, y_integer) >= (7, 5)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -142,7 +143,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) = (?, ?)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -169,7 +170,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) >= 7"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -193,7 +194,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND 7 <= (a_integer, x_integer)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -217,7 +218,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) >= to_number('7')"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -241,7 +242,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND to_number('7') <= (a_integer, x_integer)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -265,7 +266,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts - 1); String upsertQuery = "UPSERT INTO aTable(organization_id, entity_id, a_string) values (?, ?, ?)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); @@ -331,7 +332,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts - 1); String upsertQuery = "UPSERT INTO aTable(organization_id, entity_id, a_string) values (?, ?, ?)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); @@ -397,7 +398,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); Date date = new Date(System.currentTimeMillis()); initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), date, ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); Connection conn = DriverManager.getConnection(getUrl(), props); @@ -439,7 +440,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { } else { initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), date, ts - 1); } - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); Connection conn = DriverManager.getConnection(getUrl(), props); @@ -520,7 +521,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { } else { initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), date, ts - 1); } - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); @@ -599,7 +600,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { } else { initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), date, ts - 1); } - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); String startingParentId = PARENTID1; @@ -653,7 +654,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, a_string FROM aTable WHERE ?=organization_id AND (a_integer, a_string) <= (5, 'a')"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -686,7 +687,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { " A_TIMESTAMP) " + "VALUES (?, ?, ?)"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 1); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection upsertConn = DriverManager.getConnection(url, props); upsertConn.setAutoCommit(true); PreparedStatement stmt = upsertConn.prepareStatement(updateStmt); @@ -697,7 +698,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { stmt.execute(); String query = "SELECT a_timestamp, a_string FROM aTable WHERE ?=organization_id AND (a_timestamp, a_string) = (?, 'a')"; - props = new Properties(TEST_PROPERTIES); + props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -727,7 +728,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { "SELECT organization_id, entity_id, a_string FROM aTable WHERE (organization_id, entity_id, a_string) >= (?, ?, ?)", "SELECT organization_id, entity_id, a_string FROM aTable WHERE (organization_id, (entity_id, a_string)) >= (?, (?, ?))" }; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); PreparedStatement statement = null; @@ -762,7 +763,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); //we have a row present in aTable where x_integer = 5 and y_integer = NULL which gets translated to 0 when retriving from HBase. String query = "SELECT x_integer, y_integer FROM aTable WHERE ? = organization_id AND (x_integer, y_integer) IN ((5))"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -785,7 +786,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { // Though we have a row present in aTable where organization_id = tenantId and x_integer = 5, // we'd also need to have an entity_id that is null (which we don't have). String query = "SELECT organization_id, entity_id FROM aTable WHERE (organization_id, entity_id) IN (('" + tenantId + "')) AND x_integer = 5"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = null; PreparedStatement statement = null; @@ -813,7 +814,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) < (8.6, 4.5) AND (a_integer, x_integer) > (6.8, 4)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -840,7 +841,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { dateUpserted = new Date(dateUpserted.getTime() + 660); // this makes the dateUpserted equivalent to 2012-01-01 14:25:28.660 initATableValues(tenantId, getDefaultSplits(tenantId), dateUpserted, ts); String query = "SELECT a_integer, a_date FROM aTable WHERE ?=organization_id AND (a_integer, a_date) <= (9, ?) AND (a_integer, a_date) >= (6, ?)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -870,7 +871,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { @Test public void testRVCWithMultiCompKeysForIn() throws Exception { long ts = nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute("CREATE TABLE t (pk1 varchar, pk2 varchar, constraint pk primary key (pk1,pk2))"); @@ -896,7 +897,7 @@ public class RowValueConstructorIT extends BaseClientManagedTimeIT { } private Connection nextConnection(String url) throws SQLException { - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(nextTimestamp())); return DriverManager.getConnection(url, props); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java index 3b3a94c..fcb16e5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ScanQueryIT.java @@ -49,6 +49,7 @@ import java.util.Properties; import java.util.Set; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -75,7 +76,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testScan() throws Exception { String query = "SELECT a_string, /* comment ok? */ b_string FROM aTable WHERE ?=organization_id and 5=a_integer"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -94,7 +95,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testScanByByteValue() throws Exception { String query = "SELECT a_string, b_string, a_byte FROM aTable WHERE ?=organization_id and 1=a_byte"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -114,7 +115,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testScanByShortValue() throws Exception { String query = "SELECT a_string, b_string, a_short FROM aTable WHERE ?=organization_id and 128=a_short"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -134,7 +135,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testScanByFloatValue() throws Exception { String query = "SELECT a_string, b_string, a_float FROM aTable WHERE ?=organization_id and ?=a_float"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -155,7 +156,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testScanByUnsignedFloatValue() throws Exception { String query = "SELECT a_string, b_string, a_unsigned_float FROM aTable WHERE ?=organization_id and ?=a_unsigned_float"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -176,7 +177,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testScanByDoubleValue() throws Exception { String query = "SELECT a_string, b_string, a_double FROM aTable WHERE ?=organization_id and ?=a_double"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -197,7 +198,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testScanByUnsigned_DoubleValue() throws Exception { String query = "SELECT a_string, b_string, a_unsigned_double FROM aTable WHERE ?=organization_id and ?=a_unsigned_double"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -218,7 +219,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testAllScan() throws Exception { String query = "SELECT ALL a_string, b_string FROM aTable WHERE ?=organization_id and 5=a_integer"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -237,7 +238,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testDistinctScan() throws Exception { String query = "SELECT DISTINCT a_string FROM aTable WHERE organization_id=?"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -259,7 +260,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testDistinctLimitScan() throws Exception { String query = "SELECT DISTINCT a_string FROM aTable WHERE organization_id=? LIMIT 1"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -277,7 +278,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testInListSkipScan() throws Exception { String query = "SELECT entity_id, b_string FROM aTable WHERE organization_id=? and entity_id IN (?,?)"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -304,7 +305,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testUnboundRangeScan1() throws Exception { String query = "SELECT entity_id FROM aTable WHERE organization_id <= ?"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -338,7 +339,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testUnboundRangeScan2() throws Exception { String query = "SELECT entity_id FROM aTable WHERE organization_id >= ?"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -372,7 +373,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testUpperLowerBoundRangeScan() throws Exception { String query = "SELECT entity_id FROM aTable WHERE organization_id=? and substr(entity_id,1,3) > '00A' and substr(entity_id,1,3) < '00C'"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -396,7 +397,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testUpperBoundRangeScan() throws Exception { String query = "SELECT entity_id FROM aTable WHERE organization_id=? and substr(entity_id,1,3) >= '00B' "; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -422,7 +423,7 @@ public class ScanQueryIT extends QueryIT { @Test public void testLowerBoundRangeScan() throws Exception { String query = "SELECT entity_id FROM aTable WHERE organization_id=? and substr(entity_id,1,3) < '00B' "; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -448,7 +449,7 @@ public class ScanQueryIT extends QueryIT { public void testPointInTimeLimitedScan() throws Exception { // Override value that was set at creation time String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 1); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection upsertConn = DriverManager.getConnection(url, props); String upsertStmt = "upsert into " + http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java index 1dbdb52..0208d17 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java @@ -18,6 +18,7 @@ package org.apache.phoenix.end2end; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -38,10 +39,10 @@ import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.SequenceAlreadyExistsException; import org.apache.phoenix.schema.SequenceNotFoundException; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.SequenceUtil; -import org.apache.phoenix.util.TestUtil; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -692,7 +693,7 @@ public class SequenceIT extends BaseClientManagedTimeIT { private void nextConnection() throws Exception { if (conn != null) conn.close(); long ts = nextTimestamp(); - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); conn = DriverManager.getConnection(getUrl(), props); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java index f5b2aa6..d101fe3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java @@ -28,6 +28,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Properties; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -36,7 +37,7 @@ public class ServerExceptionIT extends BaseHBaseManagedTimeIT { @Test public void testServerExceptionBackToClient() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java index dd05d78..93abfb9 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java @@ -55,6 +55,7 @@ import org.apache.phoenix.schema.RowKeySchema.RowKeySchemaBuilder; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.ScanUtil; import org.junit.BeforeClass; @@ -105,7 +106,7 @@ public class SkipRangeParallelIteratorRegionSplitterIT extends BaseClientManaged long ts = nextTimestamp(); createTestTable(getUrl(),DDL,splits, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); TableRef tableRef = new TableRef(null,pconn.getMetaDataCache().getTable(new PTableKey(pconn.getTenantId(), TABLE_NAME)),ts, false); @@ -308,7 +309,7 @@ public class SkipRangeParallelIteratorRegionSplitterIT extends BaseClientManaged private void initTableValues() throws SQLException { String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + nextTimestamp(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); PreparedStatement stmt = conn.prepareStatement( "upsert into " + TABLE_NAME + " VALUES (?, ?)"); @@ -357,7 +358,7 @@ public class SkipRangeParallelIteratorRegionSplitterIT extends BaseClientManaged } }; - PhoenixConnection connection = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); + PhoenixConnection connection = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixStatement statement = new PhoenixStatement(connection); StatementContext context = new StatementContext(statement, resolver, scan, new SequenceManager(statement)); context.setScanRanges(scanRanges); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderFIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderFIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderFIT.java index 93ec8e1..8c8bbcc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderFIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SortOrderFIT.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.Properties; import org.apache.commons.lang.ArrayUtils; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -320,7 +321,7 @@ public class SortOrderFIT extends BaseHBaseManagedTimeIT { OrderBy orderBy) throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java index 825119b..3a0de85 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java @@ -34,6 +34,7 @@ import java.util.Properties; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.junit.BeforeClass; import org.junit.Test; @@ -75,7 +76,7 @@ public class SpillableGroupByIT extends BaseHBaseManagedTimeIT { } private void loadData(long ts) throws SQLException { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); int groupFactor = NUM_ROWS_INSERTED / 2; @@ -107,7 +108,7 @@ public class SpillableGroupByIT extends BaseHBaseManagedTimeIT { SpillableGroupByIT spGpByT = new SpillableGroupByIT(); long ts = spGpByT.createTable(); spGpByT.loadData(ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); Connection conn = DriverManager.getConnection(getUrl(), props); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatementHintsIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatementHintsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatementHintsIT.java index ea46cce..9c9f2c6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatementHintsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatementHintsIT.java @@ -28,6 +28,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Properties; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -40,7 +41,7 @@ import org.junit.experimental.categories.Category; public class StatementHintsIT extends BaseHBaseManagedTimeIT { private static void initTableValues() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); @@ -104,7 +105,7 @@ public class StatementHintsIT extends BaseHBaseManagedTimeIT { @Test public void testSelectForceRangeScan() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { initTableValues(); @@ -140,7 +141,7 @@ public class StatementHintsIT extends BaseHBaseManagedTimeIT { @Test public void testSelectForceSkipScan() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { initTableValues(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsManagerIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsManagerIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsManagerIT.java index 64ec1e6..f19f776 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsManagerIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsManagerIT.java @@ -33,6 +33,7 @@ import org.apache.phoenix.query.StatsManager; import org.apache.phoenix.query.StatsManagerImpl; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.TimeKeeper; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -118,7 +119,7 @@ public class StatsManagerIT extends BaseParallelIteratorsRegionSplitterIT { long ts = nextTimestamp(); initTableValues(ts); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); TableRef table = getTableRef(conn,ts); @@ -129,7 +130,7 @@ public class StatsManagerIT extends BaseParallelIteratorsRegionSplitterIT { ManualTimeKeeper timeKeeper = new ManualTimeKeeper(); timeKeeper.setCurrentTime(startTime); - ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES); + ConnectionQueryServices services = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)); StatsManager stats = new StatsManagerImpl(services, updateFreq, maxAge, timeKeeper); MinKeyChange minKeyChange = new MinKeyChange(stats, table); MaxKeyChange maxKeyChange = new MaxKeyChange(stats, table); @@ -142,7 +143,7 @@ public class StatsManagerIT extends BaseParallelIteratorsRegionSplitterIT { minKeyChange = new MinKeyChange(stats, table); url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts+2; - props = new Properties(TEST_PROPERTIES); + props = PropertiesUtil.deepCopy(TEST_PROPERTIES); conn = DriverManager.getConnection(url, props); PreparedStatement delStmt = conn.prepareStatement("delete from " + STABLE_NAME + " where id=?"); delStmt.setString(1, new String(KMIN)); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/StddevIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StddevIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StddevIT.java index c80fe4d..b4384f6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StddevIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StddevIT.java @@ -31,6 +31,7 @@ import java.sql.ResultSet; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @Category(ClientManagedTimeTest.class) @@ -44,7 +45,7 @@ public class StddevIT extends BaseClientManagedTimeIT { String query = "SELECT STDDEV_POP(A_INTEGER) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -69,7 +70,7 @@ public class StddevIT extends BaseClientManagedTimeIT { String query = "SELECT STDDEV_SAMP(x_decimal) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -94,7 +95,7 @@ public class StddevIT extends BaseClientManagedTimeIT { String query = "SELECT STDDEV_POP(x_decimal) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); @@ -119,7 +120,7 @@ public class StddevIT extends BaseClientManagedTimeIT { String query = "SELECT STDDEV_SAMP(x_decimal) FROM aTable"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at // timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java index d3e42b3..79aa6c1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java @@ -50,6 +50,7 @@ import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.TableAlreadyExistsException; import org.apache.phoenix.schema.TableNotFoundException; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.SchemaUtil; import org.apache.phoenix.util.StringUtil; import org.junit.Test; @@ -61,7 +62,7 @@ public class TenantSpecificTablesDDLIT extends BaseTenantSpecificTablesIT { @Test public void testCreateTenantSpecificTable() throws Exception { // ensure we didn't create a physical HBase table for the tenant-specific table - HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES).getAdmin(); + HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).getAdmin(); assertEquals(0, admin.listTables(TENANT_TABLE_NAME).length); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java index e809935..107ca34 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -30,7 +31,7 @@ import java.util.Properties; import org.apache.phoenix.schema.TableNotFoundException; import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.TestUtil; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -136,7 +137,7 @@ public class TenantSpecificTablesDMLIT extends BaseTenantSpecificTablesIT { } private Connection nextConnection(String url) throws SQLException { - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(nextTimestamp())); return DriverManager.getConnection(url, props); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java index 13d6bb7..10c34ee 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToCharFunctionIT.java @@ -38,6 +38,7 @@ import java.util.TimeZone; import org.apache.phoenix.expression.function.ToCharFunction; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -82,7 +83,7 @@ public class ToCharFunctionIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); createTestTable(getUrl(), TO_CHAR_TABLE_DDL, null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(false); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToNumberFunctionIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToNumberFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToNumberFunctionIT.java index b087985..9f415cf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToNumberFunctionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ToNumberFunctionIT.java @@ -36,6 +36,7 @@ import java.util.Properties; import org.apache.phoenix.expression.function.ToNumberFunction; import org.apache.phoenix.schema.PDataType; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -92,7 +93,7 @@ public class ToNumberFunctionIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); createTestTable(getUrl(), TO_NUMBER_TABLE_DDL, null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(false); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/TopNIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TopNIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TopNIT.java index e9b7298..8d3a706 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TopNIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TopNIT.java @@ -38,6 +38,7 @@ import java.sql.ResultSet; import java.util.Properties; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -50,7 +51,7 @@ public class TopNIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT entity_id FROM aTable ORDER BY b_string, entity_id LIMIT 5"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -80,7 +81,7 @@ public class TopNIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "SELECT entity_id FROM aTable ORDER BY b_string || entity_id desc LIMIT 5"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); try { @@ -119,7 +120,7 @@ public class TopNIT extends BaseClientManagedTimeIT { String tenantId = getOrganizationId(); initATableValues(tenantId, getDefaultSplits(tenantId), null, ts); String query = "DELETE FROM aTable ORDER BY b_string, entity_id LIMIT 5"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2 Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(autoCommit); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java index 2f043df..86a52d0 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java @@ -31,6 +31,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Properties; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -42,7 +43,7 @@ public class UpsertSelectAutoCommitIT extends BaseHBaseManagedTimeIT { @Test public void testAutoCommitUpsertSelect() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); conn.createStatement().execute("CREATE TABLE atable (ORGANIZATION_ID CHAR(15) NOT NULL, ENTITY_ID CHAR(15) NOT NULL, A_STRING VARCHAR\n" + http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 71e4152..a64371d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -27,6 +27,7 @@ import static org.apache.phoenix.util.TestUtil.ROW6; import static org.apache.phoenix.util.TestUtil.ROW7; import static org.apache.phoenix.util.TestUtil.ROW8; import static org.apache.phoenix.util.TestUtil.ROW9; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -46,6 +47,7 @@ import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.PDataType; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.TestUtil; @@ -750,7 +752,7 @@ public class UpsertSelectIT extends BaseClientManagedTimeIT { int numOfRecords = 200; long ts = nextTimestamp(); - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); String ddl = "CREATE TABLE IF NOT EXISTS DUMMY_CURSOR_STORAGE (" http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/VariableLengthPKIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/VariableLengthPKIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/VariableLengthPKIT.java index 0077383..460d417 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/VariableLengthPKIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/VariableLengthPKIT.java @@ -45,6 +45,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.schema.ConstraintViolationException; import org.apache.phoenix.util.DateUtil; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -68,7 +69,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { // Insert all rows at ts String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); PreparedStatement stmt = conn.prepareStatement( "upsert into " + @@ -95,7 +96,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { // Insert all rows at ts String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement( @@ -183,7 +184,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT A_STRING,substr(a_id,1,1),B_STRING,A_INTEGER,B_INTEGER FROM BTABLE WHERE A_STRING=?"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -207,7 +208,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT INST FROM PTSDB GROUP BY INST"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -226,7 +227,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT HOST FROM PTSDB WHERE INST='abc' GROUP BY HOST"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -245,7 +246,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT SUBSTR(INST,1,1),HOST FROM PTSDB GROUP BY SUBSTR(INST,1,1),HOST"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initGroupByRowKeyColumns(ts); @@ -268,7 +269,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT HOST FROM PTSDB WHERE INST='abc' AND DATE>=TO_DATE('1970-01-01 00:00:00') AND DATE =TO_DATE('1970-01-01 00:00:00') AND DATE =TO_DATE('1970-01-01 00:00:00') AND DATE ?"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -414,7 +415,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { // TODO: add compile test to confirm start/stop scan key String query = "SELECT A_STRING,substr(a_id,1,1),B_STRING,A_INTEGER,B_INTEGER FROM BTABLE WHERE A_STRING>? AND A_INTEGER>=?"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -441,7 +442,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { // Insert all rows at ts String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement("upsert into PTSDB VALUES ('', '', ?, 0.5)"); @@ -468,7 +469,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),PTSDB_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement("upsert into PTSDB VALUES (?, 'y', ?, 0.5)"); @@ -498,7 +499,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),PTSDB_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement("upsert into PTSDB VALUES (?, 'y', ?, 0.5)"); @@ -536,7 +537,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),PTSDB_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement("upsert into PTSDB VALUES ('x', 'y', ?, 0.5)"); @@ -552,7 +553,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { String query = "SELECT HOST,DATE FROM PTSDB WHERE INST='x' AND HOST='y'"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -569,7 +570,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),PTSDB2_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement("upsert into "+PTSDB2_NAME+"(inst,date,val2) VALUES (?, ?, ?)"); @@ -612,7 +613,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { + " GROUP BY ROUND(date,'day',1)" + " ORDER BY MAX(val2)"; // disambiguate row order String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -641,7 +642,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { + " ORDER BY inst,ROUND(date,'day',1)" ; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -686,7 +687,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { + " FROM "+PTSDB2_NAME + " WHERE inst='a'"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -704,7 +705,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); ensureTableCreated(getUrl(),PTSDB2_NAME,null, ts-2); Date d = new Date(ts); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); String query = "SELECT SUM(val1),SUM(val2),SUM(val3) FROM "+PTSDB2_NAME; String sql1 = "UPSERT INTO "+PTSDB2_NAME+"(inst,date,val1) VALUES (?, ?, ?)"; @@ -799,7 +800,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { String query = "SELECT * FROM PTSDB WHERE INST='x' AND HOST='y'"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -822,7 +823,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { String query = "SELECT HOST,TO_CHAR(DATE) FROM PTSDB WHERE INST='x' AND HOST='y'"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -843,7 +844,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { Format dateFormatter = DateUtil.getDateFormatter(format); String query = "SELECT HOST,TO_CHAR(DATE,'" + format + "') FROM PTSDB WHERE INST='x' AND HOST='y'"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -864,7 +865,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { Format dateFormatter = DateUtil.getDateFormatter(format); String query = "SELECT HOST,TO_CHAR(DATE,'" + format + "') FROM PTSDB WHERE INST='x' AND HOST='y' and DATE=TO_DATE(?,'" + format + "')"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -883,7 +884,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),PTSDB_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); Statement stmt = conn.createStatement(); @@ -903,7 +904,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),BTABLE_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement( @@ -923,7 +924,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),BTABLE_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement( @@ -951,7 +952,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),BTABLE_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); // Insert all rows at ts @@ -987,7 +988,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),BTABLE_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); // Insert all rows at ts @@ -1023,7 +1024,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),BTABLE_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); // Insert all rows at ts @@ -1060,7 +1061,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { ensureTableCreated(getUrl(),BTABLE_NAME,null, ts-2); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; // Insert at timestamp 0 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); // Insert all rows at ts @@ -1098,7 +1099,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT B_INTEGER,C_INTEGER,COUNT(1) FROM BTABLE GROUP BY C_INTEGER,B_INTEGER"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1133,7 +1134,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT C_INTEGER,COUNT(1) FROM BTABLE GROUP BY C_INTEGER"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1159,7 +1160,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { long ts = nextTimestamp(); String query = "SELECT A_ID, E_STRING, D_STRING, C_INTEGER, COUNT(1) FROM BTABLE GROUP BY A_ID, E_STRING, D_STRING, C_INTEGER"; String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1231,7 +1232,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length,result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1290,7 +1291,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length,result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1352,7 +1353,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length,result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1372,7 +1373,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { public void testRegexpSubstrFunction2() throws Exception { long ts = nextTimestamp(); String url = getUrl(); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(url, props); String ddl = "create table t (k INTEGER NOT NULL PRIMARY KEY, name VARCHAR)"; @@ -1425,7 +1426,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length,result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1460,7 +1461,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length,result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1483,7 +1484,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { // Insert all rows at ts String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); PreparedStatement stmt = conn.prepareStatement("upsert into PTSDB VALUES (?, ?, ?, 0.5)"); stmt.setDate(3, D1); @@ -1595,7 +1596,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { // Insert all rows at ts String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); conn.setAutoCommit(true); PreparedStatement stmt = conn.prepareStatement("upsert into PTSDB VALUES ('', '', ?, 0.5)"); @@ -1645,7 +1646,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length,result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1680,7 +1681,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length, result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1717,7 +1718,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length, result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1760,7 +1761,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length, result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1803,7 +1804,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length, result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -1936,7 +1937,7 @@ public class VariableLengthPKIT extends BaseClientManagedTimeIT { }; assertEquals(query.length, result.length); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); // Run query at timestamp 5 - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java index 917dd2e..f2a3578 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseMutableIndexIT.java @@ -28,6 +28,7 @@ import java.sql.SQLException; import java.util.Properties; import org.apache.phoenix.end2end.HBaseManagedTimeTest; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.TestUtil; import org.junit.experimental.categories.Category; @@ -55,7 +56,7 @@ public class BaseMutableIndexIT extends BaseIndexIT { " b.decimal_col2 DECIMAL, " + " b.date_col DATE " + " CONSTRAINT pk PRIMARY KEY (varchar_pk, char_pk, int_pk, long_pk DESC, decimal_pk))"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute(ddl); conn.close(); @@ -67,7 +68,7 @@ public class BaseMutableIndexIT extends BaseIndexIT { } // Populate the test table with data. protected static void populateTestTable(Date date) throws SQLException { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { String upsert = "UPSERT INTO " + DATA_TABLE_FULL_NAME http://git-wip-us.apache.org/repos/asf/phoenix/blob/48614937/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java index 7e94894..1a650f4 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java @@ -36,6 +36,7 @@ import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT; import org.apache.phoenix.end2end.HBaseManagedTimeTest; import org.apache.phoenix.end2end.Shadower; import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.SchemaUtil; import org.junit.BeforeClass; @@ -77,7 +78,7 @@ public class DropViewIT extends BaseMutableIndexIT { admin.close(); } - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute("create view " + HBASE_NATIVE + " (uint_key unsigned_int not null," + @@ -89,7 +90,7 @@ public class DropViewIT extends BaseMutableIndexIT { HColumnDescriptor.DATA_BLOCK_ENCODING + "='" + DataBlockEncoding.NONE + "'"); conn.createStatement().execute("drop view " + HBASE_NATIVE); - admin = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES).getAdmin(); + admin = driver.getConnectionQueryServices(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).getAdmin(); try { try { admin.disableTable(HBASE_NATIVE_BYTES);