You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2021/04/28 03:10:11 UTC

[iotdb] branch fix_passIT created (now 73dedd1)

This is an automated email from the ASF dual-hosted git repository.

haonan pushed a change to branch fix_passIT
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 73dedd1  Fix AuthorizationIT failed caused by #3069

This branch includes the following new commits:

     new 73dedd1  Fix AuthorizationIT failed caused by #3069

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[iotdb] 01/01: Fix AuthorizationIT failed caused by #3069

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

haonan pushed a commit to branch fix_passIT
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 73dedd14112cff3f707ec1cccc12500e9031b7cb
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Apr 28 11:09:30 2021 +0800

    Fix AuthorizationIT failed caused by #3069
---
 .../db/integration/auth/IoTDBAuthorizationIT.java  | 29 ++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/server/src/test/java/org/apache/iotdb/db/integration/auth/IoTDBAuthorizationIT.java b/server/src/test/java/org/apache/iotdb/db/integration/auth/IoTDBAuthorizationIT.java
index 83f19fa..7f924c2 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/auth/IoTDBAuthorizationIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/auth/IoTDBAuthorizationIT.java
@@ -199,6 +199,31 @@ public class IoTDBAuthorizationIT {
   }
 
   @Test
+  public void illegalPasswordTest() throws ClassNotFoundException, SQLException {
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    boolean caught = false;
+    try (Connection adminCon =
+            DriverManager.getConnection(
+                Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+        Statement adminStmt = adminCon.createStatement()) {
+      adminStmt.execute("CREATE USER tempuser 'temppw '");
+    } catch (SQLException e) {
+      caught = true;
+    }
+    assertTrue(caught);
+
+    try (Connection adminCon =
+            DriverManager.getConnection(
+                Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+        Statement adminStmt = adminCon.createStatement()) {
+      adminStmt.execute("CREATE USER tempuser 'te'");
+    } catch (SQLException e) {
+      caught = true;
+    }
+    assertTrue(caught);
+  }
+
+  @Test
   public void updatePasswordTest() throws ClassNotFoundException, SQLException {
     Class.forName(Config.JDBC_DRIVER_NAME);
     try (Connection adminCon =
@@ -680,7 +705,7 @@ public class IoTDBAuthorizationIT {
         validateResultSet(resultSet, ans);
 
         for (int i = 0; i < 10; i++) {
-          adminStmt.execute("CREATE USER user" + i + " 'password " + i + "'");
+          adminStmt.execute("CREATE USER user" + i + " 'password" + i + "'");
         }
         resultSet = adminStmt.executeQuery("LIST USER");
         ans =
@@ -1005,7 +1030,7 @@ public class IoTDBAuthorizationIT {
     Statement adminStmt = adminCon.createStatement();
 
     for (int i = 0; i < 10; i++) {
-      adminStmt.execute("CREATE USER user" + i + " 'password " + i + "'");
+      adminStmt.execute("CREATE USER user" + i + " 'password" + i + "'");
     }
 
     adminStmt.execute("CREATE USER tempuser 'temppw'");