Skip to content

Commit 64f9665

Browse files
committed
Merge branch 'force_ci/object_type' of github.com:apache/iotdb into add_base32_path
2 parents 8d14cad + 0d64d51 commit 64f9665

File tree

55 files changed

+1092
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1092
-184
lines changed

LICENSE-binary

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ conditions of the following licenses.
213213
The binary distribution of this product bundles these dependencies under the
214214
following license. See licenses/ for text of these licenses.
215215

216-
Apache Software Foundation License 2.0
216+
Apache License 2.0
217217
--------------------------------------
218218
commons-cli:commons-cli:1.5.0
219219
com.nimbusds:content-type:2.2
@@ -223,7 +223,7 @@ com.fasterxml.jackson.core:jackson-annotations:2.16.2
223223
com.fasterxml.jackson.core:jackson-core:2.16.2
224224
com.fasterxml.jackson.core:jackson-databind:2.16.2
225225
jakarta.inject:jakarta.inject:2.6.1
226-
org.lz4:lz4-java:1.8.0
226+
at.yawk.lz4:lz4-java:1.10.0
227227
com.github.stephenc.jcip:jcip-annotations:1.0-1
228228
com.github.ben-manes.caffeine:caffeine:2.9.3
229229
org.eclipse.jetty:jetty-http:9.4.57.v20241219

dependencies.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"dependencies": [
3+
"at.yawk.lz4:lz4-java",
34
"cglib:cglib",
45
"ch.qos.logback:logback-classic",
56
"ch.qos.logback:logback-core",
@@ -155,7 +156,6 @@
155156
"org.jline:jline",
156157
"org.jvnet.mimepull:mimepull",
157158
"org.latencyutils:LatencyUtils",
158-
"org.lz4:lz4-java",
159159
"org.ops4j.pax.jdbc:pax-jdbc-common",
160160
"org.osgi:osgi.cmpn",
161161
"org.osgi:osgi.core",

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,8 @@ public void testGrantAndGrantOpt() throws SQLException {
981981
adminStmt.execute("CREATE USER user1 'password123456'");
982982
adminStmt.execute("CREATE USER user2 'password123456'");
983983
adminStmt.execute("CREATE USER user3 'password123456'");
984+
adminStmt.execute("CREATE USER user4 'password123456'");
985+
adminStmt.execute("CREATE USER user5 'password123456'");
984986
adminStmt.execute("CREATE ROLE testRole");
985987
adminStmt.execute("GRANT system ON root.** TO ROLE testRole WITH GRANT OPTION");
986988
adminStmt.execute("GRANT READ_DATA ON root.t1.** TO ROLE testRole");
@@ -1095,6 +1097,18 @@ public void testGrantAndGrantOpt() throws SQLException {
10951097
}
10961098
}
10971099

1100+
try (Connection userCon = EnvFactory.getEnv().getConnection("user4", "password123456");
1101+
Statement userStmt = userCon.createStatement()) {
1102+
adminStmt.execute("GRANT SYSTEM ON root.** TO USER user4");
1103+
try {
1104+
Assert.assertThrows(
1105+
SQLException.class, () -> userStmt.execute("GRANT SYSTEM ON root.** TO USER user5"));
1106+
adminStmt.execute("GRANT SYSTEM ON root.** TO USER user5");
1107+
} finally {
1108+
userStmt.close();
1109+
}
1110+
}
1111+
10981112
adminStmt.close();
10991113
}
11001114

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSyntaxIT.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.junit.experimental.categories.Category;
3838
import org.junit.runner.RunWith;
3939

