You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/11/04 09:29:36 UTC
[iotdb] 01/03: add tests
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch issue-4308
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 1cd7a745f3f5c2b07e4018d5fbfedeb48d342246
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Thu Nov 4 16:42:52 2021 +0800
add tests
---
.../db/integration/auth/IoTDBAuthorizationIT.java | 35 ++++++++++++++++++----
1 file changed, 30 insertions(+), 5 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 c45d4ce..f5684a6 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
@@ -21,11 +21,6 @@ package org.apache.iotdb.db.integration.auth;
import org.apache.iotdb.db.utils.EnvironmentUtils;
import org.apache.iotdb.jdbc.Config;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
import java.sql.BatchUpdateException;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -37,6 +32,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -1148,4 +1148,29 @@ public class IoTDBAuthorizationIT {
assertTrue(expectedList.containsAll(result));
}
}
+
+ /** ISSUE-4308 */
+ @Test
+ public void testSelectUDTF() throws ClassNotFoundException, SQLException {
+ Class.forName(Config.JDBC_DRIVER_NAME);
+ try (Connection adminConnection =
+ DriverManager.getConnection(
+ Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
+ Statement adminStatement = adminConnection.createStatement()) {
+ adminStatement.execute("CREATE USER a_application 'a_application'");
+ adminStatement.execute("CREATE ROLE application_role");
+ adminStatement.execute("GRANT ROLE application_role PRIVILEGES READ_TIMESERIES ON root.test");
+ adminStatement.execute("GRANT application_role TO a_application");
+
+ adminStatement.execute("INSERT INTO root.test(time, s1) VALUES(1, 1)");
+ }
+
+ try (Connection userConnection =
+ DriverManager.getConnection(
+ Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "a_application", "a_application");
+ Statement userStatement = userConnection.createStatement();
+ ResultSet resultSet = userStatement.executeQuery("SELECT s1, sin(s1) FROM root.test")) {
+ assertTrue(resultSet.next());
+ }
+ }
}