PHOENIX-1284 Override config properties for unit tests not making it to server

Conflicts:
        
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
        
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java
        phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java


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

Branch: refs/heads/master
Commit: e4dc9cd5914dbdcedb34dc24450e97492f858480
Parents: 614a243
Author: James Taylor <jtay...@salesforce.com>
Authored: Tue Sep 23 01:23:54 2014 -0700
Committer: James Taylor <jtay...@salesforce.com>
Committed: Tue Sep 23 02:33:14 2014 -0700

----------------------------------------------------------------------
 .../end2end/BaseClientManagedTimeIT.java        | 31 +---------
 .../phoenix/end2end/BaseHBaseManagedTimeIT.java | 31 +---------
 .../BaseParallelIteratorsRegionSplitterIT.java  |  2 +-
 .../org/apache/phoenix/end2end/BaseQueryIT.java |  2 +-
 .../org/apache/phoenix/end2end/BaseViewIT.java  |  2 +-
 .../org/apache/phoenix/end2end/HashJoinIT.java  |  2 +-
 .../phoenix/end2end/InMemoryOrderByIT.java      |  2 +-
 .../org/apache/phoenix/end2end/QueryPlanIT.java |  2 +-
 .../org/apache/phoenix/end2end/SequenceIT.java  |  2 +-
 ...ipRangeParallelIteratorRegionSplitterIT.java |  2 +-
 .../end2end/SkipScanAfterManualSplitIT.java     |  2 +-
 .../phoenix/end2end/SpillableGroupByIT.java     |  2 +-
 .../phoenix/end2end/SpooledOrderByIT.java       |  2 +-
 .../apache/phoenix/end2end/UpsertSelectIT.java  |  2 +-
 .../phoenix/end2end/index/DropViewIT.java       |  2 +-
 .../phoenix/end2end/index/MutableIndexIT.java   |  3 +-
 .../phoenix/end2end/index/SaltedIndexIT.java    | 17 +++---
 .../java/org/apache/phoenix/query/BaseTest.java | 62 ++++++++++++++++----
 18 files changed, 76 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/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 8b47e11..2f60ea1 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
@@ -24,9 +24,6 @@ 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.After;
@@ -50,15 +47,6 @@ import org.junit.experimental.categories.Category;
 @NotThreadSafe
 @Category(ClientManagedTimeTest.class)
 public abstract class BaseClientManagedTimeIT extends BaseTest {
-    private static String url;
-    protected static PhoenixTestDriver driver;
-    protected 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);
@@ -72,24 +60,7 @@ public abstract class BaseClientManagedTimeIT extends 
BaseTest {
     
     @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;
+        setUpTestDriver(ReadOnlyProps.EMPTY_PROPS);
     }
     
     @AfterClass

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/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 047afb8..1d0f004 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
@@ -22,10 +22,7 @@ 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.After;
@@ -49,15 +46,6 @@ import org.junit.experimental.categories.Category;
 @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);
