calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [11/50] [abbrv] calcite git commit: Following [CALCITE-897], empty string for boolean properties means true
Date Thu, 21 Jan 2016 22:38:48 GMT
Following [CALCITE-897], empty string for boolean properties means true


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

Branch: refs/heads/branch-release
Commit: 77e6f49c680cd154195e9e66c19356f0a2251bad
Parents: 970a8ca
Author: Julian Hyde <jhyde@apache.org>
Authored: Thu Oct 8 14:19:33 2015 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Sun Jan 10 00:51:24 2016 -0800

----------------------------------------------------------------------
 core/src/main/java/org/apache/calcite/util/Util.java    | 12 +++++++++++-
 .../test/java/org/apache/calcite/test/CalciteSuite.java |  2 +-
 .../java/org/apache/calcite/test/MongoAdapterIT.java    |  2 +-
 .../org/apache/calcite/adapter/tpcds/TpcdsTest.java     |  2 +-
 .../java/org/apache/calcite/adapter/tpch/TpchTest.java  |  2 +-
 site/_docs/history.md                                   |  2 +-
 site/_docs/howto.md                                     |  6 +++---
 .../java/org/apache/calcite/test/SplunkAdapterTest.java |  8 +++++---
 8 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/core/src/main/java/org/apache/calcite/util/Util.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/util/Util.java b/core/src/main/java/org/apache/calcite/util/Util.java
