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/09/25 12:15:52 UTC

[GitHub] [incubator-iotdb] kr11 commented on a change in pull request #421: [IOTDB-239] Add interface for showing devices

kr11 commented on a change in pull request #421: [IOTDB-239] Add interface for showing devices
URL: https://github.com/apache/incubator-iotdb/pull/421#discussion_r328086428
 
 

 ##########
 File path: jdbc/src/test/java/org/apache/iotdb/jdbc/IoTDBDatabaseMetadataTest.java
 ##########
 @@ -240,7 +240,41 @@ public void device() throws Exception {
     String standard = "column,\n" + "root.vehicle.d0,\n";
     try {
       ResultSet resultSet = databaseMetaData
-          .getColumns(Constant.CATALOG_DEVICE, "vehicle", null, null);
+          .getColumns(Constant.CATALOG_COLUMN, "vehicle", null, null);
+      ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
+      int colCount = resultSetMetaData.getColumnCount();
+      StringBuilder resultStr = new StringBuilder();
+      for (int i = 1; i < colCount + 1; i++) {
+        resultStr.append(resultSetMetaData.getColumnName(i)).append(",");
+      }
+      resultStr.append("\n");
+      while (resultSet.next()) {
+        for (int i = 1; i <= colCount; i++) {
+          resultStr.append(resultSet.getString(i)).append(",");
+        }
+        resultStr.append("\n");
+      }
+      Assert.assertEquals(resultStr.toString(), standard);
+    } catch (SQLException e) {
+      System.out.println(e);
 
 Review comment:
   Simply  print out the exception may bury the error and the TestCase will be regarded as `PASSED`. It's better to replace it with `e.printStackTrace(); fail(e.getMessage());`.

----------------------------------------------------------------
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