You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2014/09/23 10:18:54 UTC
git commit: PHOENIX-1284 Override config properties for unit tests
not making it to server
Repository: phoenix
Updated Branches:
refs/heads/3.0 15a54d557 -> f4eb0cdf8
PHOENIX-1284 Override config properties for unit tests not making it to server
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f4eb0cdf
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f4eb0cdf
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f4eb0cdf
Branch: refs/heads/3.0
Commit: f4eb0cdf88f8e408562dffcd1049999e3a10ad1e
Parents: 15a54d5
Author: James Taylor <jt...@salesforce.com>
Authored: Tue Sep 23 01:23:54 2014 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Tue Sep 23 01:23:54 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 | 2 +-
.../phoenix/end2end/index/SaltedIndexIT.java | 26 +++-----
.../java/org/apache/phoenix/query/BaseTest.java | 62 ++++++++++++++++----
18 files changed, 75 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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 ba4c741..25b947d 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
@@ -81,7 +81,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/f4eb0cdf/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 600e0bb..0a5c197 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) throws Exception {
http://git-wip-us.apache.org/repos/asf/phoenix/blob/f4eb0cdf/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 5037f0b..c2c7298 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
@@ -84,7 +84,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/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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 78f19a7..690b6c5 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/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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/f4eb0cdf/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 75271d4..f7a037b 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,7 +61,7 @@ public class MutableIndexIT extends BaseMutableIndexIT {
props.put(QueryServices.INDEX_MUTATE_BATCH_SIZE_THRESHOLD_ATTRIB, Integer.toString(2));
// Must update config before starting server
props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
- setUpTestDriver(getUrl(), new ReadOnlyProps(props.entrySet().iterator()));
+ setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/f4eb0cdf/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 3703af9..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
@@ -58,10 +58,9 @@ public class SaltedIndexIT extends BaseIndexIT {
// Drop the HBase table metadata for this test
props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
// Don't put guideposts in
- // TODO: ovrides are not being correctly propagated into configs, but when
- // they are we can add this: props.put(QueryServices.HISTOGRAM_BYTE_DEPTH_ATTRIB, Long.toString(10000000));
+ 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 {
@@ -99,12 +98,6 @@ public class SaltedIndexIT extends BaseIndexIT {
testMutableTableIndexMaintanence(null, null);
}
- private void assertQueryPlan(String expectedPrefix, String expectedPostfix, String actual) {
- assertTrue("Expected query plan to start with [" + expectedPrefix + "], but got [" + actual + "]",
- actual.startsWith(expectedPrefix));
- assertTrue("Expected query plan to end with [" + expectedPostfix + "], but got [" + actual + "]", actual.endsWith(expectedPostfix));;
- }
-
private void testMutableTableIndexMaintanence(Integer tableSaltBuckets, Integer indexSaltBuckets) throws Exception {
String query;
ResultSet rs;
@@ -130,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);
@@ -186,15 +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 4-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";
String explainPlan2 = QueryUtil.getExplainPlan(rs);
- String prefix = "CLIENT PARALLEL ";
- assertQueryPlan(prefix, expectedPlan.substring(prefix.length()+1),explainPlan2);
+ 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
@@ -210,16 +200,16 @@ 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 6-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" +
"CLIENT 2 ROW LIMIT";
String explainPlan = QueryUtil.getExplainPlan(rs);
- assertQueryPlan(prefix, expectedPlan.substring(prefix.length()+1),explainPlan);
+ assertEquals(expectedPlan,explainPlan);
}
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/f4eb0cdf/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 050d889..b8497c5 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
@@ -105,6 +105,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;
@@ -437,19 +438,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.
@@ -463,10 +492,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);
final HBaseTestingUtility utility = new HBaseTestingUtility(conf);
try {
utility.startMiniCluster();
@@ -492,10 +522,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);
util.initializeCluster(NUM_SLAVES_BASE);
@@ -505,11 +536,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()) {
@@ -517,11 +548,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