Skip to content

Commit be6857f

Browse files
shiwenyanJackieTien97
authored andcommitted
fixIT
1 parent 8d367a2 commit be6857f

File tree

5 files changed

+12
-29
lines changed

5 files changed

+12
-29
lines changed

integration-test/src/test/java/org/apache/iotdb/ainode/it/AINodeConcurrentInferenceIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static void tearDown() throws Exception {
6565

6666
private static void prepareDataForTreeModel() throws SQLException {
6767
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT);
68-
Statement statement = connection.createStatement()) {
68+
Statement statement = connection.createStatement()) {
6969
statement.execute("CREATE DATABASE root.AI");
7070
statement.execute("CREATE TIMESERIES root.AI.s WITH DATATYPE=DOUBLE, ENCODING=RLE");
7171
for (int i = 0; i < 2880; i++) {
@@ -79,7 +79,7 @@ private static void prepareDataForTreeModel() throws SQLException {
7979

8080
private static void prepareDataForTableModel() throws SQLException {
8181
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
82-
Statement statement = connection.createStatement()) {
82+
Statement statement = connection.createStatement()) {
8383
statement.execute("CREATE DATABASE root");
8484
statement.execute("CREATE TABLE root.AI (s DOUBLE FIELD)");
8585
for (int i = 0; i < 2880; i++) {
@@ -99,7 +99,7 @@ public void concurrentGPUCallInferenceTest() throws SQLException, InterruptedExc
9999
private void concurrentGPUCallInferenceTest(String modelId)
100100
throws SQLException, InterruptedException {
101101
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TREE_SQL_DIALECT);
102-
Statement statement = connection.createStatement()) {
102+
Statement statement = connection.createStatement()) {
103103
final int threadCnt = 10;
104104
final int loop = 100;
105105
final int predictLength = 512;
@@ -134,7 +134,7 @@ public void concurrentGPUForecastTest() throws SQLException, InterruptedExceptio
134134
public void concurrentGPUForecastTest(String modelId, String selectSql)
135135
throws SQLException, InterruptedException {
136136
try (Connection connection = EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
137-
Statement statement = connection.createStatement()) {
137+
Statement statement = connection.createStatement()) {
138138
final int threadCnt = 10;
139139
final int loop = 100;
140140
final int predictLength = 512;
@@ -164,7 +164,7 @@ private void checkModelOnSpecifiedDevice(Statement statement, String modelId, St
164164
for (int retry = 0; retry < 200; retry++) {
165165
Set<String> foundDevices = new HashSet<>();
166166
try (final ResultSet resultSet =
167-
statement.executeQuery(String.format("SHOW LOADED MODELS '%s'", device))) {
167+
statement.executeQuery(String.format("SHOW LOADED MODELS '%s'", device))) {
168168
while (resultSet.next()) {
169169
String deviceId = resultSet.getString("DeviceId");
170170
String loadedModelId = resultSet.getString("ModelId");

integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,9 @@ public void allPrivilegesTest() throws SQLException {
9797
Assert.assertThrows(
9898
SQLException.class, () -> userStmt.execute("LIST PRIVILEGES OF USER root"));
9999

100-
ResultSet resultSet = userStmt.executeQuery("LIST USER");
101-
Assert.assertTrue(resultSet.next());
102-
Assert.assertEquals("10000", resultSet.getString(1));
103-
Assert.assertEquals("tempuser", resultSet.getString(2));
104-
Assert.assertFalse(resultSet.next());
100+
Assert.assertThrows(SQLException.class, () -> userStmt.execute("LIST USER"));
105101

106-
resultSet = userStmt.executeQuery("LIST PRIVILEGES OF USER tempuser");
102+
ResultSet resultSet = userStmt.executeQuery("LIST PRIVILEGES OF USER tempuser");
107103
Assert.assertFalse(resultSet.next());
108104

109105
// 2. admin grant all privileges to user tempuser, So tempuser can do anything.
@@ -872,13 +868,11 @@ public void testListUserPrivilege() throws SQLException {
872868
try (Connection userCon = EnvFactory.getEnv().getConnection("tempuser", "temppw123456");
873869
Statement userStmt = userCon.createStatement()) {
874870
try {
875-
String ans = "10010,tempuser,\n";
876-
ResultSet resultSet = userStmt.executeQuery("LIST USER");
877-
validateResultSet(resultSet, ans);
871+
Assert.assertThrows(SQLException.class, () -> userStmt.execute("LIST USER"));
878872
// with list user privilege
879-
adminStmt.execute("GRANT SECURITY on root.** TO USER tempuser");
880-
resultSet = userStmt.executeQuery("LIST USER");
881-
ans =
873+
adminStmt.execute("GRANT MANAGE_USER on root.** TO USER tempuser");
874+
ResultSet resultSet = userStmt.executeQuery("LIST USER");
875+
String ans =
882876
"0,root,\n"
883877
+ "10010,tempuser,\n"
884878
+ "10000,user0,\n"

integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBRelationalAuthIT.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,6 @@ public void listUserPrivileges() throws SQLException {
6666
Statement adminStmt = adminCon.createStatement()) {
6767

6868
adminStmt.execute("create user testuser 'password123456'");
69-
try (Connection userCon =
70-
EnvFactory.getEnv()
71-
.getConnection("testuser", "password123456", BaseEnv.TABLE_SQL_DIALECT);
72-
Statement userStmt = userCon.createStatement()) {
73-
ResultSet resultSet = userStmt.executeQuery("LIST USER");
74-
Assert.assertTrue(resultSet.next());
75-
Assert.assertEquals("10000", resultSet.getString(1));
76-
Assert.assertEquals("testuser", resultSet.getString(2));
77-
Assert.assertFalse(resultSet.next());
78-
}
7969
adminStmt.execute("create database testdb");
8070
adminStmt.execute("GRANT MANAGE_USER to user testuser");
8171
Assert.assertThrows(

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/udf/UDTFForecast.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void beforeStart(UDFParameters parameters, UDTFConfigurations configurati
129129
.collect(
130130
Collectors.toMap(
131131
arr -> arr[0].trim(), arr -> arr[1].trim(), (v1, v2) -> v2 // 如果 key 重复,保留后一个
132-
));
132+
));
133133
this.inputRows = new LinkedList<>();
134134
List<TSDataType> tsDataTypeList = new ArrayList<>(this.types.size() - 1);
135135
for (int i = 0; i < this.types.size(); i++) {

iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/user/BasicUserManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
import static org.apache.iotdb.commons.auth.entity.User.INTERNAL_USER_END_ID;
4343

44-
4544
/** This class stores information of each user. */
4645
public abstract class BasicUserManager extends BasicRoleManager {
4746

0 commit comments

Comments
 (0)