phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [7/7] git commit: PHOENIX-982 Avoid spinning up and tearing down mini cluster in tests (SamarthJain)
Date Fri, 16 May 2014 19:56:02 GMT
PHOENIX-982 Avoid spinning up and tearing down mini cluster in tests (SamarthJain)


Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/2f28db53
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/2f28db53
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/2f28db53

Branch: refs/heads/4.0
Commit: 2f28db537ce6f7280286b8f3925c28619ae7a20a
Parents: e3e289a
Author: James Taylor <jamestaylor@apache.org>
Authored: Fri May 16 12:55:23 2014 -0700
Committer: James Taylor <jamestaylor@apache.org>
Committed: Fri May 16 12:55:23 2014 -0700

----------------------------------------------------------------------
 .../apache/phoenix/end2end/AlterTableIT.java    |    4 +-
 .../phoenix/end2end/ArithmeticQueryIT.java      |   11 +-
 .../org/apache/phoenix/end2end/ArrayIT.java     |  108 +-
 .../apache/phoenix/end2end/AutoCommitIT.java    |   14 +-
 .../end2end/BaseClientManagedTimeIT.java        |   97 +-
 .../phoenix/end2end/BaseConnectedQueryIT.java   |  763 -----
 .../phoenix/end2end/BaseHBaseManagedTimeIT.java |   87 +-
 .../BaseParallelIteratorsRegionSplitterIT.java  |    6 +-
 .../end2end/BaseTenantSpecificTablesIT.java     |    3 +
 .../org/apache/phoenix/end2end/BaseViewIT.java  |    7 +-
 .../apache/phoenix/end2end/BinaryRowKeyIT.java  |   13 +-
 .../phoenix/end2end/CSVCommonsLoaderIT.java     |    2 +
 .../apache/phoenix/end2end/CaseStatementIT.java |  287 ++
 .../apache/phoenix/end2end/CastAndCoerceIT.java |  167 ++
 .../phoenix/end2end/ClientManagedTimeTest.java  |   44 +
 .../end2end/ClientTimeArithmeticQueryIT.java    |  599 ++++
 .../phoenix/end2end/CoalesceFunctionIT.java     |   18 +-
 .../end2end/ColumnProjectionOptimizationIT.java |   32 +-
 .../phoenix/end2end/CompareDecimalToLongIT.java |   15 +-
 .../ConnectionQueryServicesTestImpl.java        |   79 +-
 .../apache/phoenix/end2end/CreateTableIT.java   |    2 +
 .../phoenix/end2end/CustomEntityDataIT.java     |   22 +-
 ...efaultParallelIteratorsRegionSplitterIT.java |    3 +
 .../org/apache/phoenix/end2end/DeleteIT.java    |    2 +
 .../apache/phoenix/end2end/DerivedTableIT.java  |    2 +
 .../apache/phoenix/end2end/DistinctCountIT.java |   29 +-
 .../apache/phoenix/end2end/DynamicColumnIT.java |    2 +
 .../apache/phoenix/end2end/DynamicFamilyIT.java |    2 +
 .../apache/phoenix/end2end/DynamicUpsertIT.java |   20 +-
 .../phoenix/end2end/ExecuteStatementsIT.java    |    7 +-
 .../phoenix/end2end/ExtendedQueryExecIT.java    |   19 +-
 .../apache/phoenix/end2end/FunkyNamesIT.java    |   19 +-
 .../apache/phoenix/end2end/GroupByCaseIT.java   |    6 +-
 .../org/apache/phoenix/end2end/GroupByIT.java   |  562 ++++
 .../phoenix/end2end/HBaseManagedTimeTest.java   |   45 +
 .../org/apache/phoenix/end2end/HashJoinIT.java  |   16 +-
 .../phoenix/end2end/InMemoryOrderByIT.java      |    9 +-
 .../org/apache/phoenix/end2end/IsNullIT.java    |    3 +-
 .../org/apache/phoenix/end2end/KeyOnlyIT.java   |    6 +-
 .../apache/phoenix/end2end/MD5FunctionIT.java   |    2 +
 .../phoenix/end2end/MultiCfQueryExecIT.java     |   15 +-
 .../phoenix/end2end/NativeHBaseTypesIT.java     |    2 +
 .../end2end/NeedsOwnMiniClusterTest.java        |   46 +
 .../org/apache/phoenix/end2end/NotQueryIT.java  |  303 ++
 .../org/apache/phoenix/end2end/OrderByIT.java   |    5 +-
 .../apache/phoenix/end2end/PercentileIT.java    |   32 +-
 .../phoenix/end2end/ProductMetricsIT.java       |   10 +-
 .../end2end/QueryDatabaseMetaDataIT.java        |    3 +-
 .../phoenix/end2end/QueryExecWithoutSCNIT.java  |   16 +-
 .../org/apache/phoenix/end2end/QueryIT.java     | 2600 ++----------------
 .../org/apache/phoenix/end2end/QueryPlanIT.java |    7 +-
 .../phoenix/end2end/ReadIsolationLevelIT.java   |   18 +-
 .../phoenix/end2end/ReverseFunctionIT.java      |    2 +
 .../RoundFloorCeilFunctionsEnd2EndIT.java       |    8 +-
 .../phoenix/end2end/RowValueConstructorIT.java  |    2 +
 .../apache/phoenix/end2end/SaltedViewIT.java    |    2 +
 .../org/apache/phoenix/end2end/ScanQueryIT.java |  498 ++++
 .../org/apache/phoenix/end2end/SequenceIT.java  |    7 +-
 .../phoenix/end2end/ServerExceptionIT.java      |    3 +-
 .../org/apache/phoenix/end2end/Shadower.java    |   41 +
 ...ipRangeParallelIteratorRegionSplitterIT.java |    5 +-
 .../apache/phoenix/end2end/SkipScanQueryIT.java |    2 +
 .../apache/phoenix/end2end/SortOrderFIT.java    |    3 +
 .../phoenix/end2end/SpillableGroupByIT.java     |    9 +-
 .../phoenix/end2end/SpooledOrderByIT.java       |    9 +-
 .../phoenix/end2end/StatementHintsIT.java       |   14 +-
 .../apache/phoenix/end2end/StatsManagerIT.java  |    3 +
 .../org/apache/phoenix/end2end/StddevIT.java    |   15 +-
 .../end2end/TenantSpecificTablesDDLIT.java      |    2 +
 .../end2end/TenantSpecificTablesDMLIT.java      |    2 +
 .../end2end/TenantSpecificViewIndexIT.java      |    2 +
 .../TenantSpecificViewIndexSaltedIT.java        |    2 +
 .../phoenix/end2end/ToCharFunctionIT.java       |    6 +-
 .../phoenix/end2end/ToNumberFunctionIT.java     |    8 +-
 .../java/org/apache/phoenix/end2end/TopNIT.java |    5 +-
 .../phoenix/end2end/TruncateFunctionIT.java     |    2 +
 .../phoenix/end2end/UpsertBigValuesIT.java      |   12 +-
 .../end2end/UpsertSelectAutoCommitIT.java       |    2 +
 .../apache/phoenix/end2end/UpsertSelectIT.java  |    3 +-
 .../apache/phoenix/end2end/UpsertValuesIT.java  |    3 +-
 .../phoenix/end2end/VariableLengthPKIT.java     |    2 +
 .../java/org/apache/phoenix/end2end/ViewIT.java |    2 +
 .../phoenix/end2end/index/BaseIndexIT.java      |    3 +
 .../end2end/index/BaseMutableIndexIT.java       |    3 +
 .../phoenix/end2end/index/DropViewIT.java       |    5 +-
 .../phoenix/end2end/index/ImmutableIndexIT.java |    4 +-
 .../phoenix/end2end/index/IndexMetadataIT.java  |    4 +-
 .../end2end/index/MutableIndexFailureIT.java    |  108 +-
 .../phoenix/end2end/index/MutableIndexIT.java   |   12 +-
 .../phoenix/end2end/index/SaltedIndexIT.java    |   11 +-
 .../phoenix/end2end/salted/SaltedTableIT.java   |    6 +-
 .../salted/SaltedTableUpsertSelectIT.java       |    4 +-
 .../salted/SaltedTableVarLengthRowKeyIT.java    |    8 +-
 .../FailForUnsupportedHBaseVersionsIT.java      |   99 +-
 .../EndToEndCoveredColumnsIndexBuilderIT.java   |    8 +-
 .../example/EndToEndCoveredIndexingIT.java      |    9 +-
 .../EndtoEndIndexingWithCompressionIT.java      |   13 +-
 .../covered/example/FailWithoutRetriesIT.java   |    8 +-
 .../phoenix/mapreduce/CsvBulkLoadToolIT.java    |   29 +-
 .../org/apache/phoenix/jdbc/PhoenixDriver.java  |    7 +-
 .../phoenix/query/BaseQueryServicesImpl.java    |    1 +
 .../index/write/TestWALRecoveryCaching.java     |    5 +
 .../apache/phoenix/jdbc/PhoenixTestDriver.java  |   46 +-
 .../query/BaseConnectionlessQueryTest.java      |   27 +-
 .../java/org/apache/phoenix/query/BaseTest.java |  950 ++++++-
 .../phoenix/query/QueryServicesTestImpl.java    |   12 +-
 .../org/apache/phoenix/flume/PhoenixSinkIT.java |    8 +-
 .../phoenix/flume/RegexEventSerializerIT.java   |    9 +-
 .../phoenix/pig/PhoenixHBaseLoaderIT.java       |   11 +-
 .../phoenix/pig/PhoenixHBaseStorerIT.java       |   38 +-
 .../phoenix/pig/PhoenixPigConfigurationIT.java  |    3 +
 pom.xml                                         |   62 +-
 112 files changed, 4762 insertions(+), 3618 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
