http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java index 9128595..1d7ac92 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexIT.java @@ -39,6 +39,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.schema.PTableKey; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -47,7 +48,7 @@ import org.junit.experimental.categories.Category; public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { // Populate the test table with data. private static void populateTestTable() 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 " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE @@ -112,7 +113,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { @Test public void testIndexWithNullableFixedWithCols() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); ensureTableCreated(getUrl(), INDEX_DATA_TABLE); @@ -168,7 +169,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { ResultSet rs; String fullTableName = "T"; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); @@ -190,7 +191,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { @Test public void testDeleteFromAllPKColumnIndex() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); ensureTableCreated(getUrl(), INDEX_DATA_TABLE); @@ -245,7 +246,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { @Test public void testDropIfImmutableKeyValueColumn() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); ensureTableCreated(getUrl(), INDEX_DATA_TABLE); @@ -279,7 +280,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { @Test public void testGroupByCount() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); ensureTableCreated(getUrl(), INDEX_DATA_TABLE); @@ -298,7 +299,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { @Test public void testSelectDistinctOnTableWithSecondaryImmutableIndex() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); ensureTableCreated(getUrl(), INDEX_DATA_TABLE); populateTestTable(); String ddl = "CREATE INDEX IDX ON " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + INDEX_DATA_TABLE @@ -334,7 +335,7 @@ public class ImmutableIndexIT extends BaseHBaseManagedTimeIT { @Test public void testInClauseWithIndexOnColumnOfUsignedIntType() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = null; PreparedStatement stmt = null; ensureTableCreated(getUrl(), INDEX_DATA_TABLE);
http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java index 11c64f8..35232b5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java @@ -45,6 +45,7 @@ import org.apache.phoenix.schema.AmbiguousColumnException; import org.apache.phoenix.schema.PIndexState; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.PTableType; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.SchemaUtil; import org.apache.phoenix.util.StringUtil; import org.apache.phoenix.util.TestUtil; @@ -115,7 +116,7 @@ public class IndexMetadataIT extends BaseHBaseManagedTimeIT { @Test public void testIndexCreation() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -277,7 +278,7 @@ public class IndexMetadataIT extends BaseHBaseManagedTimeIT { public void testIndexDefinitionWithNullableFixedWidthColInPK() throws Exception { // If we have nullable fixed width column in the PK, we convert those types into a compatible variable type // column. The definition is defined in IndexUtil.getIndexColumnDataType. - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -335,7 +336,7 @@ public class IndexMetadataIT extends BaseHBaseManagedTimeIT { @Test public void testIndexDefinitionWithRepeatedColumns() throws Exception { // Test index creation when the columns is included in both the PRIMARY and INCLUDE section. Test de-duplication. - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -355,7 +356,7 @@ public class IndexMetadataIT extends BaseHBaseManagedTimeIT { @Test public void testIndexDefinitionWithSameColumnNamesInTwoFamily() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); String ddl = "create table test_table (char_pk varchar not null," http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/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 4a60f91..0601c2b 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 @@ -47,6 +47,7 @@ import org.apache.phoenix.query.ConnectionQueryServices; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.PIndexState; import org.apache.phoenix.schema.PTableType; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.SchemaUtil; import org.apache.phoenix.util.StringUtil; @@ -98,7 +99,7 @@ public class MutableIndexFailureIT extends BaseTest { } private static void destroyIndexTable() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = driver.connect(url, props); ConnectionQueryServices services = conn.unwrap(PhoenixConnection.class).getQueryServices(); HBaseAdmin admin = services.getAdmin(); @@ -116,7 +117,7 @@ public class MutableIndexFailureIT extends BaseTest { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = driver.connect(url, props); conn.setAutoCommit(false); conn.createStatement().execute( http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java index fed948b..5b3fb74 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java @@ -38,6 +38,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.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.TestUtil; @@ -66,7 +67,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { @Test public void testIndexWithNullableFixedWithCols() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -101,7 +102,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { @Test public void testIndexWithNullableDateCol() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -145,7 +146,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { @Test public void testCoveredColumnUpdates() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -231,7 +232,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); conn.createStatement().execute("CREATE TABLE " + DATA_TABLE_FULL_NAME + " (k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR, v2 VARCHAR)"); @@ -294,7 +295,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); conn.createStatement().execute("CREATE TABLE " + DATA_TABLE_FULL_NAME + " (k VARCHAR NOT NULL PRIMARY KEY, a.v1 VARCHAR, a.v2 VARCHAR, b.v1 VARCHAR) "); @@ -346,7 +347,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); conn.createStatement().execute("CREATE TABLE " + DATA_TABLE_FULL_NAME + " (k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR, v2 VARCHAR)"); @@ -439,7 +440,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); @@ -549,7 +550,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); @@ -623,7 +624,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); @@ -684,7 +685,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); @@ -764,7 +765,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -838,7 +839,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { @Test public void testInFilterOnIndexedTable() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -857,7 +858,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { @Test public void testIndexWithDecimalCol() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -894,7 +895,7 @@ public class MutableIndexIT extends BaseMutableIndexIT { @Test public void testUpsertingNullForIndexedColumns() 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/a411c7b2/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java index a46b170..b269cd1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java @@ -35,6 +35,7 @@ import org.apache.phoenix.end2end.Shadower; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.PTableKey; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; import org.junit.BeforeClass; @@ -63,7 +64,7 @@ public class SaltedIndexIT extends BaseIndexIT { } private static void makeImmutableAndDeleteData() throws Exception { - Connection conn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)); try { conn.setAutoCommit(true); conn.createStatement().execute("DELETE FROM " + DATA_TABLE_FULL_NAME); @@ -101,7 +102,7 @@ public class SaltedIndexIT extends BaseIndexIT { String query; ResultSet rs; - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); conn.createStatement().execute("CREATE TABLE IF NOT EXISTS " + DATA_TABLE_FULL_NAME + " (k VARCHAR NOT NULL PRIMARY KEY, v VARCHAR) " + (tableSaltBuckets == null ? "" : " SALT_BUCKETS=" + tableSaltBuckets)); http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java index 83e2a08..a1cf5d1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java @@ -34,6 +34,7 @@ import java.util.Properties; import org.apache.phoenix.end2end.BaseClientManagedTimeIT; import org.apache.phoenix.end2end.ClientManagedTimeTest; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -47,7 +48,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { private static void initTableValues(byte[][] splits, long ts) throws Exception { 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); // Rows we inserted: @@ -129,7 +130,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { public void testTableWithInvalidBucketNumber() throws Exception { long ts = nextTimestamp(); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { String query = "create table salted_table (a_integer integer not null CONSTRAINT pk PRIMARY KEY (a_integer)) SALT_BUCKETS = 257"; @@ -158,7 +159,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { public void testSelectValueNoWhereClause() throws Exception { long ts = nextTimestamp(); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -219,7 +220,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { public void testSelectValueWithFullyQualifiedWhereClause() throws Exception { long ts = nextTimestamp(); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -351,7 +352,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { public void testSelectValueWithNotFullyQualifiedWhereClause() throws Exception { long ts = nextTimestamp(); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -422,7 +423,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { public void testSelectWithGroupBy() throws Exception { long ts = nextTimestamp(); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -444,7 +445,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { public void testLimitScan() throws Exception { long ts = nextTimestamp(); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { initTableValues(null, ts); @@ -464,7 +465,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT { public void testSelectWithOrderByRowKey() throws Exception { long ts = nextTimestamp(); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 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/a411c7b2/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java index d5263ee..e6fe7d3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java @@ -31,6 +31,7 @@ import java.util.Properties; import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT; import org.apache.phoenix.end2end.HBaseManagedTimeTest; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -39,7 +40,7 @@ public class SaltedTableUpsertSelectIT extends BaseHBaseManagedTimeIT { @Test public void testUpsertIntoSaltedTableFromNormalTable() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -76,7 +77,7 @@ public class SaltedTableUpsertSelectIT extends BaseHBaseManagedTimeIT { @Test public void testUpsertIntoNormalTableFromSaltedTable() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -113,7 +114,7 @@ public class SaltedTableUpsertSelectIT extends BaseHBaseManagedTimeIT { @Test public void testUpsertSaltedTableIntoSaltedTable() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -150,7 +151,7 @@ public class SaltedTableUpsertSelectIT extends BaseHBaseManagedTimeIT { @Test public void testUpsertSelectOnSameSaltedTable() throws Exception { - Properties props = new Properties(TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { @@ -183,7 +184,7 @@ public class SaltedTableUpsertSelectIT extends BaseHBaseManagedTimeIT { @Test public void testUpsertSelectOnSameSaltedTableWithEmptyPKColumn() 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/a411c7b2/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java index 06142ec..ae696eb 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java @@ -31,6 +31,7 @@ import java.util.Properties; import org.apache.phoenix.end2end.BaseClientManagedTimeIT; import org.apache.phoenix.end2end.ClientManagedTimeTest; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -38,7 +39,7 @@ import org.junit.experimental.categories.Category; public class SaltedTableVarLengthRowKeyIT extends BaseClientManagedTimeIT { 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); @@ -66,7 +67,7 @@ public class SaltedTableVarLengthRowKeyIT extends BaseClientManagedTimeIT { @Test public void testSelectValueWithPointKeyQuery() 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/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/HavingCompilerTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/HavingCompilerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/HavingCompilerTest.java index 252068c..9c64264 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/HavingCompilerTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/HavingCompilerTest.java @@ -47,6 +47,7 @@ import org.apache.phoenix.jdbc.PhoenixPreparedStatement; import org.apache.phoenix.query.BaseConnectionlessQueryTest; import org.apache.phoenix.schema.PColumn; import org.apache.phoenix.schema.RowKeyValueAccessor; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.TestUtil; import org.junit.Test; @@ -63,7 +64,7 @@ public class HavingCompilerTest extends BaseConnectionlessQueryTest { } private static Expressions compileStatement(String query, List<Object> binds) throws SQLException { - PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); + PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); TestUtil.bindParams(pstmt, binds); QueryPlan plan = pstmt.compileQuery(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/JoinQueryCompilerTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/JoinQueryCompilerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/JoinQueryCompilerTest.java index 5a44331..95c869a 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/JoinQueryCompilerTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/JoinQueryCompilerTest.java @@ -39,6 +39,7 @@ import org.apache.phoenix.jdbc.PhoenixStatement; import org.apache.phoenix.parse.SQLParser; import org.apache.phoenix.parse.SelectStatement; import org.apache.phoenix.query.BaseConnectionlessQueryTest; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.junit.Test; @@ -72,7 +73,7 @@ public class JoinQueryCompilerTest extends BaseConnectionlessQueryTest { @Test public void testWhereClauseOptimization() throws Exception { - PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); + PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); String queryTemplate = "SELECT t1.\"item_id\", t2.\"item_id\", t3.\"item_id\" FROM " + JOIN_ITEM_TABLE_FULL_NAME + " t1 " + "%s JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " t2 ON t1.\"item_id\" = t2.\"item_id\" " + "%s JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " t3 ON t1.\"item_id\" = t3.\"item_id\" " http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/LimitCompilerTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/LimitCompilerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/LimitCompilerTest.java index 6ade2ad..cb0d4ef 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/LimitCompilerTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/LimitCompilerTest.java @@ -36,6 +36,7 @@ import org.apache.phoenix.jdbc.PhoenixPreparedStatement; import org.apache.phoenix.query.BaseConnectionlessQueryTest; import org.apache.phoenix.schema.PDataType; import org.apache.phoenix.util.ByteUtil; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.TestUtil; import org.junit.Test; @@ -43,7 +44,7 @@ import org.junit.Test; public class LimitCompilerTest extends BaseConnectionlessQueryTest { private static QueryPlan compileStatement(String query, List<Object> binds) throws SQLException { - PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); + PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); TestUtil.bindParams(pstmt, binds); return pstmt.compileQuery(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java index 2fef055..4745c44 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java @@ -57,9 +57,9 @@ import org.apache.phoenix.schema.PColumn; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.util.ByteUtil; import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; -import org.apache.phoenix.util.TestUtil; import org.junit.Test; @@ -83,7 +83,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { public void testParameterUnbound() throws Exception { try { String query = "SELECT a_string, b_string FROM atable WHERE organization_id=? and a_integer = ?"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -234,7 +234,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "SELECT count(1),a_integer FROM atable WHERE organization_id=? GROUP BY a_string"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -254,7 +254,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "SELECT sum(a_integer) + a_integer FROM atable WHERE organization_id=? GROUP BY a_string"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -274,7 +274,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "SELECT a_integer FROM atable WHERE organization_id=? AND count(1) > 2"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -294,7 +294,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "SELECT a_integer FROM atable WHERE organization_id=? HAVING count(1) > 2"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -314,7 +314,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "SELECT a_integer FROM atable WHERE organization_id=? HAVING a_integer = 5"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -334,7 +334,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "SELECT a_integer FROM atable WHERE organization_id=? HAVING CASE WHEN a_integer <= 2 THEN 'foo' WHEN a_integer = 3 THEN 2 WHEN a_integer <= 5 THEN 5 ELSE 5 END = 5"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -354,7 +354,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "SELECT a_integer FROM atable WHERE organization_id=? and CASE WHEN a_integer <= 2 THEN 'foo' WHEN a_integer = 3 THEN 'bar' WHEN a_integer <= 5 THEN 'bas' ELSE 'blah' END"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -428,7 +428,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { } private Scan compileQuery(String query, List<Object> binds) throws SQLException { - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PhoenixPreparedStatement statement = conn.prepareStatement(query).unwrap(PhoenixPreparedStatement.class); @@ -509,7 +509,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "upsert into ATABLE VALUES (?, ?, ?)"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -531,7 +531,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "upsert into ATABLE VALUES (?, ?, ?)"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -554,7 +554,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Select non agg column in aggregate query String query = "select * from ATABLE group by a_string"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -573,7 +573,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Order by in select with no limit or group by String query = "select a_string from ATABLE order by max(b_string)"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -592,7 +592,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Order by in select with no limit or group by String query = "select max(a_string) from ATABLE order by max(b_string),a_string"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -611,7 +611,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { try { // Order by in select with no limit or group by String query = "select max(a_string) from ATABLE order by b_string LIMIT 5"; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); @@ -706,7 +706,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { "SELECT entity_id,organization_id FROM atable where A_STRING - 45 < 0", "SELECT entity_id,organization_id FROM atable where A_STRING - 'transaction' < 0", }; - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); for (String query : queries) { try { @@ -728,7 +728,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT * from multi_cf G where RESPONSE_TIME = 2222"; 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); @@ -745,7 +745,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT F.RESPONSE_TIME,G.RESPONSE_TIME from multi_cf G where G.RESPONSE_TIME-1 = F.RESPONSE_TIME"; 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); @@ -762,7 +762,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT coalesce(x_integer,'foo') from atable"; 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); @@ -780,7 +780,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT distinct a_string,b_string from atable order by x_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 { PreparedStatement statement = conn.prepareStatement(query); @@ -798,7 +798,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT all distinct a_string,b_string from atable order by x_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 { PreparedStatement statement = conn.prepareStatement(query); @@ -816,7 +816,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT distinct count(1) from atable order by x_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 { PreparedStatement statement = conn.prepareStatement(query); @@ -834,7 +834,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT distinct a_string,count(*) from atable"; 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); @@ -878,7 +878,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest { long ts = nextTimestamp(); String query = "SELECT entity_id,a_string FROM atable where 2 || a_integer || ? like '2%'"; 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); byte []x=new byte[]{127,127,0,0};//Binary data try { http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java index 57c5774..73ba2a4 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java @@ -28,10 +28,10 @@ import java.sql.ParameterMetaData; import java.sql.PreparedStatement; import java.sql.ResultSetMetaData; -import org.junit.Test; - import org.apache.phoenix.query.BaseConnectionlessQueryTest; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.TestUtil; +import org.junit.Test; @@ -47,7 +47,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testNoParameterMetaData() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE organization_id='000000000000000'"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(0, pmd.getParameterCount()); @@ -56,7 +56,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testCaseInsensitive() throws Exception { String query = "SELECT A_string, b_striNG FROM ataBle WHERE ORGANIZATION_ID='000000000000000'"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(0, pmd.getParameterCount()); @@ -65,7 +65,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testParameterMetaData() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE organization_id=? and (a_integer = ? or a_date = ? or b_string = ? or a_string = 'foo')"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(4, pmd.getParameterCount()); @@ -78,7 +78,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testUpsertParameterMetaData() throws Exception { String query = "UPSERT INTO atable VALUES (?, ?, ?, ?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(5, pmd.getParameterCount()); @@ -92,7 +92,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testToDateFunctionMetaData() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE a_date > to_date(?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -102,7 +102,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testLimitParameterMetaData() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE organization_id=? and a_string = 'foo' LIMIT ?"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -113,7 +113,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testRoundParameterMetaData() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE round(a_date,'day', ?) = ?"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -124,7 +124,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testInListParameterMetaData1() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE a_string IN (?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -135,7 +135,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testInListParameterMetaData2() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE ? IN (2.2, 3)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -145,7 +145,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testInListParameterMetaData3() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE ? IN ('foo')"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -155,7 +155,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testInListParameterMetaData4() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE ? IN (?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(3, pmd.getParameterCount()); @@ -167,7 +167,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testCaseMetaData() throws Exception { String query1 = "SELECT a_string, b_string FROM atable WHERE case when a_integer = 1 then ? when a_integer > 2 then 2 end > 3"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query1); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -185,7 +185,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testSubstrParameterMetaData() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE substr(a_string,?,?) = ?"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(3, pmd.getParameterCount()); @@ -197,7 +197,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testKeyPrefixParameterMetaData() throws Exception { String query = "SELECT a_string, b_string FROM atable WHERE organization_id='000000000000000' and substr(entity_id,1,3)=? and a_string = 'foo'"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -207,7 +207,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testDateSubstractExpressionMetaData1() throws Exception { String query = "SELECT entity_id,a_string FROM atable where a_date-2.5-?=a_date"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -217,7 +217,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testDateSubstractExpressionMetaData2() throws Exception { String query = "SELECT entity_id,a_string FROM atable where a_date-?=a_date"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -230,7 +230,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testDateSubstractExpressionMetaData3() throws Exception { String query = "SELECT entity_id,a_string FROM atable where a_date-?=a_integer"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -243,7 +243,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testTwoDateSubstractExpressionMetaData() throws Exception { String query = "SELECT entity_id,a_string FROM atable where ?-a_date=1"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -254,7 +254,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testDateAdditionExpressionMetaData1() throws Exception { String query = "SELECT entity_id,a_string FROM atable where 1+a_date+?>a_date"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -264,7 +264,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testDateAdditionExpressionMetaData2() throws Exception { String query = "SELECT entity_id,a_string FROM atable where ?+a_date>a_date"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(1, pmd.getParameterCount()); @@ -276,7 +276,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { String[] ops = { "+", "-", "*", "/" }; for (String op : ops) { String query = "SELECT entity_id,a_string FROM atable where a_integer" + op + "2.5" + op + "?=0"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); statement.setInt(1, 4); ParameterMetaData pmd = statement.getParameterMetaData(); @@ -290,7 +290,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { String[] ops = { "+", "-", "*", "/" }; for (String op : ops) { String query = "SELECT entity_id,a_string FROM atable where a_integer" + op + "2" + op + "?=0"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); statement.setInt(1, 4); ParameterMetaData pmd = statement.getParameterMetaData(); @@ -302,7 +302,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testBasicResultSetMetaData() throws Exception { String query = "SELECT organization_id, a_string, b_string, a_integer i, a_date FROM atable WHERE organization_id='000000000000000' and substr(entity_id,1,3)=? and a_string = 'foo'"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ResultSetMetaData md = statement.getMetaData(); assertEquals(5, md.getColumnCount()); @@ -331,7 +331,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testStringConcatMetaData() throws Exception { String query = "SELECT entity_id,a_string FROM atable where 2 || a_integer || ? like '2%'"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, "foo"); ParameterMetaData pmd = statement.getParameterMetaData(); @@ -343,7 +343,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testRowValueConstructorBindParamMetaData() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE (a_integer, x_integer, a_string) = (?, ?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(3, pmd.getParameterCount()); @@ -355,7 +355,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testRowValueConstructorBindParamMetaDataWithMoreNumberOfBindArgs() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE (a_integer, x_integer) = (?, ?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(3, pmd.getParameterCount()); @@ -367,7 +367,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testRowValueConstructorBindParamMetaDataWithLessNumberOfBindArgs() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE (a_integer, x_integer, a_string) = (?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -378,7 +378,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testRowValueConstructorBindParamMetaDataWithBindArgsAtSamePlacesOnLHSRHS() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE (a_integer, ?) = (a_integer, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -389,7 +389,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testRowValueConstructorBindParamMetaDataWithBindArgsAtDiffPlacesOnLHSRHS() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE (a_integer, ?) = (?, a_integer)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -400,7 +400,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { // @Test broken currently, as we'll end up with null = 7 which is never true public void testRowValueConstructorBindParamMetaDataWithBindArgsOnLHSAndLiteralExprOnRHS() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE (?, ?) = 7"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -411,7 +411,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testRowValueConstructorBindParamMetaDataWithBindArgsOnRHSAndLiteralExprOnLHS() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE 7 = (?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -422,7 +422,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testNonEqualityRowValueConstructorBindParamMetaDataWithBindArgsOnRHSAndLiteralExprOnLHS() throws Exception { String query = "SELECT a_integer, x_integer FROM aTable WHERE 7 >= (?, ?)"; - Connection conn = DriverManager.getConnection(getUrl(), TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(2, pmd.getParameterCount()); @@ -433,7 +433,7 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest { @Test public void testBindParamMetaDataForNestedRVC() throws Exception { String query = "SELECT organization_id, entity_id, a_string FROM aTable WHERE (organization_id, (entity_id, a_string)) >= (?, (?, ?))"; - Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, TestUtil.TEST_PROPERTIES); + Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES)); PreparedStatement statement = conn.prepareStatement(query); ParameterMetaData pmd = statement.getParameterMetaData(); assertEquals(3, pmd.getParameterCount()); http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/SelectStatementRewriterTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/SelectStatementRewriterTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/SelectStatementRewriterTest.java index 7d3b669..f7b6ffd 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/SelectStatementRewriterTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/SelectStatementRewriterTest.java @@ -33,13 +33,14 @@ import org.apache.hadoop.hbase.filter.Filter; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixPreparedStatement; import org.apache.phoenix.query.BaseConnectionlessQueryTest; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; public class SelectStatementRewriterTest extends BaseConnectionlessQueryTest { private static Filter compileStatement(String query) throws SQLException { - PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); + PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); QueryPlan plan = pstmt.compileQuery(); return plan.getContext().getScan().getFilter(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java index 04b787d..55885e1 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java @@ -36,6 +36,7 @@ import org.apache.phoenix.filter.SkipScanFilter; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixPreparedStatement; import org.apache.phoenix.query.BaseConnectionlessQueryTest; +import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.TestUtil; import org.junit.Test; @@ -65,7 +66,7 @@ public class StatementHintsCompilationTest extends BaseConnectionlessQueryTest { } private static StatementContext compileStatement(String query, List<Object> binds, Integer limit) throws SQLException { - PhoenixConnection pconn = DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class); + PhoenixConnection pconn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)).unwrap(PhoenixConnection.class); PhoenixPreparedStatement pstmt = new PhoenixPreparedStatement(pconn, query); TestUtil.bindParams(pstmt, binds); QueryPlan plan = pstmt.compileQuery(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/a411c7b2/phoenix-core/src/test/java/org/apache/phoenix/compile/ViewCompilerTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/ViewCompilerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/ViewCompilerTest.java index 0e8dd8a..d2822a8 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/ViewCompilerTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/ViewCompilerTest.java @@ -17,6 +17,7 @@ */ package org.apache.phoenix.compile; +import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -31,7 +32,7 @@ import org.apache.phoenix.schema.ColumnNotFoundException; import org.apache.phoenix.schema.PTable; import org.apache.phoenix.schema.PTable.ViewType; import org.apache.phoenix.schema.PTableType; -import org.apache.phoenix.util.TestUtil; +import org.apache.phoenix.util.PropertiesUtil; import org.junit.Test; public class ViewCompilerTest extends BaseConnectionlessQueryTest { @@ -52,7 +53,7 @@ public class ViewCompilerTest extends BaseConnectionlessQueryTest { } public void assertViewType(String[] views, ViewType viewType) throws Exception { - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class); String ct = "CREATE TABLE t (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))"; conn.createStatement().execute(ct); @@ -74,7 +75,7 @@ public class ViewCompilerTest extends BaseConnectionlessQueryTest { @Test public void testViewInvalidation() throws Exception { - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class); String ct = "CREATE TABLE t (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))"; conn.createStatement().execute(ct); @@ -100,7 +101,7 @@ public class ViewCompilerTest extends BaseConnectionlessQueryTest { @Test public void testInvalidUpsertSelect() throws Exception { - Properties props = new Properties(TestUtil.TEST_PROPERTIES); + Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); PhoenixConnection conn = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class); conn.createStatement().execute("CREATE TABLE t1 (k1 INTEGER NOT NULL, k2 VARCHAR, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2))"); conn.createStatement().execute("CREATE TABLE t2 (k3 INTEGER NOT NULL, v VARCHAR, CONSTRAINT pk PRIMARY KEY (k3))");