40+
import java.io.File;
4041
import java.sql.Connection;
4142
import java.sql.SQLException;
4243
import java.sql.Statement;
@@ -757,4 +758,64 @@ public void testValidPipeWithoutWithSink() {
757758
fail(e.getMessage());
758759
}
759760
}
761+
762+
@Test
763+
public void testPipePluginValidation() {
764+
try (final Connection connection = senderEnv.getConnection();
765+
final Statement statement = connection.createStatement()) {
766+
try {
767+
statement.execute(
768+
"create pipePlugin TestProcessor as 'org.apache.iotdb.db.pipe.example.TestProcessor' USING URI 'xxx'");
769+
fail();
770+
} catch (final SQLException e) {
771+
Assert.assertEquals(
772+
"701: Untrusted uri xxx, current trusted_uri_pattern is file:.*", e.getMessage());
773+
}
774+
try {
775+
statement.execute(
776+
"create pipePlugin TestProcessor as 'org.apache.iotdb.db.pipe.example.TestProcessor' USING URI 'file:.*'");
777+
fail();
778+
} catch (final SQLException e) {
779+
Assert.assertEquals("701: URI is not hierarchical", e.getMessage());
780+
}
781+
try {
782+
statement.execute(
783+
String.format(
784+
"create pipePlugin TestProcessor as 'org.apache.iotdb.db.pipe.example.TestProcessor' USING URI '%s'",
785+
new File(
786+
System.getProperty("user.dir")
787+
+ File.separator
788+
+ "target"
789+
+ File.separator
790+
+ "test-classes"
791+
+ File.separator)
792+
.toURI()
793+
+ "PipePlugin.jar"));
794+
fail();
795+
} catch (final SQLException e) {
796+
Assert.assertEquals(
797+
"1603: Failed to get executable for PipePlugin TestProcessor, please check the URI.",
798+
e.getMessage());
799+
}
800+
try {
801+
statement.execute("drop pipePlugin test_processor");
802+
fail();
803+
} catch (final SQLException e) {
804+
Assert.assertEquals(
805+
"1601: Failed to drop pipe plugin TEST_PROCESSOR. Failures: TEST_PROCESSOR does not exist.",
806+
e.getMessage());
807+
}
808+
try {
809+
statement.execute("drop pipePlugin `Do-Nothing-Sink`");
810+
fail();
811+
} catch (final SQLException e) {
812+
Assert.assertEquals(
813+
"1601: Failed to drop PipePlugin [DO-NOTHING-SINK], the PipePlugin is a built-in PipePlugin",
814+
e.getMessage());
815+
}
816+
} catch (final SQLException e) {
817+
e.printStackTrace();
818+
fail(e.getMessage());
819+
}
820+
}
760821
}

integration-test/src/test/java/org/apache/iotdb/pipe/it/single/IoTDBPipePermissionIT.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
package org.apache.iotdb.pipe.it.single;
2121

22-
import org.apache.iotdb.commons.client.sync.SyncConfigNodeIServiceClient;
23-
import org.apache.iotdb.confignode.rpc.thrift.TShowPipeReq;
2422
import org.apache.iotdb.db.it.utils.TestUtils;
2523
import org.apache.iotdb.it.framework.IoTDBTestRunner;
2624
import org.apache.iotdb.itbase.category.MultiClusterIT1;
@@ -33,6 +31,7 @@
3331
import org.junit.runner.RunWith;
3432