index 70b3d9a..b822108 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java
@@ -47,9 +47,9 @@ import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.IndexUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-
-
+@Category(HBaseManagedTimeTest.class)
 public class AlterTableIT extends BaseHBaseManagedTimeIT {
     public static final String SCHEMA_NAME = "";
     public static final String DATA_TABLE_NAME = "T";

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
index 84cdc2f..4874174 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArithmeticQueryIT.java
@@ -34,11 +34,12 @@ import java.util.Properties;
 
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import com.google.common.primitives.Doubles;
 import com.google.common.primitives.Floats;
 
-
+@Category(HBaseManagedTimeTest.class)
 public class ArithmeticQueryIT extends BaseHBaseManagedTimeIT {
 
     @Test
@@ -524,7 +525,7 @@ public class ArithmeticQueryIT extends BaseHBaseManagedTimeIT {
     }
     @Test
     public void testSumDouble() throws Exception {
-        initSumDoubleValues(null);
+        initSumDoubleValues(null, getUrl());
         String query = "SELECT SUM(d) FROM SumDoubleTest";
         Properties props = new Properties(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
@@ -541,7 +542,7 @@ public class ArithmeticQueryIT extends BaseHBaseManagedTimeIT {
     
     @Test
     public void testSumUnsignedDouble() throws Exception {
-        initSumDoubleValues(null);
+        initSumDoubleValues(null, getUrl());
         String query = "SELECT SUM(ud) FROM SumDoubleTest";
         Properties props = new Properties(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
@@ -558,7 +559,7 @@ public class ArithmeticQueryIT extends BaseHBaseManagedTimeIT {
     
     @Test
     public void testSumFloat() throws Exception {
-        initSumDoubleValues(null);
+        initSumDoubleValues(null, getUrl());
         String query = "SELECT SUM(f) FROM SumDoubleTest";
         Properties props = new Properties(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
@@ -575,7 +576,7 @@ public class ArithmeticQueryIT extends BaseHBaseManagedTimeIT {
     
     @Test
     public void testSumUnsignedFloat() throws Exception {
-        initSumDoubleValues(null);
+        initSumDoubleValues(null, getUrl());
         String query = "SELECT SUM(uf) FROM SumDoubleTest";
         Properties props = new Properties(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
index 2c44ec6..7b13447 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java
@@ -43,9 +43,11 @@ import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.StringUtil;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import com.google.common.primitives.Floats;
 
+@Category(ClientManagedTimeTest.class)
 public class ArrayIT extends BaseClientManagedTimeIT {
 
 	private static final String SIMPLE_TABLE_WITH_ARRAY = "SIMPLE_TABLE_WITH_ARRAY";
@@ -54,9 +56,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testScanByArrayValue() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM table_with_array WHERE ?=organization_id and ?=a_float";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -90,9 +92,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testScanWithArrayInWhereClause() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM table_with_array WHERE ?=organization_id and ?=a_byte_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -130,9 +132,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testScanWithNonFixedWidthArrayInWhereClause() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM table_with_array WHERE ?=organization_id and ?=a_string_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -172,9 +174,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testScanWithNonFixedWidthArrayInSelectClause() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_string_array FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -203,9 +205,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 			throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT ARRAY_ELEM(a_double_array,2) FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -231,9 +233,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testSelectSpecificIndexOfAnArray() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_double_array[3] FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -258,9 +260,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testCaseWithArray() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(),
+        createTableWithArray(getUrl(),
                 getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT CASE WHEN A_INTEGER = 1 THEN a_double_array ELSE null END [3] FROM table_with_array";
         Properties props = new Properties(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -285,7 +287,7 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testUpsertValuesWithArray() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+        createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
         String query = "upsert into table_with_array(ORGANIZATION_ID,ENTITY_ID,a_double_array) values('" + tenantId
                 + "','00A123122312312',ARRAY[2.0d,345.8d])";
         Properties props = new Properties(TEST_PROPERTIES);
@@ -323,10 +325,10 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testUpsertSelectWithSelectAsSubQuery1() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+        createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
         Connection conn = null;
         try {
-            createSimpleTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+            createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
             initSimpleArrayTable(tenantId, null, ts, false);
             Properties props = new Properties(TEST_PROPERTIES);
             props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
@@ -366,8 +368,8 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testSelectWithArrayWithColumnRef() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT a_integer,ARRAY[1,2,a_integer] FROM table_with_array where organization_id =  '"
                 + tenantId + "'";
         Properties props = new Properties(TEST_PROPERTIES);
@@ -397,8 +399,8 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testSelectWithArrayWithColumnRefWithVarLengthArray() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT b_string,ARRAY['abc','defgh',b_string] FROM table_with_array where organization_id =  '"
                 + tenantId + "'";
         Properties props = new Properties(TEST_PROPERTIES);
@@ -428,8 +430,8 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testSelectWithArrayWithColumnRefWithVarLengthArrayWithNullValue() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT b_string,ARRAY['abc',null,'bcd',null,null,b_string] FROM table_with_array where organization_id =  '"
                 + tenantId + "'";
         Properties props = new Properties(TEST_PROPERTIES);
@@ -462,10 +464,10 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testUpsertSelectWithColumnRef() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+        createTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
         Connection conn = null;
         try {
-            createSimpleTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+            createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
             initSimpleArrayTable(tenantId, null, ts, false);
             Properties props = new Properties(TEST_PROPERTIES);
             props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at timestamp 2
@@ -505,7 +507,7 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testCharArraySpecificIndex() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createSimpleTableWithArray(BaseConnectedQueryIT.getUrl(), getDefaultSplits(tenantId), null, ts - 2);
+        createSimpleTableWithArray(getUrl(), getDefaultSplits(tenantId), null, ts - 2);
         initSimpleArrayTable(tenantId, null, ts, false);
         String query = "SELECT a_char_array[2] FROM SIMPLE_TABLE_WITH_ARRAY";
         Properties props = new Properties(TEST_PROPERTIES);
@@ -703,9 +705,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testSelectArrayUsingUpsertLikeSyntax() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_double_array FROM TABLE_WITH_ARRAY WHERE a_double_array = ARRAY [ 25.343d, 36.763d, 37.56d,386.63d]";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -733,9 +735,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testArrayIndexUsedInWhereClause() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		int a_index = 0;
 		String query = "SELECT a_double_array[2] FROM table_with_array where a_double_array["+a_index+"2]<?";
 		Properties props = new Properties(TEST_PROPERTIES);
@@ -765,9 +767,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testArrayIndexUsedInGroupByClause() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_double_array[2] FROM table_with_array  GROUP BY a_double_array[2]";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -794,9 +796,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testVariableLengthArrayWithNullValue() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, true);
+		initTablesWithArrays(tenantId, null, ts, true, getUrl());
 		String query = "SELECT a_string_array[2] FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -819,9 +821,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testSelectSpecificIndexOfAVariableArrayAlongWithAnotherColumn1() throws Exception {
 	    long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(),
+        createTableWithArray(getUrl(),
                 getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT a_string_array[3],A_INTEGER FROM table_with_array";
         Properties props = new Properties(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -847,9 +849,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testSelectSpecificIndexOfAVariableArrayAlongWithAnotherColumn2() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(),
+        createTableWithArray(getUrl(),
                 getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT A_INTEGER, a_string_array[3] FROM table_with_array";
         Properties props = new Properties(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -875,9 +877,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testSelectMultipleArrayColumns() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(),
+        createTableWithArray(getUrl(),
                 getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT  a_string_array[3], a_double_array[2] FROM table_with_array";
         Properties props = new Properties(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -905,9 +907,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testSelectSameArrayColumnMultipleTimesWithDifferentIndices() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(),
+        createTableWithArray(getUrl(),
                 getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT a_string_array[1], a_string_array[3] FROM table_with_array";
         Properties props = new Properties(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -934,9 +936,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testSelectSameArrayColumnMultipleTimesWithSameIndices() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(),
+        createTableWithArray(getUrl(),
                 getDefaultSplits(tenantId), null, ts - 2);
-        initTablesWithArrays(tenantId, null, ts, false);
+        initTablesWithArrays(tenantId, null, ts, false, getUrl());
         String query = "SELECT a_string_array[3], a_string_array[3] FROM table_with_array";
         Properties props = new Properties(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -962,9 +964,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testSelectSpecificIndexOfAVariableArray() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_string_array[3] FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -988,9 +990,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testWithOutOfRangeIndex() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT a_double_array[100] FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -1016,9 +1018,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testArrayLengthFunctionForVariableLength() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT ARRAY_LENGTH(a_string_array) FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -1041,9 +1043,9 @@ public class ArrayIT extends BaseClientManagedTimeIT {
 	public void testArrayLengthFunctionForFixedLength() throws Exception {
 		long ts = nextTimestamp();
 		String tenantId = getOrganizationId();
-		createTableWithArray(BaseConnectedQueryIT.getUrl(),
+		createTableWithArray(getUrl(),
 				getDefaultSplits(tenantId), null, ts - 2);
-		initTablesWithArrays(tenantId, null, ts, false);
+		initTablesWithArrays(tenantId, null, ts, false, getUrl());
 		String query = "SELECT ARRAY_LENGTH(a_double_array) FROM table_with_array";
 		Properties props = new Properties(TEST_PROPERTIES);
 		props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
@@ -1065,7 +1067,7 @@ public class ArrayIT extends BaseClientManagedTimeIT {
     public void testArraySizeRoundtrip() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        createTableWithArray(BaseConnectedQueryIT.getUrl(),
+        createTableWithArray(getUrl(),
                 getDefaultSplits(tenantId), null, ts - 2);
         Properties props = new Properties(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoCommitIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoCommitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoCommitIT.java
index 0f4f642..b117ced 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoCommitIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AutoCommitIT.java
@@ -17,15 +17,21 @@
  */
 package org.apache.phoenix.end2end;
 
-import static org.apache.phoenix.util.TestUtil.*;
-import static org.junit.Assert.*;
+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;
 
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.util.Properties;
 
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-
+@Category(HBaseManagedTimeTest.class)
 public class AutoCommitIT extends BaseHBaseManagedTimeIT {
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseClientManagedTimeIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseClientManagedTimeIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseClientManagedTimeIT.java
index 61e2762..7590a31 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseClientManagedTimeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseClientManagedTimeIT.java
@@ -17,25 +17,104 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Date;
+
+import javax.annotation.concurrent.NotThreadSafe;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.experimental.categories.Category;
 
 /**
- * 
  * Base class for tests that manage their own time stamps
- * We need to separate these from tests that manged the time stamp
- * themselves, because we create/destroy the Phoenix tables
+ * We need to separate these from tests that rely on hbase to set
+ * timestamps, because we create/destroy the Phoenix tables
  * between tests and only allow a table time stamp to increase.
- * If we let HBase set the time stamps, then our client time stamps
- * will usually be smaller than these time stamps and the table
- * deletion/creation would fail.
+ * Without this separation table deletion/creation would fail.
  * 
+ * All tests extending this class use the mini cluster that is
+ * different from the mini cluster used by test classes extending 
+ * {@link BaseHBaseManagedTimeIT}.
  * 
  * @since 0.1
  */
-public abstract class BaseClientManagedTimeIT extends BaseConnectedQueryIT {
+@NotThreadSafe
+@Category(ClientManagedTimeTest.class)
+public abstract class BaseClientManagedTimeIT extends BaseTest {
+    private static String url;
+    protected static PhoenixTestDriver driver;
+    private static final Configuration config = HBaseConfiguration.create(); 
+    private static boolean clusterInitialized = false;
+    
+    protected final static String getUrl() {
+        return checkClusterInitialized();
+    }
+    
+    protected static Configuration getTestClusterConfig() {
+        // don't want callers to modify config.
+        return new Configuration(config);
+    }
+    
     @Before
-    public void doTestSetup() throws Exception {
+    public void cleanUpBeforeTest() throws Exception {
         long ts = nextTimestamp();
-        deletePriorTables(ts-1);    
+        deletePriorTables(ts - 1, getUrl());    
+    }
+    
+    @BeforeClass
+    public static void doSetup() throws Exception {
+        setUpTestDriver(getUrl(), ReadOnlyProps.EMPTY_PROPS);
+    }
+    
+    protected static void setUpTestDriver(String url, ReadOnlyProps props) throws Exception {
+        if (PhoenixEmbeddedDriver.isTestUrl(url)) {
+            checkClusterInitialized();
+            if (driver == null) {
+                driver = initAndRegisterDriver(url, props);
+            }
+        }
+    }
+
+    private static String checkClusterInitialized() {
+        if (!clusterInitialized) {
+            url = setUpTestCluster(config);
+            clusterInitialized = true;
+        }
+        return url;
+    }
+    
+    @AfterClass
+    public static void dropTables() throws Exception {
+        try {
+            disableAndDropNonSystemTables(driver);
+        } finally {
+            try {
+                assertTrue(destroyDriver(driver));
+            } finally {
+                driver = null;
+            }
+        }
+    }
+    
+    protected static void initATableValues(String tenantId, byte[][] splits, Date date, Long ts) throws Exception {
+        BaseTest.initATableValues(tenantId, splits, date, ts, getUrl());
+    }
+    
+    protected static void initEntityHistoryTableValues(String tenantId, byte[][] splits, Date date, Long ts) throws Exception {
+        BaseTest.initEntityHistoryTableValues(tenantId, splits, date, ts, getUrl());
+    }
+    
+    protected static void initSaltedEntityHistoryTableValues(String tenantId, byte[][] splits, Date date, Long ts) throws Exception {
+        BaseTest.initSaltedEntityHistoryTableValues(tenantId, splits, date, ts, getUrl());
     }
+        
 }

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseConnectedQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseConnectedQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseConnectedQueryIT.java
deleted file mode 100644
index e6bb65f..0000000
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseConnectedQueryIT.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.end2end;
-
-import static org.apache.phoenix.util.PhoenixRuntime.CURRENT_SCN_ATTRIB;
-import static org.apache.phoenix.util.PhoenixRuntime.JDBC_PROTOCOL;
-import static org.apache.phoenix.util.PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR;
-import static org.apache.phoenix.util.PhoenixRuntime.PHOENIX_TEST_DRIVER_URL_PARAM;
-import static org.apache.phoenix.util.TestUtil.ATABLE_NAME;
-import static org.apache.phoenix.util.TestUtil.A_VALUE;
-import static org.apache.phoenix.util.TestUtil.B_VALUE;
-import static org.apache.phoenix.util.TestUtil.C_VALUE;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID1;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID2;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID3;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID4;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID5;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID6;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID7;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID8;
-import static org.apache.phoenix.util.TestUtil.ENTITYHISTID9;
-import static org.apache.phoenix.util.TestUtil.ENTITY_HISTORY_SALTED_TABLE_NAME;
-import static org.apache.phoenix.util.TestUtil.ENTITY_HISTORY_TABLE_NAME;
-import static org.apache.phoenix.util.TestUtil.E_VALUE;
-import static org.apache.phoenix.util.TestUtil.MILLIS_IN_DAY;
-import static org.apache.phoenix.util.TestUtil.PARENTID1;
-import static org.apache.phoenix.util.TestUtil.PARENTID2;
-import static org.apache.phoenix.util.TestUtil.PARENTID3;
-import static org.apache.phoenix.util.TestUtil.PARENTID4;
-import static org.apache.phoenix.util.TestUtil.PARENTID5;
-import static org.apache.phoenix.util.TestUtil.PARENTID6;
-import static org.apache.phoenix.util.TestUtil.PARENTID7;
-import static org.apache.phoenix.util.TestUtil.PARENTID8;
-import static org.apache.phoenix.util.TestUtil.PARENTID9;
-import static org.apache.phoenix.util.TestUtil.ROW1;
-import static org.apache.phoenix.util.TestUtil.ROW2;
-import static org.apache.phoenix.util.TestUtil.ROW3;
-import static org.apache.phoenix.util.TestUtil.ROW4;
-import static org.apache.phoenix.util.TestUtil.ROW5;
-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 java.math.BigDecimal;
-import java.sql.Array;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.Date;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.IntegrationTestingUtility;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
-import org.apache.phoenix.query.BaseTest;
-import org.apache.phoenix.query.HBaseFactoryProvider;
-import org.apache.phoenix.schema.NewerTableAlreadyExistsException;
-import org.apache.phoenix.schema.PTableType;
-import org.apache.phoenix.schema.TableNotFoundException;
-import org.apache.phoenix.util.PhoenixRuntime;
-import org.apache.phoenix.util.SchemaUtil;
-import org.apache.phoenix.util.TestUtil;
-import org.junit.BeforeClass;
-import org.slf4j.LoggerFactory;
-
-/**
- * 
- * Base class for tests that need to be connected to an HBase server
- *
- * 
- * @since 0.1
- */
-public abstract class BaseConnectedQueryIT extends BaseTest {
-    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(BaseConnectedQueryIT.class);
-    
-    protected static byte[][] getDefaultSplits(String tenantId) {
-        return new byte[][] { 
-            Bytes.toBytes(tenantId + "00A"),
-            Bytes.toBytes(tenantId + "00B"),
-            Bytes.toBytes(tenantId + "00C"),
-            };
-    }
-    
-    protected static String getUrl() {
-      Configuration conf = HBaseFactoryProvider.getConfigurationFactory().getConfiguration();
-      boolean isDistributedCluster = false;
-      isDistributedCluster =
-          Boolean.parseBoolean(System.getProperty(IntegrationTestingUtility.IS_DISTRIBUTED_CLUSTER,
-            "false"));
-      if (!isDistributedCluster) {
-        isDistributedCluster =
-            conf.getBoolean(IntegrationTestingUtility.IS_DISTRIBUTED_CLUSTER, false);
-      }
-      // reconstruct url when running against a live cluster
-      if (isDistributedCluster) {
-        // Get all info from hbase-site.xml
-        return JDBC_PROTOCOL + JDBC_PROTOCOL_TERMINATOR + PHOENIX_TEST_DRIVER_URL_PARAM;      
-      } else {
-        return TestUtil.PHOENIX_JDBC_URL;
-      }
-    }
-
-    @BeforeClass
-    public static void doSetup() throws Exception {
-        startServer(getUrl());
-    }
-    
-    protected static void deletePriorTables(long ts) throws Exception {
-        deletePriorTables(ts, (String)null);
-    }
-    
-    protected static void deletePriorTables(long ts, String tenantId) throws Exception {
-        Properties props = new Properties();
-        if (ts != HConstants.LATEST_TIMESTAMP) {
-            props.setProperty(CURRENT_SCN_ATTRIB, Long.toString(ts));
-        }
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        try {
-            deletePriorTables(ts, conn);
-            deletePriorSequences(ts, conn);
-        }
-        finally {
-            conn.close();
-        }
-    }
-    
-    private static void deletePriorTables(long ts, Connection globalConn) throws Exception {
-        DatabaseMetaData dbmd = globalConn.getMetaData();
-        // Drop VIEWs first, as we don't allow a TABLE with views to be dropped
-        // Tables are sorted by TENANT_ID
-        List<String[]> tableTypesList = Arrays.asList(new String[] {PTableType.VIEW.toString()}, new String[] {PTableType.TABLE.toString()});
-        for (String[] tableTypes: tableTypesList) {
-            ResultSet rs = dbmd.getTables(null, null, null, tableTypes);
-            String lastTenantId = null;
-            Connection conn = globalConn;
-            while (rs.next()) {
-                String fullTableName = SchemaUtil.getEscapedTableName(
-                        rs.getString(PhoenixDatabaseMetaData.TABLE_SCHEM),
-                        rs.getString(PhoenixDatabaseMetaData.TABLE_NAME));
-                String ddl = "DROP " + rs.getString(PhoenixDatabaseMetaData.TABLE_TYPE) + " " + fullTableName;
-                String tenantId = rs.getString(1);
-                if (tenantId != null && !tenantId.equals(lastTenantId))  {
-                    if (lastTenantId != null) {
-                        conn.close();
-                    }
-                    // Open tenant-specific connection when we find a new one
-                    Properties props = new Properties(globalConn.getClientInfo());
-                    props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId);
-                    conn = DriverManager.getConnection(getUrl(), props);
-                    lastTenantId = tenantId;
-                }
-                try {
-                    conn.createStatement().executeUpdate(ddl);
-                } catch (NewerTableAlreadyExistsException ex) {
-                    logger.info("Newer table " + fullTableName + " or its delete marker exists. Ignore current deletion");
-                } catch (TableNotFoundException ex) {
-                    logger.info("Table " + fullTableName + " is already deleted.");
-                }
-            }
-            if (lastTenantId != null) {
-                conn.close();
-            }
-        }
-    }
-    
-    private static void deletePriorSequences(long ts, Connection conn) throws Exception {
-        // TODO: drop tenant-specific sequences too
-        ResultSet rs = conn.createStatement().executeQuery("SELECT " 
-                + PhoenixDatabaseMetaData.SEQUENCE_SCHEMA + "," 
-                + PhoenixDatabaseMetaData.SEQUENCE_NAME 
-                + " FROM " + PhoenixDatabaseMetaData.SEQUENCE_TABLE_NAME);
-        while (rs.next()) {
-            conn.createStatement().execute("DROP SEQUENCE " + SchemaUtil.getTableName(rs.getString(1), rs.getString(2)));
-        }
-    }
-    
-    protected static void initSumDoubleValues(byte[][] splits) throws Exception {
-        ensureTableCreated(getUrl(), "SumDoubleTest", splits);
-        Properties props = new Properties();
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        try {
-            // Insert all rows at ts
-            PreparedStatement stmt = conn.prepareStatement(
-                    "upsert into " +
-                    "SumDoubleTest(" +
-                    "    id, " +
-                    "    d, " +
-                    "    f, " +
-                    "    ud, " +
-                    "    uf) " +
-                    "VALUES (?, ?, ?, ?, ?)");
-            stmt.setString(1, "1");
-            stmt.setDouble(2, 0.001);
-            stmt.setFloat(3, 0.01f);
-            stmt.setDouble(4, 0.001);
-            stmt.setFloat(5, 0.01f);
-            stmt.execute();
-                
-            stmt.setString(1, "2");
-            stmt.setDouble(2, 0.002);
-            stmt.setFloat(3, 0.02f);
-            stmt.setDouble(4, 0.002);
-            stmt.setFloat(5, 0.02f);
-            stmt.execute();
-                
-            stmt.setString(1, "3");
-            stmt.setDouble(2, 0.003);
-            stmt.setFloat(3, 0.03f);
-            stmt.setDouble(4, 0.003);
-            stmt.setFloat(5, 0.03f);
-            stmt.execute();
-                
-            stmt.setString(1, "4");
-            stmt.setDouble(2, 0.004);
-            stmt.setFloat(3, 0.04f);
-            stmt.setDouble(4, 0.004);
-            stmt.setFloat(5, 0.04f);
-            stmt.execute();
-                
-            stmt.setString(1, "5");
-            stmt.setDouble(2, 0.005);
-            stmt.setFloat(3, 0.05f);
-            stmt.setDouble(4, 0.005);
-            stmt.setFloat(5, 0.05f);
-            stmt.execute();
-                
-            conn.commit();
-        } finally {
-            conn.close();
-        }
-    }
-    
-    protected static void initATableValues(String tenantId, byte[][] splits) throws Exception {
-        initATableValues(tenantId, splits, null);
-    }
-    
-    protected static void initATableValues(String tenantId, byte[][] splits, Date date) throws Exception {
-        initATableValues(tenantId, splits, date, null);
-    }
-    
-    protected static void initTablesWithArrays(String tenantId, Date date, Long ts, boolean useNull) throws Exception {
-    	 Properties props = new Properties();
-         if (ts != null) {
-             props.setProperty(CURRENT_SCN_ATTRIB, ts.toString());
-         }
-         Connection conn = DriverManager.getConnection(getUrl(), props);
-         try {
-             // Insert all rows at ts
-             PreparedStatement stmt = conn.prepareStatement(
-                     "upsert into " +
-                     "TABLE_WITH_ARRAY(" +
-                     "    ORGANIZATION_ID, " +
-                     "    ENTITY_ID, " +
-                     "    a_string_array, " +
-                     "    B_STRING, " +
-                     "    A_INTEGER, " +
-                     "    A_DATE, " +
-                     "    X_DECIMAL, " +
-                     "    x_long_array, " +
-                     "    X_INTEGER," +
-                     "    a_byte_array," +
-                     "    A_SHORT," +
-                     "    A_FLOAT," +
-                     "    a_double_array," +
-                     "    A_UNSIGNED_FLOAT," +
-                     "    A_UNSIGNED_DOUBLE)" +
-                     "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
-             stmt.setString(1, tenantId);
-             stmt.setString(2, ROW1);
-             // Need to support primitive
-             String[] strArr =  new String[4];
-             strArr[0] = "ABC";
-			if (useNull) {
-				strArr[1] = null;
-			} else {
-				strArr[1] = "CEDF";
-			}
-             strArr[2] = "XYZWER";
-             strArr[3] = "AB";
-             Array array = conn.createArrayOf("VARCHAR", strArr);
-             stmt.setArray(3, array);
-             stmt.setString(4, B_VALUE);
-             stmt.setInt(5, 1);
-             stmt.setDate(6, date);
-             stmt.setBigDecimal(7, null);
-             // Need to support primitive
-             Long[] longArr =  new Long[2];
-             longArr[0] = 25l;
-             longArr[1] = 36l;
-             array = conn.createArrayOf("BIGINT", longArr);
-             stmt.setArray(8, array);
-             stmt.setNull(9, Types.INTEGER);
-             // Need to support primitive
-             Byte[] byteArr =  new Byte[2];
-             byteArr[0] = 25;
-             byteArr[1] = 36;
-             array = conn.createArrayOf("TINYINT", byteArr);
-             stmt.setArray(10, array);
-             stmt.setShort(11, (short) 128);
-             stmt.setFloat(12, 0.01f);
-             // Need to support primitive
-             Double[] doubleArr =  new Double[4];
-             doubleArr[0] = 25.343;
-             doubleArr[1] = 36.763;
-             doubleArr[2] = 37.56;
-             doubleArr[3] = 386.63;
-             array = conn.createArrayOf("DOUBLE", doubleArr);
-             stmt.setArray(13, array);
-             stmt.setFloat(14, 0.01f);
-             stmt.setDouble(15, 0.0001);
-             stmt.execute();
-                 
-             conn.commit();
-         } finally {
-             conn.close();
-         }
-    }
-    
-    protected static void initATableValues(String tenantId, byte[][] splits, Date date, Long ts) throws Exception {
-        if (ts == null) {
-            ensureTableCreated(getUrl(), ATABLE_NAME, splits);
-        } else {
-            ensureTableCreated(getUrl(), ATABLE_NAME, splits, ts-5);
-        }
-        
-        Properties props = new Properties();
-        if (ts != null) {
-            props.setProperty(CURRENT_SCN_ATTRIB, Long.toString(ts-3));
-        }
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        try {
-            // Insert all rows at ts
-            PreparedStatement stmt = conn.prepareStatement(
-                    "upsert into " +
-                    "ATABLE(" +
-                    "    ORGANIZATION_ID, " +
-                    "    ENTITY_ID, " +
-                    "    A_STRING, " +
-                    "    B_STRING, " +
-                    "    A_INTEGER, " +
-                    "    A_DATE, " +
-                    "    X_DECIMAL, " +
-                    "    X_LONG, " +
-                    "    X_INTEGER," +
-                    "    Y_INTEGER," +
-                    "    A_BYTE," +
-                    "    A_SHORT," +
-                    "    A_FLOAT," +
-                    "    A_DOUBLE," +
-                    "    A_UNSIGNED_FLOAT," +
-                    "    A_UNSIGNED_DOUBLE)" +
-                    "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW1);
-            stmt.setString(3, A_VALUE);
-            stmt.setString(4, B_VALUE);
-            stmt.setInt(5, 1);
-            stmt.setDate(6, date);
-            stmt.setBigDecimal(7, null);
-            stmt.setNull(8, Types.BIGINT);
-            stmt.setNull(9, Types.INTEGER);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)1);
-            stmt.setShort(12, (short) 128);
-            stmt.setFloat(13, 0.01f);
-            stmt.setDouble(14, 0.0001);
-            stmt.setFloat(15, 0.01f);
-            stmt.setDouble(16, 0.0001);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW2);
-            stmt.setString(3, A_VALUE);
-            stmt.setString(4, C_VALUE);
-            stmt.setInt(5, 2);
-            stmt.setDate(6, date == null ? null : new Date(date.getTime() + MILLIS_IN_DAY * 1));
-            stmt.setBigDecimal(7, null);
-            stmt.setNull(8, Types.BIGINT);
-            stmt.setNull(9, Types.INTEGER);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)2);
-            stmt.setShort(12, (short) 129);
-            stmt.setFloat(13, 0.02f);
-            stmt.setDouble(14, 0.0002);
-            stmt.setFloat(15, 0.02f);
-            stmt.setDouble(16, 0.0002);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW3);
-            stmt.setString(3, A_VALUE);
-            stmt.setString(4, E_VALUE);
-            stmt.setInt(5, 3);
-            stmt.setDate(6, date == null ? null : new Date(date.getTime() + MILLIS_IN_DAY * 2));
-            stmt.setBigDecimal(7, null);
-            stmt.setNull(8, Types.BIGINT);
-            stmt.setNull(9, Types.INTEGER);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)3);
-            stmt.setShort(12, (short) 130);
-            stmt.setFloat(13, 0.03f);
-            stmt.setDouble(14, 0.0003);
-            stmt.setFloat(15, 0.03f);
-            stmt.setDouble(16, 0.0003);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW4);
-            stmt.setString(3, A_VALUE);
-            stmt.setString(4, B_VALUE);
-            stmt.setInt(5, 4);
-            stmt.setDate(6, date == null ? null : date);
-            stmt.setBigDecimal(7, null);
-            stmt.setNull(8, Types.BIGINT);
-            stmt.setNull(9, Types.INTEGER);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)4);
-            stmt.setShort(12, (short) 131);
-            stmt.setFloat(13, 0.04f);
-            stmt.setDouble(14, 0.0004);
-            stmt.setFloat(15, 0.04f);
-            stmt.setDouble(16, 0.0004);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW5);
-            stmt.setString(3, B_VALUE);
-            stmt.setString(4, C_VALUE);
-            stmt.setInt(5, 5);
-            stmt.setDate(6, date == null ? null : new Date(date.getTime() + MILLIS_IN_DAY * 1));
-            stmt.setBigDecimal(7, null);
-            stmt.setNull(8, Types.BIGINT);
-            stmt.setNull(9, Types.INTEGER);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)5);
-            stmt.setShort(12, (short) 132);
-            stmt.setFloat(13, 0.05f);
-            stmt.setDouble(14, 0.0005);
-            stmt.setFloat(15, 0.05f);
-            stmt.setDouble(16, 0.0005);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW6);
-            stmt.setString(3, B_VALUE);
-            stmt.setString(4, E_VALUE);
-            stmt.setInt(5, 6);
-            stmt.setDate(6, date == null ? null : new Date(date.getTime() + MILLIS_IN_DAY * 2));
-            stmt.setBigDecimal(7, null);
-            stmt.setNull(8, Types.BIGINT);
-            stmt.setNull(9, Types.INTEGER);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)6);
-            stmt.setShort(12, (short) 133);
-            stmt.setFloat(13, 0.06f);
-            stmt.setDouble(14, 0.0006);
-            stmt.setFloat(15, 0.06f);
-            stmt.setDouble(16, 0.0006);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW7);
-            stmt.setString(3, B_VALUE);
-            stmt.setString(4, B_VALUE);
-            stmt.setInt(5, 7);
-            stmt.setDate(6, date == null ? null : date);
-            stmt.setBigDecimal(7, BigDecimal.valueOf(0.1));
-            stmt.setLong(8, 5L);
-            stmt.setInt(9, 5);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)7);
-            stmt.setShort(12, (short) 134);
-            stmt.setFloat(13, 0.07f);
-            stmt.setDouble(14, 0.0007);
-            stmt.setFloat(15, 0.07f);
-            stmt.setDouble(16, 0.0007);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW8);
-            stmt.setString(3, B_VALUE);
-            stmt.setString(4, C_VALUE);
-            stmt.setInt(5, 8);
-            stmt.setDate(6, date == null ? null : new Date(date.getTime() + MILLIS_IN_DAY * 1));
-            stmt.setBigDecimal(7, BigDecimal.valueOf(3.9));
-            long l = Integer.MIN_VALUE - 1L;
-            assert(l < Integer.MIN_VALUE);
-            stmt.setLong(8, l);
-            stmt.setInt(9, 4);
-            stmt.setNull(10, Types.INTEGER);
-            stmt.setByte(11, (byte)8);
-            stmt.setShort(12, (short) 135);
-            stmt.setFloat(13, 0.08f);
-            stmt.setDouble(14, 0.0008);
-            stmt.setFloat(15, 0.08f);
-            stmt.setDouble(16, 0.0008);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, ROW9);
-            stmt.setString(3, C_VALUE);
-            stmt.setString(4, E_VALUE);
-            stmt.setInt(5, 9);
-            stmt.setDate(6, date == null ? null : new Date(date.getTime() + MILLIS_IN_DAY * 2));
-            stmt.setBigDecimal(7, BigDecimal.valueOf(3.3));
-            l = Integer.MAX_VALUE + 1L;
-            assert(l > Integer.MAX_VALUE);
-            stmt.setLong(8, l);
-            stmt.setInt(9, 3);
-            stmt.setInt(10, 300);
-            stmt.setByte(11, (byte)9);
-            stmt.setShort(12, (short) 0);
-            stmt.setFloat(13, 0.09f);
-            stmt.setDouble(14, 0.0009);
-            stmt.setFloat(15, 0.09f);
-            stmt.setDouble(16, 0.0009);
-            stmt.execute();
-                
-            conn.commit();
-        } finally {
-            conn.close();
-        }
-    }
-    protected static void initEntityHistoryTableValues(String tenantId, byte[][] splits) throws Exception {
-        initEntityHistoryTableValues(tenantId, splits, null);
-    }
-    
-    protected static void initEntityHistoryTableValues(String tenantId, byte[][] splits, Date date) throws Exception {
-        initEntityHistoryTableValues(tenantId, splits, date, null);
-    }
-    
-    protected static void initEntityHistoryTableValues(String tenantId, byte[][] splits, Date date, Long ts) throws Exception {
-        if (ts == null) {
-            ensureTableCreated(getUrl(), ENTITY_HISTORY_TABLE_NAME, splits);
-        } else {
-            ensureTableCreated(getUrl(), ENTITY_HISTORY_TABLE_NAME, splits, ts-2);
-        }
-        
-        Properties props = new Properties();
-        if (ts != null) {
-            props.setProperty(CURRENT_SCN_ATTRIB, ts.toString());
-        }
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        try {
-            // Insert all rows at ts
-            PreparedStatement stmt = conn.prepareStatement(
-                    "upsert into " +
-                    ENTITY_HISTORY_TABLE_NAME+
-                    "(" +
-                    "    ORGANIZATION_ID, " +
-                    "    PARENT_ID, " +
-                    "    CREATED_DATE, " +
-                    "    ENTITY_HISTORY_ID, " +
-                    "    OLD_VALUE, " +
-                    "    NEW_VALUE) " +
-                    "VALUES (?, ?, ?, ?, ?, ?)");
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID1);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID1);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID2);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID2);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID3);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID3);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID4);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID4);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID5);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID5);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID6);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID6);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID7);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID7);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID8);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID8);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID9);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID9);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            conn.commit();
-        } finally {
-            conn.close();
-        }
-    }
-    
-    protected static void initSaltedEntityHistoryTableValues(String tenantId, byte[][] splits, Date date, Long ts) throws Exception {
-        if (ts == null) {
-            ensureTableCreated(getUrl(), ENTITY_HISTORY_SALTED_TABLE_NAME, splits);
-        } else {
-            ensureTableCreated(getUrl(), ENTITY_HISTORY_SALTED_TABLE_NAME, splits, ts-2);
-        }
-        
-        Properties props = new Properties();
-        if (ts != null) {
-            props.setProperty(CURRENT_SCN_ATTRIB, ts.toString());
-        }
-        Connection conn = DriverManager.getConnection(getUrl(), props);
-        try {
-            // Insert all rows at ts
-            PreparedStatement stmt = conn.prepareStatement(
-                    "upsert into " +
-                    ENTITY_HISTORY_SALTED_TABLE_NAME+
-                    "(" +
-                    "    ORGANIZATION_ID, " +
-                    "    PARENT_ID, " +
-                    "    CREATED_DATE, " +
-                    "    ENTITY_HISTORY_ID, " +
-                    "    OLD_VALUE, " +
-                    "    NEW_VALUE) " +
-                    "VALUES (?, ?, ?, ?, ?, ?)");
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID1);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID1);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID2);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID2);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-                
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID3);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID3);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID4);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID4);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID5);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID5);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID6);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID6);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID7);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID7);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID8);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID8);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            stmt.setString(1, tenantId);
-            stmt.setString(2, PARENTID9);
-            stmt.setDate(3, date);
-            stmt.setString(4, ENTITYHISTID9);
-            stmt.setString(5,  A_VALUE);
-            stmt.setString(6,  B_VALUE);
-            stmt.execute();
-            
-            conn.commit();
-        } finally {
-            conn.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeIT.java
index c00b74c..ae83585 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseHBaseManagedTimeIT.java
@@ -17,25 +17,90 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.junit.Assert.assertTrue;
+
+import javax.annotation.concurrent.NotThreadSafe;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver;
+import org.apache.phoenix.jdbc.PhoenixTestDriver;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.experimental.categories.Category;
 
 /**
- * 
- * Base class for tests that have HBase manage the time stamps.
- * We need to separate these from tests that manged the time stamp
- * themselves, because we create/destroy the Phoenix tables
+ * Base class for tests that let HBase set timestamps.
+ * We need to separate these from tests that rely on clients 
+ * to set timestamps, because we create/destroy the Phoenix tables
  * between tests and only allow a table time stamp to increase.
- * If we let HBase set the time stamps, then our client time stamps
- * will usually be smaller than these time stamps and the table
- * deletion/creation would fail.
- *
+ * Without this separation table deletion/creation would fail.
+ * 
+ * All tests extending this class use the mini cluster that is
+ * different from the mini cluster used by test classes extending 
+ * {@link BaseClientManagedTimeIT}.
  * 
  * @since 0.1
  */
-public abstract class BaseHBaseManagedTimeIT extends BaseConnectedQueryIT {
+@NotThreadSafe
+@Category(HBaseManagedTimeTest.class)
+public abstract class BaseHBaseManagedTimeIT extends BaseTest {
+    private static String url;
+    protected static PhoenixTestDriver driver;
+    private static final Configuration config = HBaseConfiguration.create(); 
+    private static boolean clusterInitialized = false;
+    
+    protected final static String getUrl() {
+        return checkClusterInitialized();
+    }
+    
+    protected static Configuration getTestClusterConfig() {
+        // don't want callers to modify config.
+        return new Configuration(config);
+    }
+    
     @Before
-    public void doTestSetup() throws Exception {
-        deletePriorTables(HConstants.LATEST_TIMESTAMP);
+    public void cleanUpBeforeTest() throws Exception {
+        deletePriorTables(HConstants.LATEST_TIMESTAMP, getUrl());    
+    }
+    
+    @BeforeClass
+    public static void doSetup() throws Exception {
+        setUpTestDriver(getUrl(), ReadOnlyProps.EMPTY_PROPS);
+    }
+    
+    protected static void setUpTestDriver(String url, ReadOnlyProps props) throws Exception {
+        if (PhoenixEmbeddedDriver.isTestUrl(url)) {
+            checkClusterInitialized();
+            if (driver == null) {
+                driver = initAndRegisterDriver(url, props);
+            }
+        }
+    }
+
+    private static String checkClusterInitialized() {
+        if (!clusterInitialized) {
+            url = setUpTestCluster(config);
+            clusterInitialized = true;
+        }
+        return url;
+    }
+    
+    @AfterClass
+    public static void dropTables() throws Exception {
+        try {
+            disableAndDropNonSystemTables(driver);
+        } finally {
+            try {
+                assertTrue(destroyDriver(driver));
+            } finally {
+                driver = null;
+            }
+        }
     }
+        
 }

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseParallelIteratorsRegionSplitterIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseParallelIteratorsRegionSplitterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseParallelIteratorsRegionSplitterIT.java
index c664fc8..0bc3324 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseParallelIteratorsRegionSplitterIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseParallelIteratorsRegionSplitterIT.java
@@ -34,10 +34,11 @@ import org.apache.phoenix.schema.TableRef;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.junit.BeforeClass;
+import org.junit.experimental.categories.Category;
 
 import com.google.common.collect.Maps;
 
-
+@Category(ClientManagedTimeTest.class)
 public class BaseParallelIteratorsRegionSplitterIT extends BaseClientManagedTimeIT {
 
     protected static final byte[] KMIN  = new byte[] {'!'};
@@ -54,6 +55,7 @@ public class BaseParallelIteratorsRegionSplitterIT extends BaseClientManagedTime
     protected static final byte[] KMAX2  = new byte[] {'z'};
     
     @BeforeClass
+    @Shadower(classBeingShadowed = BaseClientManagedTimeIT.class)
     public static void doSetup() throws Exception {
         int targetQueryConcurrency = 3;
         int maxQueryConcurrency = 5;
@@ -62,7 +64,7 @@ public class BaseParallelIteratorsRegionSplitterIT extends BaseClientManagedTime
         props.put(QueryServices.TARGET_QUERY_CONCURRENCY_ATTRIB, Integer.toString(targetQueryConcurrency));
         props.put(QueryServices.MAX_INTRA_REGION_PARALLELIZATION_ATTRIB, Integer.toString(Integer.MAX_VALUE));
         // Must update config before starting server
-        startServer(getUrl(), new ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(getUrl(), new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     protected void initTableValues(long ts) throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificTablesIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificTablesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificTablesIT.java
index db3118b..85d65e2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificTablesIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseTenantSpecificTablesIT.java
@@ -22,6 +22,7 @@ import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
 import java.sql.SQLException;
 
 import org.junit.Before;
+import org.junit.experimental.categories.Category;
 
 /**
  * Describe your class here.
@@ -29,6 +30,8 @@ import org.junit.Before;
  * 
  * @since 2.2
  */
+
+@Category(ClientManagedTimeTest.class)
 public abstract class BaseTenantSpecificTablesIT extends BaseClientManagedTimeIT {
     protected static final String TENANT_ID = "ZZTop";
     protected static final String TENANT_TYPE_ID = "abc";

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
index 03e8a43..b125ab2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseViewIT.java
@@ -31,18 +31,21 @@ import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.junit.BeforeClass;
+import org.junit.experimental.categories.Category;
 
 import com.google.common.collect.Maps;
 
+@Category(HBaseManagedTimeTest.class)
 public class BaseViewIT extends BaseHBaseManagedTimeIT {
 
-    @BeforeClass 
+    @BeforeClass
+    @Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class)
     public static void doSetup() throws Exception {
         Map<String,String> props = Maps.newHashMapWithExpectedSize(1);
         // Don't split intra region so we can more easily know that the n-way parallelization is for the explain plan
         props.put(QueryServices.MAX_INTRA_REGION_PARALLELIZATION_ATTRIB, Integer.toString(1));
         // Must update config before starting server
-        startServer(getUrl(), new ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(getUrl(), new ReadOnlyProps(props.entrySet().iterator()));
     }
 
     protected void testUpdatableViewWithIndex(Integer saltBuckets) throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/BinaryRowKeyIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BinaryRowKeyIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BinaryRowKeyIT.java
index a1cc0a8..d55cfd0 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BinaryRowKeyIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BinaryRowKeyIT.java
@@ -18,13 +18,22 @@
 package org.apache.phoenix.end2end;
 
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.Properties;
 
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
+@Category(HBaseManagedTimeTest.class)
 public class BinaryRowKeyIT extends BaseHBaseManagedTimeIT {
 
     private static void initTableValues() throws SQLException {

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/2f28db53/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
index 543142f..9f4ce37 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CSVCommonsLoaderIT.java
@@ -40,7 +40,9 @@ import org.apache.phoenix.util.CSVCommonsLoader;
 import org.apache.phoenix.util.DateUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
+@Category(HBaseManagedTimeTest.class)
 public class CSVCommonsLoaderIT extends BaseHBaseManagedTimeIT {
 
     private static final String DATATYPE_TABLE = "DATATYPE";


Mime
View raw message