You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/11/04 03:07:57 UTC

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #507: [IOTDB-282] add "show version"

jt2594838 commented on a change in pull request #507: [IOTDB-282] add "show version"
URL: https://github.com/apache/incubator-iotdb/pull/507#discussion_r341894235
 
 

 ##########
 File path: server/src/test/java/org/apache/iotdb/db/integration/IoTDBMetadataFetchIT.java
 ##########
 @@ -201,6 +202,29 @@ public void databaseMetaDataTest() throws ClassNotFoundException, SQLException {
     }
   }
 
+  @Test
+  public void showVersion() throws SQLException, ClassNotFoundException {
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    try (Connection connection = DriverManager
+        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+        Statement statement = connection.createStatement()) {
+      String sql = "show version";
+      try {
+        boolean hasResultSet = statement.execute(sql);
+        if(hasResultSet) {
+          try(ResultSet resultSet = statement.getResultSet()) {
+            ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
+            Assert.assertEquals(resultSetMetaData.getColumnLabel(1), IoTDBConstant.VERSION);
+          }
+        }
+      } catch (Exception e) {
+        fail(e.getMessage());
+      } finally {
+        connection.close();
 
 Review comment:
   This call is unnecessary since you have put `connection` to try resource control.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services