calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [05/19] incubator-calcite git commit: Make JdbcTest.testVersion more permissive, so that version.major and version.minor can be set just before a release, rather than just after as at present
Date Mon, 01 Jun 2015 17:56:19 GMT
Make JdbcTest.testVersion more permissive, so that version.major and version.minor can be set
just before a release, rather than just after as at present


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

Branch: refs/heads/master
Commit: fcab7a8879dde62aa0fe593dcd210acc97524b42
Parents: 6b16ca5
Author: Julian Hyde <jhyde@apache.org>
Authored: Wed May 27 17:40:15 2015 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Wed May 27 17:47:15 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/calcite/test/JdbcTest.java  | 56 +++++++++++---------
 doc/howto.md                                    |  1 +
 2 files changed, 33 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/fcab7a88/core/src/test/java/org/apache/calcite/test/JdbcTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/JdbcTest.java b/core/src/test/java/org/apache/calcite/test/JdbcTest.java
index 164af78..342e5bc 100644
--- a/core/src/test/java/org/apache/calcite/test/JdbcTest.java
+++ b/core/src/test/java/org/apache/calcite/test/JdbcTest.java
@@ -1049,42 +1049,50 @@ public class JdbcTest {
     assertEquals("Calcite JDBC Driver", metaData.getDriverName());
 
     final String driverVersion = metaData.getDriverVersion();
-    final int driverMajorVersion = metaData.getDriverMajorVersion();
-    final int driverMinorVersion = metaData.getDriverMinorVersion();
-    assertEquals(1, driverMajorVersion);
-    assertTrue(driverMinorVersion >= 0 && driverMinorVersion < 10);
+    final int driverMajor = metaData.getDriverMajorVersion();
+    final int driverMinor = metaData.getDriverMinorVersion();
+    assertEquals(1, driverMajor);
+    assertTrue(driverMinor >= 0 && driverMinor < 10);
 
     assertEquals("Calcite", metaData.getDatabaseProductName());
-    final String databaseProductVersion =
+    final String databaseVersion =
         metaData.getDatabaseProductVersion();
-    final int databaseMajorVersion = metaData.getDatabaseMajorVersion();
-    assertEquals(driverMajorVersion, databaseMajorVersion);
-    final int databaseMinorVersion = metaData.getDatabaseMinorVersion();
-    assertEquals(driverMinorVersion, databaseMinorVersion);
+    final int databaseMajor = metaData.getDatabaseMajorVersion();
+    assertEquals(driverMajor, databaseMajor);
+    final int databaseMinor = metaData.getDatabaseMinorVersion();
+    assertEquals(driverMinor, databaseMinor);
 
     // Check how version is composed of major and minor version. Note that
     // version is stored in pom.xml; major and minor version are
     // stored in org-apache-calcite-jdbc.properties, but derived from
     // version.major and version.minor in pom.xml.
-    assertTrue(driverVersion.startsWith(driverMajorVersion + "."));
-    String[] split = driverVersion.split("\\.");
-    assertTrue(split.length >= 2);
-    String majorMinor = driverMajorVersion + "." + driverMinorVersion;
-    assertTrue(driverVersion.equals(majorMinor)
-        || driverVersion.startsWith(majorMinor + ".")
-        || driverVersion.startsWith(majorMinor + "-"));
-
-    assertTrue(databaseProductVersion.startsWith("1."));
-    split = databaseProductVersion.split("\\.");
-    assertTrue(split.length >= 2);
-    majorMinor = databaseMajorVersion + "." + databaseMinorVersion;
-    assertTrue(databaseProductVersion.equals(majorMinor)
-        || databaseProductVersion.startsWith(majorMinor + ".")
-        || databaseProductVersion.startsWith(majorMinor + "-"));
+    //
+    // We are more permissive for snapshots.
+    // For instance, we allow 1.4.0-SNAPSHOT to match {major=1, minor=3}.
+    // Previously, this test would break the first build after a release.
+    assertTrue(driverVersion.startsWith(driverMajor + "."));
+    assertTrue(driverVersion.split("\\.").length >= 2);
+    assertTrue(driverVersion.equals(mm(driverMajor, driverMinor))
+        || driverVersion.startsWith(mm(driverMajor, driverMinor) + ".")
+        || driverVersion.startsWith(mm(driverMajor, driverMinor) + "-")
+        || driverVersion.endsWith("-SNAPSHOT")
+            && driverVersion.startsWith(mm(driverMajor, driverMinor + 1)));
+
+    assertTrue(databaseVersion.startsWith("1."));
+    assertTrue(databaseVersion.split("\\.").length >= 2);
+    assertTrue(databaseVersion.equals(mm(databaseMajor, databaseMinor))
+        || databaseVersion.startsWith(mm(databaseMajor, databaseMinor) + ".")
+        || databaseVersion.startsWith(mm(databaseMajor, databaseMinor) + "-")
+        || databaseVersion.endsWith("-SNAPSHOT")
+            && databaseVersion.startsWith(mm(driverMajor, driverMinor + 1)));
 
     connection.close();
   }
 
+  private String mm(int majorVersion, int minorVersion) {
+    return majorVersion + "." + minorVersion;
+  }
+
   /** Tests driver's implementation of {@link DatabaseMetaData#getColumns}. */
   @Test public void testMetaDataColumns()
       throws ClassNotFoundException, SQLException {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/fcab7a88/doc/howto.md
----------------------------------------------------------------------
diff --git a/doc/howto.md b/doc/howto.md
index 16b722a..96c9d71 100644
--- a/doc/howto.md
+++ b/doc/howto.md
@@ -399,6 +399,7 @@ Before you start:
 * Set up signing keys as described above.
 * Make sure you are using JDK 1.7 (not 1.8).
 * 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.


Mime
View raw message