3533
import java.sql.Connection;
34+
import java.sql.ResultSet;
3635
import java.sql.SQLException;
3736
import java.sql.Statement;
3837
import java.util.Arrays;
@@ -44,7 +43,7 @@
4443
public class IoTDBPipePermissionIT extends AbstractPipeSingleIT {
4544
@Test
4645
public void testSinkPermission() {
47-
TestUtils.executeNonQuery(env, "create user `thulab` 'passwd'", null);
46+
TestUtils.executeNonQuery(env, "create user `thulab` 'StrngPsWd@623451'", null);
4847

4948
// Shall fail if username is specified without password
5049
try (final Connection connection = env.getConnection(BaseEnv.TABLE_SQL_DIALECT);
@@ -90,7 +89,8 @@ public void testSinkPermission() {
9089
// Successfully alter
9190
try (final Connection connection = env.getConnection(BaseEnv.TABLE_SQL_DIALECT);
9291
final Statement statement = connection.createStatement()) {
93-
statement.execute("alter pipe a2b modify sink ('username'='thulab', 'password'='passwd')");
92+
statement.execute(
93+
"alter pipe a2b modify sink ('username'='thulab', 'password'='StrngPsWd@623451')");
9494
} catch (final SQLException e) {
9595
e.printStackTrace();
9696
fail("Alter pipe shall not fail if user and password are specified");
@@ -156,14 +156,12 @@ public void testSinkPermission() {
156156
}
157157

158158
// A user shall only see its own pipe
159-
try (final SyncConfigNodeIServiceClient client =
160-
(SyncConfigNodeIServiceClient) env.getLeaderConfigNodeConnection()) {
161-
Assert.assertEquals(
162-
1,
163-
client
164-
.showPipe(new TShowPipeReq().setIsTableModel(true).setUserName("thulab"))
165-
.pipeInfoList
166-
.size());
159+
try (final Connection connection =
160+
env.getConnection("thulab", "StrngPsWd@623451", BaseEnv.TABLE_SQL_DIALECT);
161+
final Statement statement = connection.createStatement()) {
162+
final ResultSet result = statement.executeQuery("show pipes");
163+
Assert.assertTrue(result.next());
164+
Assert.assertFalse(result.next());
167165
} catch (Exception e) {
168166
fail(e.getMessage());
169167
}
@@ -181,7 +179,8 @@ public void testSinkPermissionWithHistoricalDataAndTablePattern() {
181179
BaseEnv.TABLE_SQL_DIALECT,
182180
env,
183181
Arrays.asList(
184-
"create user thulab 'passwD@123456'", "grant INSERT on test.test1 to user thulab"),
182+
"create user thulab 'StrngPsWd@623451@123456'",
183+
"grant INSERT on test.test1 to user thulab"),
185184
null);
186185

187186
// Write some data
@@ -196,7 +195,7 @@ public void testSinkPermissionWithHistoricalDataAndTablePattern() {
196195
"create pipe a2b "
197196
+ "with source ('database'='test1', 'table'='test1') "
198197
+ "with processor('processor'='rename-database-processor', 'processor.new-db-name'='test') "
199-
+ "with sink ('sink'='write-back-sink', 'username'='thulab', 'password'='passwD@123456')");
198+
+ "with sink ('sink'='write-back-sink', 'username'='thulab', 'password'='StrngPsWd@623451@123456')");
200199
} catch (final SQLException e) {
201200
e.printStackTrace();
202201
fail("Create pipe without user shall succeed if use the current session");

integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ public void testInformationSchema() throws SQLException {
398398
"columns,INF,",
399399
"config_nodes,INF,",
400400
"configurations,INF,",
401+
"connections,INF,",
401402
"data_nodes,INF,",
402403
"databases,INF,",
403404
"functions,INF,",
@@ -575,6 +576,8 @@ public void testInformationSchema() throws SQLException {
575576
Assert.assertThrows(
576577
SQLException.class, () -> statement.execute("select * from config_nodes"));
577578
Assert.assertThrows(SQLException.class, () -> statement.execute("select * from data_nodes"));
579+
Assert.assertThrows(
580+
SQLException.class, () -> statement.executeQuery("select * from pipe_plugins"));
578581

579582
// Filter out not self-created pipes
580583
TestUtils.assertResultSetEqual(
@@ -583,12 +586,6 @@ public void testInformationSchema() throws SQLException {
583586
Collections.emptySet());
584587

585588
// No auth needed
586-
TestUtils.assertResultSetEqual(
587-
statement.executeQuery(
588-
"select * from pipe_plugins where plugin_name = 'IOTDB-THRIFT-SINK'"),
589-
"plugin_name,plugin_type,class_name,plugin_jar,",
590-
Collections.singleton(
591-
"IOTDB-THRIFT-SINK,Builtin,org.apache.iotdb.commons.pipe.agent.plugin.builtin.sink.iotdb.thrift.IoTDBThriftSink,null,"));
592589

593590
TestUtils.assertResultSetEqual(
594591
statement.executeQuery(
@@ -648,12 +645,13 @@ public void testInformationSchema() throws SQLException {
648645
"information_schema,nodes,INF,USING,null,SYSTEM VIEW,",
649646
"information_schema,config_nodes,INF,USING,null,SYSTEM VIEW,",
650647
"information_schema,data_nodes,INF,USING,null,SYSTEM VIEW,",
648+
"information_schema,connections,INF,USING,null,SYSTEM VIEW,",
651649
"test,test,INF,USING,test,BASE TABLE,",
652650
"test,view_table,100,USING,null,VIEW FROM TREE,")));
653651
TestUtils.assertResultSetEqual(
654652
statement.executeQuery("count devices from tables where status = 'USING'"),
655653
"count(devices),",
656-
Collections.singleton("19,"));
654+
Collections.singleton("20,"));
657655
TestUtils.assertResultSetEqual(
658656
statement.executeQuery(
659657
"select * from columns where table_name = 'queries' or database = 'test'"),

0 commit comments

Comments
 (0)