index f7db6a4..35dc0ff 100644
--- a/core/src/main/java/org/apache/calcite/util/Util.java
+++ b/core/src/main/java/org/apache/calcite/util/Util.java
@@ -2293,8 +2293,18 @@ public class Util {
    * @return Whether property is true
    */
   public static boolean getBooleanProperty(String property) {
+    return getBooleanProperty(property, false);
+  }
+
+  /** Returns the value of a system property as a boolean, returning a given
+   * default value if the property is not specified. */
+  public static boolean getBooleanProperty(String property,
+      boolean defaultValue) {
     final String v = System.getProperties().getProperty(property);
-    return v != null && ("".equals(v) || "true".equalsIgnoreCase(v));
+    if (v == null) {
+      return defaultValue;
+    }
+    return "".equals(v) || "true".equalsIgnoreCase(v);
   }
 
   //~ Inner Classes ----------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/core/src/test/java/org/apache/calcite/test/CalciteSuite.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/CalciteSuite.java b/core/src/test/java/org/apache/calcite/test/CalciteSuite.java
index 0ca057a..d9c9e4a 100644
--- a/core/src/test/java/org/apache/calcite/test/CalciteSuite.java
+++ b/core/src/test/java/org/apache/calcite/test/CalciteSuite.java
@@ -141,7 +141,7 @@ import org.junit.runners.Suite;
     PartiallyOrderedSetTest.class,
 
     // system tests and benchmarks (very slow, but usually only run if
-    // '-Dcalcite.test.slow=true' is specified)
+    // '-Dcalcite.test.slow' is specified)
     FoodmartTest.class
 })
 public class CalciteSuite {

http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/mongodb/src/test/java/org/apache/calcite/test/MongoAdapterIT.java
----------------------------------------------------------------------
diff --git a/mongodb/src/test/java/org/apache/calcite/test/MongoAdapterIT.java b/mongodb/src/test/java/org/apache/calcite/test/MongoAdapterIT.java
index 81628c5..0dc3df1 100644
--- a/mongodb/src/test/java/org/apache/calcite/test/MongoAdapterIT.java
+++ b/mongodb/src/test/java/org/apache/calcite/test/MongoAdapterIT.java
@@ -113,7 +113,7 @@ public class MongoAdapterIT {
    * included if "it" profile is activated ({@code -Pit}). To disable,
    * specify {@code -Dcalcite.test.mongodb=false} on the Java command line. */
   public static final boolean ENABLED =
-      Boolean.valueOf(System.getProperty("calcite.test.mongodb", "true"));
+      Util.getBooleanProperty("calcite.test.mongodb", true);
 
   /** Whether to run this test. */
   protected boolean enabled() {

http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
----------------------------------------------------------------------
diff --git a/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java b/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
index 15fc496..b7f1f1c 100644
--- a/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
+++ b/plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
@@ -47,7 +47,7 @@ import java.util.Random;
 
 /** Unit test for {@link org.apache.calcite.adapter.tpcds.TpcdsSchema}.
  *
- * <p>Only runs if {@code -Dcalcite.test.slow=true} is specified on the
+ * <p>Only runs if {@code -Dcalcite.test.slow} is specified on the
  * command-line.
  * (See {@link org.apache.calcite.test.CalciteAssert#ENABLE_SLOW}.)</p> */
 public class TpcdsTest {

http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
----------------------------------------------------------------------
diff --git a/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java b/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
index a7eb58b..0170520 100644
--- a/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
+++ b/plus/src/test/java/org/apache/calcite/adapter/tpch/TpchTest.java
@@ -37,7 +37,7 @@ import static org.junit.Assert.assertThat;
  *
  * <p>Because the TPC-H data generator takes time and memory to instantiate,
  * tests that read data (that is, most tests) only run
- * if {@code -Dcalcite.test.slow=true} is specified on the command-line.
+ * if {@code -Dcalcite.test.slow} is specified on the command-line.
  * (See {@link org.apache.calcite.test.CalciteAssert#ENABLE_SLOW}.)</p> */
 public class TpchTest {
   public static final String JAVA_VERSION =

http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/site/_docs/history.md
----------------------------------------------------------------------
diff --git a/site/_docs/history.md b/site/_docs/history.md
index 00a4cbb..6769758 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -286,7 +286,7 @@ Bug fixes, API changes and minor enhancements
 {: #v1-4-0}
 
 In addition to a large number of bug fixes and minor enhancements,
-this release includes improvements to lattices and matierlized views,
+this release includes improvements to lattices and materialized views,
 and adds a builder API so that you can easily create relational
 algebra expressions.
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/site/_docs/howto.md
----------------------------------------------------------------------
diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index 3a03364..2f2bddc 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -93,7 +93,7 @@ environment, as follows.
 * `-Dcalcite.test.slow` enables tests that take longer to execute. For
   example, there are tests that create virtual TPC-H and TPC-DS schemas
   in-memory and run tests from those benchmarks.
-* `-Dcalcite.test.splunk=true` enables tests that run against Splunk.
+* `-Dcalcite.test.splunk` enables tests that run against Splunk.
   Splunk must be installed and running.
 
 ## Running integration tests
@@ -417,8 +417,8 @@ Before you start:
 * Check that `README`, `README.md` and `doc/howto.md` have the correct version number.
 * Set `version.major` and `version.minor` in `pom.xml`.
 * Make sure build and tests succeed, including with
-  -Dcalcite.test.db={mysql,hsqldb}, -Dcalcite.test.slow=true,
-  -Dcalcite.test.mongodb=true, -Dcalcite.test.splunk=true.
+  -Dcalcite.test.db={mysql,hsqldb}, -Dcalcite.test.slow,
+  -Dcalcite.test.mongodb, -Dcalcite.test.splunk.
 * Trigger a
   <a href="https://scan.coverity.com/projects/2966">Coverity scan</a>
   by merging the latest code into the `julianhyde/coverity_scan` branch,

http://git-wip-us.apache.org/repos/asf/calcite/blob/77e6f49c/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
----------------------------------------------------------------------
diff --git a/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java b/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
index ce71d76..f67821d 100644
--- a/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
+++ b/splunk/src/test/java/org/apache/calcite/test/SplunkAdapterTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.calcite.test;
 
+import org.apache.calcite.util.Util;
+
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableSet;
 
@@ -46,9 +48,9 @@ public class SplunkAdapterTest {
 
   /** Whether to run Splunk tests. Disabled by default, because we do not expect
    * Splunk to be installed and populated data set. To enable,
-   * specify {@code -Dcalcite.test.splunk=true} on the Java command line. */
+   * specify {@code -Dcalcite.test.splunk} on the Java command line. */
   public static final boolean ENABLED =
-      Boolean.getBoolean("calcite.test.splunk");
+      Util.getBooleanProperty("calcite.test.splunk");
 
   /** Whether this test is enabled. Tests are disabled unless we know that
    * Splunk is present and loaded with the requisite data. */
@@ -240,7 +242,7 @@ public class SplunkAdapterTest {
         + "from \"splunk\".\"splunk\"",
         new Function<ResultSet, Void>() {
           public Void apply(ResultSet a0) {
-            final Set<String> actual = new HashSet<String>();
+            final Set<String> actual = new HashSet<>();
             try {
               while (a0.next()) {
                 actual.add(a0.getString(1));


Mime
View raw message