@@ -70,24 +58,7 @@ public abstract class BaseHBaseManagedTimeIT extends 
BaseTest {
     
     @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;
+        setUpTestDriver(ReadOnlyProps.EMPTY_PROPS);
     }
     
     @AfterClass

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/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 cfaa8ee..514b36e 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
@@ -59,7 +59,7 @@ public class BaseParallelIteratorsRegionSplitterIT extends 
BaseClientManagedTime
     public static void doSetup() throws Exception {
         Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     protected void initTableValues(long ts) throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
index eb10512..7a3e86e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
@@ -76,7 +76,7 @@ public abstract class BaseQueryIT extends 
BaseClientManagedTimeIT {
         // Make a small batch size to test multiple calls to reserve sequences
         props.put(QueryServices.SEQUENCE_CACHE_SIZE_ATTRIB, 
Long.toString(BATCH_SIZE));
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     protected long ts;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/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 1cc9207..c255d00 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
@@ -43,7 +43,7 @@ public class BaseViewIT extends BaseHBaseManagedTimeIT {
         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
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
 
     protected void testUpdatableViewWithIndex(Integer saltBuckets, boolean 
localIndex) throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index 1d2ca4c..dcd96d3 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -85,7 +85,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
         // Forces server cache to be used
         props.put(QueryServices.INDEX_MUTATE_BATCH_SIZE_THRESHOLD_ATTRIB, 
Integer.toString(2));
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     @Before

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/InMemoryOrderByIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InMemoryOrderByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InMemoryOrderByIT.java
index 5e04f8e..48a0581 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InMemoryOrderByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InMemoryOrderByIT.java
@@ -38,6 +38,6 @@ public class InMemoryOrderByIT extends OrderByIT {
         Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
         props.put(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
Integer.toString(1024*1024));
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryPlanIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryPlanIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryPlanIT.java
index 60409b2..320ba72 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryPlanIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryPlanIT.java
@@ -48,7 +48,7 @@ public class QueryPlanIT extends BaseHBaseManagedTimeIT {
         // Override date format so we don't have a bunch of zeros
         props.put(QueryServices.DATE_FORMAT_ATTRIB, "yyyy-MM-dd");
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java
index 3e0301c..f8673ce 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java
@@ -67,7 +67,7 @@ public class SequenceIT extends BaseClientManagedTimeIT {
         // Make a small batch size to test multiple calls to reserve sequences
         props.put(QueryServices.SEQUENCE_CACHE_SIZE_ATTRIB, 
Long.toString(BATCH_SIZE));
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     @After

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java
index d32441b..31e3a3b 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipRangeParallelIteratorRegionSplitterIT.java
@@ -319,7 +319,7 @@ public class SkipRangeParallelIteratorRegionSplitterIT 
extends BaseClientManaged
     public static void doSetup() throws Exception {
         Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
 
     private static List<KeyRange> getSplits(TableRef tableRef, final Scan 
scan, final List<HRegionLocation> regions,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
index 6e8ffb7..6f6c9a7 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanAfterManualSplitIT.java
@@ -73,7 +73,7 @@ public class SkipScanAfterManualSplitIT extends 
BaseHBaseManagedTimeIT {
         props.put(QueryServices.ROW_KEY_ORDER_SALTED_TABLE_ATTRIB, 
Boolean.toString(false));
         props.put(QueryServices.QUEUE_SIZE_ATTRIB, Integer.toString(1000));
         props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     private static void initTable() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java
index 3a0de85..9c7e4b9 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpillableGroupByIT.java
@@ -66,7 +66,7 @@ public class SpillableGroupByIT extends 
BaseHBaseManagedTimeIT {
                 Integer.toString(1));
         // Large enough to not run out of memory, but small enough to spill
         props.put(QueryServices.MAX_MEMORY_SIZE_ATTRIB, 
Integer.toString(40000));
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
 
     private long createTable() throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpooledOrderByIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpooledOrderByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpooledOrderByIT.java
index 859a66a..2533a29 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpooledOrderByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SpooledOrderByIT.java
@@ -35,7 +35,7 @@ public class SpooledOrderByIT extends OrderByIT {
         Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
         props.put(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
Integer.toString(100));
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
index a64371d..642ba62 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
@@ -69,7 +69,7 @@ public class UpsertSelectIT extends BaseClientManagedTimeIT {
       props.put(QueryServices.THREAD_POOL_SIZE_ATTRIB, Integer.toString(64));
 
       // Must update config before starting server
-      setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+      setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
   }
     
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java
index 1a650f4..2218e0b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropViewIT.java
@@ -57,7 +57,7 @@ public class DropViewIT extends BaseMutableIndexIT {
         // Drop the HBase table metadata for this test
         props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/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 cdd44f1..fe24c35 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
@@ -61,8 +61,7 @@ public class MutableIndexIT extends BaseMutableIndexIT {
         // Forces server cache to be used
         props.put(QueryServices.INDEX_MUTATE_BATCH_SIZE_THRESHOLD_ATTRIB, 
Integer.toString(2));
         props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
-        // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/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 8eae5f9..d5e9d42 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
@@ -57,8 +57,10 @@ public class SaltedIndexIT extends BaseIndexIT {
         props.put(QueryServices.INDEX_MUTATE_BATCH_SIZE_THRESHOLD_ATTRIB, 
Integer.toString(2));
         // Drop the HBase table metadata for this test
         props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
+        // Don't put guideposts in
+        props.put(QueryServices.HISTOGRAM_BYTE_DEPTH_ATTRIB, 
Long.toString(10000000));
         // Must update config before starting server
-        setUpTestDriver(getUrl(), new 
ReadOnlyProps(props.entrySet().iterator()));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
     private static void makeImmutableAndDeleteData() throws Exception {
@@ -121,8 +123,6 @@ public class SaltedIndexIT extends BaseIndexIT {
         stmt.setString(2, "y");
         stmt.execute();
         conn.commit();
-        stmt = conn.prepareStatement("ANALYZE "+DATA_TABLE_FULL_NAME);
-        stmt.execute();
 
         query = "SELECT * FROM " + INDEX_TABLE_FULL_NAME;
         rs = conn.createStatement().executeQuery(query);
@@ -177,13 +177,14 @@ public class SaltedIndexIT extends BaseIndexIT {
         assertFalse(rs.next());
         rs = conn.createStatement().executeQuery("EXPLAIN " + query);
         expectedPlan = tableSaltBuckets == null ? 
-                "CLIENT PARALLEL 3-WAY POINT LOOKUP ON 1 KEY OVER " + 
DATA_TABLE_FULL_NAME + "\n" +
+                "CLIENT PARALLEL 1-WAY POINT LOOKUP ON 1 KEY OVER " + 
DATA_TABLE_FULL_NAME + "\n" +
                 "    SERVER SORTED BY [V]\n" + 
                 "CLIENT MERGE SORT" :
-                    "CLIENT PARALLEL 2-WAY POINT LOOKUP ON 1 KEY OVER " + 
DATA_TABLE_FULL_NAME + "\n" + 
+                    "CLIENT PARALLEL 1-WAY POINT LOOKUP ON 1 KEY OVER " + 
DATA_TABLE_FULL_NAME + "\n" + 
                     "    SERVER SORTED BY [V]\n" + 
                     "CLIENT MERGE SORT";
-        assertEquals(expectedPlan,QueryUtil.getExplainPlan(rs));
+        String explainPlan2 = QueryUtil.getExplainPlan(rs);
+        assertEquals(expectedPlan,explainPlan2);
         
         // Will use data table now, since there's a LIMIT clause and
         // we're able to optimize out the ORDER BY, unless the data
@@ -199,11 +200,11 @@ public class SaltedIndexIT extends BaseIndexIT {
         assertFalse(rs.next());
         rs = conn.createStatement().executeQuery("EXPLAIN " + query);
         expectedPlan = tableSaltBuckets == null ? 
-             "CLIENT PARALLEL 3-WAY FULL SCAN OVER " + DATA_TABLE_FULL_NAME + 
"\n" +
+             "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + DATA_TABLE_FULL_NAME + 
"\n" +
              "    SERVER FILTER BY V >= 'x'\n" + 
              "    SERVER 2 ROW LIMIT\n" + 
              "CLIENT 2 ROW LIMIT" :
-                 "CLIENT PARALLEL 4-WAY FULL SCAN OVER " + 
DATA_TABLE_FULL_NAME + "\n" +
+                 "CLIENT PARALLEL 3-WAY FULL SCAN OVER " + 
DATA_TABLE_FULL_NAME + "\n" +
                  "    SERVER FILTER BY V >= 'x'\n" + 
                  "    SERVER 2 ROW LIMIT\n" + 
                  "CLIENT MERGE SORT\n" + 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e4dc9cd5/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index ab193f1..100b4ad 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -107,6 +107,7 @@ import java.util.logging.Logger;
 import javax.annotation.Nonnull;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
@@ -442,19 +443,47 @@ public abstract class BaseTest {
         return conf.get(QueryServices.ZOOKEEPER_PORT_ATTRIB);
     }
     
+    private static String url;
+    protected static PhoenixTestDriver driver;
+    private static boolean clusterInitialized = false;
+    protected static final Configuration config = HBaseConfiguration.create(); 
+    
+    protected static String getUrl() {
+        if (!clusterInitialized) {
+            throw new IllegalStateException("Cluster must be initialized 
before attempting to get the URL");
+        }
+        return url;
+    }
+    
+    protected static String checkClusterInitialized(ReadOnlyProps 
overrideProps) {
+        if (!clusterInitialized) {
+            url = setUpTestCluster(config, overrideProps);
+            clusterInitialized = true;
+        }
+        return url;
+    }
+    
     /**
      * Set up the test hbase cluster. 
+     * @param props TODO
      * @return url to be used by clients to connect to the cluster.
      */
-    protected static String setUpTestCluster(@Nonnull Configuration conf) {
+    protected static String setUpTestCluster(@Nonnull Configuration conf, 
ReadOnlyProps overrideProps) {
         boolean isDistributedCluster = isDistributedClusterModeEnabled(conf);
         if (!isDistributedCluster) {
-            return initMiniCluster(conf);
+            return initMiniCluster(conf, overrideProps);
        } else {
-            return initClusterDistributedMode(conf);
+            return initClusterDistributedMode(conf, overrideProps);
         }
     }
     
+    protected static void setUpTestDriver(ReadOnlyProps props) throws 
Exception {
+        String url = checkClusterInitialized(props);
+        if (driver == null) {
+            driver = initAndRegisterDriver(url, props);
+        }
+    }
+
     private static boolean isDistributedClusterModeEnabled(Configuration conf) 
{
         boolean isDistributedCluster = false;
         //check if the distributed mode was specified as a system property.
@@ -468,10 +497,11 @@ public abstract class BaseTest {
     
     /**
      * Initialize the mini cluster using phoenix-test specific configuration.
+     * @param overrideProps TODO
      * @return url to be used by clients to connect to the mini cluster.
      */
-    private static String initMiniCluster(Configuration conf) {
-        setUpConfigForMiniCluster(conf);
+    private static String initMiniCluster(Configuration conf, ReadOnlyProps 
overrideProps) {
+        setUpConfigForMiniCluster(conf, overrideProps);
         utility = new HBaseTestingUtility(conf);
         try {
             utility.startMiniCluster();
@@ -499,10 +529,11 @@ public abstract class BaseTest {
     
     /**
      * Initialize the cluster in distributed mode
+     * @param overrideProps TODO
      * @return url to be used by clients to connect to the mini cluster.
      */
-    private static String initClusterDistributedMode(Configuration conf) {
-        setTestConfigForDistribuedCluster(conf);
+    private static String initClusterDistributedMode(Configuration conf, 
ReadOnlyProps overrideProps) {
+        setTestConfigForDistribuedCluster(conf, overrideProps);
         try {
             IntegrationTestingUtility util =  new 
IntegrationTestingUtility(conf);
             utility = util;
@@ -513,11 +544,11 @@ public abstract class BaseTest {
         return JDBC_PROTOCOL + JDBC_PROTOCOL_TERMINATOR + 
PHOENIX_TEST_DRIVER_URL_PARAM;
     }
 
-    private static void setTestConfigForDistribuedCluster(Configuration conf) {
-        setDefaultTestConfig(conf);
+    private static void setTestConfigForDistribuedCluster(Configuration conf, 
ReadOnlyProps overrideProps) {
+        setDefaultTestConfig(conf, overrideProps);
     }
     
-    private static void setDefaultTestConfig(Configuration conf) {
+    private static void setDefaultTestConfig(Configuration conf, ReadOnlyProps 
overrideProps) {
         ConfigUtil.setReplicationConfigIfAbsent(conf);
         QueryServices services = new PhoenixTestDriver().getQueryServices();
         for (Entry<String,String> entry : services.getProps()) {
@@ -525,11 +556,20 @@ public abstract class BaseTest {
         }
         //no point doing sanity checks when running tests.
         conf.setBoolean("hbase.table.sanity.checks", false);
+        
+        // override any defaults based on overrideProps
+        for (Entry<String,String> entry : overrideProps) {
+            conf.set(entry.getKey(), entry.getValue());
+        }
     }
     
     public static Configuration setUpConfigForMiniCluster(Configuration conf) {
+        return setUpConfigForMiniCluster(conf, ReadOnlyProps.EMPTY_PROPS);
+    }
+    
+    public static Configuration setUpConfigForMiniCluster(Configuration conf, 
ReadOnlyProps overrideProps) {
         assertNotNull(conf);
-        setDefaultTestConfig(conf);
+        setDefaultTestConfig(conf, overrideProps);
         /*
          * The default configuration of mini cluster ends up spawning a lot of 
threads
          * that are not really needed by phoenix for test purposes. Limiting 
these threads

Reply via email to