From 460349e998b66249391feefc4413762578e0e46b Mon Sep 17 00:00:00 2001 From: Ling Hengqian Date: Wed, 13 Dec 2023 00:32:25 +0800 Subject: [PATCH] Provide relevant nativeTest and corresponding GraalVM Reachability Metadata for MySQL and Postgres Module (#29357) * Provide relevant nativeTest and corresponding GraalVM Reachability Metadata for MySQL and Postgres * Use testcontainers-java to test * Simplify the writing of `resource-config.json` --- distribution/proxy-native/pom.xml | 15 +- .../graalvm-native-image/_index.cn.md | 2 + .../graalvm-native-image/_index.en.md | 2 + .../type/PostgreSQLDatabaseType.java | 2 +- .../type/PostgreSQLDatabaseTypeTest.java | 2 +- .../8.0.31/reflect-config.json | 41 ++ .../HikariCP/4.0.3/reflect-config.json | 5 - .../reflect-config.json | 501 ++++++++++++------ .../resource-config.json | 56 +- pom.xml | 4 +- .../native-image-filter/extra-filter.json | 5 + test/native/pom.xml | 20 + .../commons/AbstractShardingCommonTest.java | 135 +++++ .../{ => jdbc/commons}/FileTestUtils.java | 2 +- ...ssBasedInlineShardingAlgorithmFixture.java | 2 +- ...QueryAssistedShardingEncryptAlgorithm.java | 2 +- .../{features => commons}/entity/Address.java | 2 +- .../{features => commons}/entity/Order.java | 2 +- .../entity/OrderItem.java | 2 +- .../repository/AddressRepository.java | 4 +- .../repository/OrderItemRepository.java | 27 +- .../repository/OrderRepository.java | 27 +- .../natived/jdbc/databases/MySQLTest.java | 111 ++++ .../natived/jdbc/databases/PostgresTest.java | 52 ++ .../natived/jdbc/features/EncryptTest.java | 20 +- .../test/natived/jdbc/features/MaskTest.java | 20 +- .../jdbc/features/ReadWriteSplittingTest.java | 20 +- .../natived/jdbc/features/ShadowTest.java | 20 +- .../natived/jdbc/features/ShardingTest.java | 109 +--- .../reflect-config.json | 8 +- .../resource-config.json | 19 +- ...hardingsphere.encrypt.spi.EncryptAlgorithm | 2 +- .../src/test/resources/logback-test.xml | 34 -- .../test-native/yaml/databases/mysql.yaml | 78 +++ .../yaml/databases/postgresql.yaml | 72 +++ .../yaml/features}/encrypt.yaml | 0 .../yaml/features}/mask.yaml | 0 .../yaml/features}/readwrite-splitting.yaml | 0 .../yaml/features}/shadow.yaml | 0 .../yaml/features}/sharding.yaml | 2 +- test/pom.xml | 6 +- 41 files changed, 1043 insertions(+), 390 deletions(-) create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json create mode 100644 test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/AbstractShardingCommonTest.java rename test/native/src/test/java/org/apache/shardingsphere/test/natived/{ => jdbc/commons}/FileTestUtils.java (97%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/algorithm/ClassBasedInlineShardingAlgorithmFixture.java (96%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java (95%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/entity/Address.java (94%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/entity/Order.java (94%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/entity/OrderItem.java (94%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/repository/AddressRepository.java (96%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/repository/OrderItemRepository.java (87%) rename test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/{features => commons}/repository/OrderRepository.java (88%) create mode 100644 test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java create mode 100644 test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java delete mode 100644 test/native/src/test/resources/logback-test.xml create mode 100644 test/native/src/test/resources/test-native/yaml/databases/mysql.yaml create mode 100644 test/native/src/test/resources/test-native/yaml/databases/postgresql.yaml rename test/native/src/test/resources/{yaml => test-native/yaml/features}/encrypt.yaml (100%) rename test/native/src/test/resources/{yaml => test-native/yaml/features}/mask.yaml (100%) rename test/native/src/test/resources/{yaml => test-native/yaml/features}/readwrite-splitting.yaml (100%) rename test/native/src/test/resources/{yaml => test-native/yaml/features}/shadow.yaml (100%) rename test/native/src/test/resources/{yaml => test-native/yaml/features}/sharding.yaml (97%) diff --git a/distribution/proxy-native/pom.xml b/distribution/proxy-native/pom.xml index c906ed14667fc..1530b227d3763 100644 --- a/distribution/proxy-native/pom.xml +++ b/distribution/proxy-native/pom.xml @@ -72,23 +72,11 @@ release.native - true - true - true - true - true + 17 apache-shardingsphere-${project.version} - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - 17 - 17 - - org.graalvm.buildtools native-maven-plugin @@ -101,6 +89,7 @@ true + 0.3.5 diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md index 1bba59c8487c5..a934dcbea41a9 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md @@ -210,6 +210,8 @@ ShardingSphere 定义了 `nativeTestInShardingSphere` 的 Maven Profile 用于 假设贡献者处于新的 Ubuntu 22.04.3 LTS 实例下,其可通过如下 bash 命令通过 SDKMAN! 管理 JDK 和工具链, 并为 `shardingsphere-test-native` 子模块执行 nativeTest。 +你必须安装 Docker Engine 或 PodMan 等 container tools 以执行 `testcontainers-java` 相关的单元测试。 + ```bash sudo apt install unzip zip curl sed -y curl -s "https://get.sdkman.io" | bash diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md index f93b27e09f693..73832dcc9e05a 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md @@ -219,6 +219,8 @@ ShardingSphere defines the Maven Profile of `nativeTestInShardingSphere` for exe Assuming that the contributor is under a new Ubuntu 22.04.3 LTS instance, Contributors can manage the JDK and tool chain through `SDKMAN!` through the following bash command, and execute nativeTest for the `shardingsphere-test-native` submodule. +You must install container tools such as Docker Engine or PodMan to execute `testcontainers-java` related unit tests. + ```bash sudo apt install unzip zip curl sed -y curl -s "https://get.sdkman.io" | bash diff --git a/infra/database/type/postgresql/src/main/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseType.java b/infra/database/type/postgresql/src/main/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseType.java index 049f06edf82de..6a0ee5c741e2c 100644 --- a/infra/database/type/postgresql/src/main/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseType.java +++ b/infra/database/type/postgresql/src/main/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseType.java @@ -29,7 +29,7 @@ public final class PostgreSQLDatabaseType implements DatabaseType { @Override public Collection getJdbcUrlPrefixes() { - return Arrays.asList(String.format("jdbc:%s:", getType().toLowerCase()), "jdbc:tc:postgres:"); + return Arrays.asList(String.format("jdbc:%s:", getType().toLowerCase()), "jdbc:tc:postgresql:"); } @Override diff --git a/infra/database/type/postgresql/src/test/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseTypeTest.java b/infra/database/type/postgresql/src/test/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseTypeTest.java index 840f5885a1174..c784dee54f970 100644 --- a/infra/database/type/postgresql/src/test/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseTypeTest.java +++ b/infra/database/type/postgresql/src/test/java/org/apache/shardingsphere/infra/database/postgresql/type/PostgreSQLDatabaseTypeTest.java @@ -30,6 +30,6 @@ class PostgreSQLDatabaseTypeTest { @Test void assertGetJdbcUrlPrefixes() { - assertThat(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL").getJdbcUrlPrefixes(), is(Arrays.asList("jdbc:postgresql:", "jdbc:tc:postgres:"))); + assertThat(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL").getJdbcUrlPrefixes(), is(Arrays.asList("jdbc:postgresql:", "jdbc:tc:postgresql:"))); } } diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json new file mode 100644 index 0000000000000..bb5e3f4c34a4f --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.mysql/mysql-connector-j/8.0.31/reflect-config.json @@ -0,0 +1,41 @@ +[ +{ + "condition":{"typeReachable":"com.mysql.cj.jdbc.ConnectionImpl"}, + "name":"com.mysql.cj.PerConnectionLRUFactory", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"com.mysql.cj.util.Util"}, + "name":"com.mysql.cj.conf.url.SingleConnectionUrl", + "methods":[{"name":"","parameterTypes":["com.mysql.cj.conf.ConnectionUrlParser","java.util.Properties"] }] +}, +{ + "condition":{"typeReachable":"com.mysql.cj.exceptions.ExceptionFactory"}, + "name":"com.mysql.cj.exceptions.CJCommunicationsException", + "methods":[{"name":"","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"com.mysql.cj.jdbc.NonRegisteringDriver"}, + "name":"com.mysql.cj.jdbc.AbandonedConnectionCleanupThread" +}, +{ + "condition":{"typeReachable":"com.mysql.cj.log.LogFactory"}, + "name":"com.mysql.cj.log.StandardLogger", + "methods":[{"name":"","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"com.mysql.cj.protocol.AbstractSocketConnection"}, + "name":"com.mysql.cj.protocol.StandardSocketFactory", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"com.mysql.cj.NativeSession"}, + "name":"com.mysql.cj.util.PerVmServerConfigCacheFactory", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"com.mysql.cj.protocol.StandardSocketFactory"}, + "name":"java.lang.Thread", + "fields":[{"name":"threadLocalRandomProbe"}] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json index 9022218575148..1360182ea865c 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json @@ -11,10 +11,5 @@ "name":"com.zaxxer.hikari.HikariDataSource", "fields":[{"name":"dataSourceProperties"}, {"name":"jdbcUrl"}], "methods":[{"name":"","parameterTypes":[] }, {"name":"getAllowPoolSuspension","parameterTypes":[] }, {"name":"getAutoCommit","parameterTypes":[] }, {"name":"getIsolateInternalQueries","parameterTypes":[] }, {"name":"getReadOnly","parameterTypes":[] }, {"name":"getRegisterMbeans","parameterTypes":[] }, {"name":"isClosed","parameterTypes":[] }, {"name":"isRunning","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"com.zaxxer.hikari.util.PropertyElf"}, - "name":"com.zaxxer.hikari.HikariDataSource", - "methods":[{"name":"getAllowPoolSuspension","parameterTypes":[] }, {"name":"getAutoCommit","parameterTypes":[] }, {"name":"getIsolateInternalQueries","parameterTypes":[] }, {"name":"getReadOnly","parameterTypes":[] }, {"name":"getRegisterMbeans","parameterTypes":[] }] } ] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json index be0b4bf5e354e..6a610a05e3a68 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json @@ -33,14 +33,11 @@ }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"}, - "name":"java.lang.Boolean" + "name":"java.lang.Boolean", + "fields":[{"name":"FALSE"}, {"name":"TRUE"}] }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"}, - "name":"java.lang.Thread" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngineFactory"}, "name":"java.lang.Thread", "fields":[{"name":"threadLocalRandomProbe"}] }, @@ -68,32 +65,34 @@ "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration", "allDeclaredFields":true, "queryAllPublicMethods":true, - "methods":[{"name":"","parameterTypes":[] }, {"name":"setTables","parameterTypes":["java.util.Collection"] }] + "methods":[{"name":"","parameterTypes":[] }, {"name":"getTables","parameterTypes":[] }, {"name":"setTables","parameterTypes":["java.util.Collection"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.broadcast.yaml.swapper.NewYamlBroadcastRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getTables","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfigurationBeanInfo" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, - "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration" + "condition":{"typeReachable":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfigurationCustomizer" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository"}, + "condition":{"typeReachable":"org.apache.shardingsphere.driver.ShardingSphereDriver"}, "name":"org.apache.shardingsphere.driver.ShardingSphereDriver" }, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration"}, - "name":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration", - "methods":[{"name":"setSqlParser","parameterTypes":["org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration"] }] -}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, "name":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration", "allDeclaredFields":true, - "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSources","parameterTypes":["java.util.Map"] }, {"name":"setMode","parameterTypes":["org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }, {"name":"setRules","parameterTypes":["java.util.Collection"] }] + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSources","parameterTypes":["java.util.Map"] }, {"name":"setMode","parameterTypes":["org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }, {"name":"setRules","parameterTypes":["java.util.Collection"] }, {"name":"setSqlParser","parameterTypes":["org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.rule.EncryptRule"}, @@ -109,6 +108,10 @@ "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlCompatibleEncryptRuleConfiguration" }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration"}, "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration", @@ -117,8 +120,12 @@ "methods":[{"name":"","parameterTypes":[] }, {"name":"setEncryptors","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, - "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration" + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfiguration"}, @@ -127,6 +134,14 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"getEncryptorName","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }, {"name":"setEncryptorName","parameterTypes":["java.lang.String"] }, {"name":"setName","parameterTypes":["java.lang.String"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfiguration"}, "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfiguration", @@ -134,6 +149,20 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"getAssistedQuery","parameterTypes":[] }, {"name":"getCipher","parameterTypes":[] }, {"name":"getLikeQuery","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }, {"name":"setAssistedQuery","parameterTypes":["org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfiguration"] }, {"name":"setCipher","parameterTypes":["org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfiguration"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfigurationCustomizer" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.swapper.NewYamlEncryptRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] +}, { "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration"}, "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration", @@ -142,10 +171,12 @@ "methods":[{"name":"","parameterTypes":[] }, {"name":"setColumns","parameterTypes":["java.util.Map"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.swapper.NewYamlEncryptRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, @@ -155,48 +186,55 @@ "condition":{"typeReachable":"org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheBuilder"}, "name":"org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheLoader" }, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.swapper.NewYamlEncryptRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] -}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration"}, "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", "allDeclaredFields":true, - "methods":[{"name":"","parameterTypes":[] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }, {"name":"setType","parameterTypes":["java.lang.String"] }] + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }, {"name":"setType","parameterTypes":["java.lang.String"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.swapper.NewYamlMaskRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfigurationBeanInfo" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.swapper.NewYamlShadowRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.swapper.NewYamlShardingRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration", "allDeclaredFields":true, + "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"setRepository","parameterTypes":["org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration"] }, {"name":"setType","parameterTypes":["java.lang.String"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration", "allDeclaredFields":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"setType","parameterTypes":["java.lang.String"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.constructor.ShardingSphereYamlConstructor"}, "name":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts", @@ -208,10 +246,65 @@ "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.metadata.persist.service.schema.NewTableMetaDataPersistService"}, + "condition":{"typeReachable":"org.apache.shardingsphere.metadata.persist.service.schema.ShardingSphereTableRowDataPersistService"}, + "name":"org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData", + "allDeclaredFields":true, + "methods":[{"name":"getRows","parameterTypes":[] }, {"name":"getUniqueKey","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.metadata.database.schema.builder.SystemSchemaBuilder"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereColumn", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }, {"name":"getDataType","parameterTypes":[] }, {"name":"isPrimaryKey","parameterTypes":[] }, {"name":"isGenerated","parameterTypes":[] }, {"name":"isCaseSensitive","parameterTypes":[] }, {"name":"isVisible","parameterTypes":[] }, {"name":"isUnsigned","parameterTypes":[] }, {"name":"isNullable","parameterTypes":[] }, {"name":"setCaseSensitive","parameterTypes":["boolean"] }, {"name":"setDataType","parameterTypes":["int"] }, {"name":"setGenerated","parameterTypes":["boolean"] }, {"name":"setName","parameterTypes":["java.lang.String"] }, {"name":"setPrimaryKey","parameterTypes":["boolean"] }, {"name":"setUnsigned","parameterTypes":["boolean"] }, {"name":"setVisible","parameterTypes":["boolean"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereColumnBeanInfo"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereColumnBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereColumnCustomizer"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereColumnCustomizer" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndex"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndex", + "queryAllPublicMethods":true, + "allDeclaredFields":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getColumns","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }, {"name":"isUnique","parameterTypes":[] }, {"name":"setName","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndexBeanInfo"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndexBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndexCustomizer"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndexCustomizer" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTable"}, "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTable", "allDeclaredFields":true, - "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getConstraints","parameterTypes":[] }, {"name":"getIndexes","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setColumns","parameterTypes":["java.util.Map"] }, {"name":"setIndexes","parameterTypes":["java.util.Map"] }, {"name":"setName","parameterTypes":["java.lang.String"] }, {"name":"getColumns","parameterTypes":[] }, {"name":"getConstraints","parameterTypes":[] }, {"name":"getIndexes","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTableBeanInfo"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTableBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTableCustomizer"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTableCustomizer" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.keygen.uuid.algorithm.UUIDKeyGenerateAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, @@ -268,6 +361,14 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"setMaskAlgorithms","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfiguration"}, "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfiguration", @@ -275,6 +376,20 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"getLogicColumn","parameterTypes":[] }, {"name":"getMaskAlgorithm","parameterTypes":[] }, {"name":"setMaskAlgorithm","parameterTypes":["java.lang.String"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfigurationCustomizer" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.swapper.NewYamlMaskRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] +}, { "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration"}, "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration", @@ -283,18 +398,20 @@ "methods":[{"name":"","parameterTypes":[] }, {"name":"setColumns","parameterTypes":["java.util.Map"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.swapper.NewYamlMaskRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfigurationCustomizer" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.subscriber.StandaloneProcessSubscriber"}, "name":"org.apache.shardingsphere.mode.manager.standalone.subscriber.StandaloneProcessSubscriber", "queryAllDeclaredMethods":true }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.subscriber.StandaloneProcessSubscriber"}, "name":"org.apache.shardingsphere.mode.process.ProcessSubscriber", "queryAllDeclaredMethods":true }, @@ -309,6 +426,16 @@ "allDeclaredFields":true, "methods":[{"name":"","parameterTypes":[] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.subsciber.NewConfigurationChangedSubscriber"}, + "name":"org.apache.shardingsphere.mode.subsciber.NewConfigurationChangedSubscriber", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.NewStandaloneContextManagerBuilder"}, + "name":"org.apache.shardingsphere.mode.subsciber.RuleItemChangedSubscriber", + "queryAllDeclaredMethods":true +}, { "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration"}, "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration", @@ -316,10 +443,24 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"getInitialCapacity","parameterTypes":[] }, {"name":"getMaximumSize","parameterTypes":[] }, {"name":"setInitialCapacity","parameterTypes":["int"] }, {"name":"setMaximumSize","parameterTypes":["long"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration" }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.swapper.NewYamlSQLParserRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getParseTreeCache","parameterTypes":[] }, {"name":"getSqlStatementCache","parameterTypes":[] }, {"name":"isSqlCommentParseEnabled","parameterTypes":[] }] +}, { "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration"}, "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration", @@ -328,10 +469,12 @@ "methods":[{"name":"","parameterTypes":[] }, {"name":"setParseTreeCache","parameterTypes":["org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration"] }, {"name":"setSqlCommentParseEnabled","parameterTypes":["boolean"] }, {"name":"setSqlStatementCache","parameterTypes":["org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.swapper.NewYamlSQLParserRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getParseTreeCache","parameterTypes":[] }, {"name":"getSqlStatementCache","parameterTypes":[] }, {"name":"isSqlCommentParseEnabled","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule"}, @@ -359,6 +502,20 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSources","parameterTypes":["java.util.Map"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfigurationCustomizer" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.swapper.NewYamlReadwriteSplittingRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getLoadBalancerName","parameterTypes":[] }, {"name":"getReadDataSourceNames","parameterTypes":[] }, {"name":"getTransactionalReadQueryStrategy","parameterTypes":[] }, {"name":"getWriteDataSourceName","parameterTypes":[] }] +}, { "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration"}, "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration", @@ -367,10 +524,12 @@ "methods":[{"name":"","parameterTypes":[] }, {"name":"setReadDataSourceNames","parameterTypes":["java.util.List"] }, {"name":"setWriteDataSourceName","parameterTypes":["java.lang.String"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.swapper.NewYamlReadwriteSplittingRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getLoadBalancerName","parameterTypes":[] }, {"name":"getReadDataSourceNames","parameterTypes":[] }, {"name":"getTransactionalReadQueryStrategy","parameterTypes":[] }, {"name":"getWriteDataSourceName","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.shadow.rule.ShadowRule"}, @@ -399,11 +558,12 @@ "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSources","parameterTypes":["java.util.Map"] }, {"name":"setDefaultShadowAlgorithmName","parameterTypes":["java.lang.String"] }, {"name":"setShadowAlgorithms","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration"}, - "name":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration", - "allDeclaredFields":true, - "queryAllPublicMethods":true, - "methods":[{"name":"","parameterTypes":[] }, {"name":"setProductionDataSourceName","parameterTypes":["java.lang.String"] }, {"name":"setShadowDataSourceName","parameterTypes":["java.lang.String"] }] + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.swapper.NewYamlShadowRuleConfigurationSwapper"}, @@ -412,11 +572,19 @@ "methods":[{"name":"getProductionDataSourceName","parameterTypes":[] }, {"name":"getShadowDataSourceName","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration"}, - "name":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration", + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration", "allDeclaredFields":true, "queryAllPublicMethods":true, - "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSourceNames","parameterTypes":["java.util.Collection"] }, {"name":"setShadowAlgorithmNames","parameterTypes":["java.util.Collection"] }] + "methods":[{"name":"","parameterTypes":[] }, {"name":"setProductionDataSourceName","parameterTypes":["java.lang.String"] }, {"name":"setShadowDataSourceName","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.swapper.NewYamlShadowRuleConfigurationSwapper"}, @@ -425,18 +593,23 @@ "methods":[{"name":"getDataSourceNames","parameterTypes":[] }, {"name":"getShadowAlgorithmNames","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, - "name":"org.apache.shardingsphere.sharding.algorithm.audit.DMLShardingConditionsShardingAuditAlgorithm", - "methods":[{"name":"","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSourceNames","parameterTypes":["java.util.Collection"] }, {"name":"setShadowAlgorithmNames","parameterTypes":["java.util.Collection"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, - "name":"org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm", - "methods":[{"name":"","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, - "name":"org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm", + "name":"org.apache.shardingsphere.sharding.algorithm.audit.DMLShardingConditionsShardingAuditAlgorithm", "methods":[{"name":"","parameterTypes":[] }] }, { @@ -489,10 +662,6 @@ "name":"org.apache.shardingsphere.sharding.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm", "methods":[{"name":"","parameterTypes":[] }] }, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, - "name":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration" -}, { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration"}, "name":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration", @@ -500,18 +669,28 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"setAuditors","parameterTypes":["java.util.Map"] }, {"name":"setDefaultDatabaseStrategy","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration"] }, {"name":"setKeyGenerators","parameterTypes":["java.util.Map"] }, {"name":"setShardingAlgorithms","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration"}, "name":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration", "allDeclaredFields":true, "queryAllPublicMethods":true, - "methods":[{"name":"","parameterTypes":[] }, {"name":"setActualDataNodes","parameterTypes":["java.lang.String"] }, {"name":"setKeyGenerateStrategy","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration"] }] + "methods":[{"name":"","parameterTypes":[] }, {"name":"setActualDataNodes","parameterTypes":["java.lang.String"] }, {"name":"setKeyGenerateStrategy","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration"] }, {"name":"getActualDataNodes","parameterTypes":[] }, {"name":"getAuditStrategy","parameterTypes":[] }, {"name":"getDatabaseStrategy","parameterTypes":[] }, {"name":"getKeyGenerateStrategy","parameterTypes":[] }, {"name":"getLogicTable","parameterTypes":[] }, {"name":"getTableStrategy","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.swapper.NewYamlShardingRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getActualDataNodes","parameterTypes":[] }, {"name":"getAuditStrategy","parameterTypes":[] }, {"name":"getDatabaseStrategy","parameterTypes":[] }, {"name":"getKeyGenerateStrategy","parameterTypes":[] }, {"name":"getLogicTable","parameterTypes":[] }, {"name":"getTableStrategy","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration"}, @@ -520,18 +699,28 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"getColumn","parameterTypes":[] }, {"name":"getKeyGeneratorName","parameterTypes":[] }, {"name":"setColumn","parameterTypes":["java.lang.String"] }, {"name":"setKeyGeneratorName","parameterTypes":["java.lang.String"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration"}, "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration", "allDeclaredFields":true, "queryAllPublicMethods":true, - "methods":[{"name":"","parameterTypes":[] }, {"name":"setStandard","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfiguration"] }] + "methods":[{"name":"","parameterTypes":[] }, {"name":"setStandard","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfiguration"] }, {"name":"getComplex","parameterTypes":[] }, {"name":"getHint","parameterTypes":[] }, {"name":"getNone","parameterTypes":[] }, {"name":"getStandard","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.swapper.NewYamlShardingRuleConfigurationSwapper"}, - "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration", - "allDeclaredFields":true, - "methods":[{"name":"getComplex","parameterTypes":[] }, {"name":"getHint","parameterTypes":[] }, {"name":"getNone","parameterTypes":[] }, {"name":"getStandard","parameterTypes":[] }] + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfigurationCustomizer" }, { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfiguration"}, @@ -540,6 +729,14 @@ "queryAllPublicMethods":true, "methods":[{"name":"","parameterTypes":[] }, {"name":"getShardingAlgorithmName","parameterTypes":[] }, {"name":"getShardingColumn","parameterTypes":[] }, {"name":"setShardingAlgorithmName","parameterTypes":["java.lang.String"] }, {"name":"setShardingColumn","parameterTypes":["java.lang.String"] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, "name":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfiguration" @@ -550,17 +747,30 @@ "allDeclaredFields":true, "methods":[{"name":"getDefaultDataSource","parameterTypes":[] }, {"name":"getTables","parameterTypes":[] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfiguration"}, + "name":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfiguration", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfigurationBeanInfo"}, + "name":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfigurationBeanInfo" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfigurationCustomizer"}, + "name":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfigurationCustomizer" +}, { "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.cache.ParseTreeCacheBuilder"}, "name":"org.apache.shardingsphere.sql.parser.core.database.cache.ParseTreeCacheLoader" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.SQLParserFactory"}, + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.mysql.parser.MySQLLexer"}, "name":"org.apache.shardingsphere.sql.parser.mysql.parser.MySQLLexer", "methods":[{"name":"","parameterTypes":["org.antlr.v4.runtime.CharStream"] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.SQLParserFactory"}, + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParser"}, "name":"org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParser", "methods":[{"name":"","parameterTypes":["org.antlr.v4.runtime.TokenStream"] }] }, @@ -570,15 +780,10 @@ "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"}, + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.mysql.visitor.statement.type.MySQLDDLStatementVisitor"}, "name":"org.apache.shardingsphere.sql.parser.mysql.visitor.statement.type.MySQLDDLStatementVisitor", "methods":[{"name":"","parameterTypes":[] }] }, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheLoader"}, - "name":"org.apache.shardingsphere.sql.parser.mysql.visitor.statement.type.MySQLDMLStatementVisitor", - "methods":[{"name":"","parameterTypes":[] }] -}, { "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, "name":"org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.OpenGaussStatementVisitorFacade", @@ -589,97 +794,71 @@ "name":"org.apache.shardingsphere.sql.parser.oracle.visitor.statement.OracleStatementVisitorFacade", "methods":[{"name":"","parameterTypes":[] }] }, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLLexer"}, + "name":"org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLLexer", + "methods":[{"name":"","parameterTypes":["org.antlr.v4.runtime.CharStream"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLParser"}, + "name":"org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLParser", + "methods":[{"name":"","parameterTypes":["org.antlr.v4.runtime.TokenStream"] }] +}, { "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, "name":"org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.PostgreSQLStatementVisitorFacade", "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.binder.statement.dml.DeleteStatementBinder"}, + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.type.PostgreSQLDDLStatementVisitor"}, + "name":"org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.type.PostgreSQLDDLStatementVisitor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLDeleteStatement"}, "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLDeleteStatement", "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementBinder"}, + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement"}, "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement", "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementBinder"}, + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement"}, "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement", "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, - "name":"org.apache.shardingsphere.sql.parser.sql92.visitor.statement.SQL92StatementVisitorFacade", + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dml.PostgreSQLDeleteStatement"}, + "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dml.PostgreSQLDeleteStatement", "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, - "name":"org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.SQLServerStatementVisitorFacade", + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dml.PostgreSQLInsertStatement"}, + "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dml.PostgreSQLInsertStatement", "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.infra.connection.refresher.type.table.DropTableStatementSchemaRefresher"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.context.ConfigurationContextManager"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.NewStandaloneContextManagerBuilder"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.NewStandaloneModeContextManager"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.metadata.NewMetaDataContextsFactory"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dml.PostgreSQLSelectStatement"}, + "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dml.PostgreSQLSelectStatement", + "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.OptimizerContextFactory"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.sql92.visitor.statement.SQL92StatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.planner.OptimizerPlannerContextFactory"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.SQLServerStatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] }, { "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils"}, "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils", "queryAllPublicMethods":true }, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationPlannerUtils"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.rule.SQLFederationRule"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.rule.builder.SQLFederationRuleBuilder"}, - "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" -}, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, "name":"org.apache.shardingsphere.sqlfederation.yaml.config.YamlSQLFederationRuleConfiguration" @@ -700,5 +879,15 @@ { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, "name":"org.apache.shardingsphere.transaction.yaml.config.YamlTransactionRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheLoader"}, + "name":"org.apache.shardingsphere.sql.parser.mysql.visitor.statement.type.MySQLDMLStatementVisitor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.type.PostgreSQLDMLStatementVisitor", + "methods":[{"name":"","parameterTypes":[] }] } ] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json index c2dc772615781..254d3880d42ac 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json @@ -1,11 +1,26 @@ { "resources":{ "includes":[{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.ShardingSphereDriver"}, + "pattern":"\\QMETA-INF/services/java.sql.Driver\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.authority.spi.AuthorityRegistryProvider\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.driver.state.DriverState\\E" + }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.metadata.persist.NewMetaDataPersistService"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.config.rule.decorator.RuleConfigurationDecorator\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.connection.refresher.MetaDataRefresher\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.database.core.connector.ConnectionPropertiesParser\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.metadata.data.loader.MetaDataLoader"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.database.core.metadata.data.loader.DialectMetaDataLoader\\E" @@ -33,6 +48,9 @@ }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.core.InlineExpressionParserFactory"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.instance.metadata.InstanceMetaDataBuilder\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.merge.MergeEngine"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.merge.engine.ResultProcessEngine\\E" @@ -40,7 +58,7 @@ "condition":{"typeReachable":"org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilder"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.metadata.database.schema.reviser.MetaDataReviseEntry\\E" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.mode.metadata.MetaDataContexts"}, + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.metadata.statistics.builder.ShardingSphereStatisticsBuilder\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry"}, @@ -60,6 +78,12 @@ }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.util.yaml.constructor.ShardingSphereYamlConstruct\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.util.yaml.shortcuts.ShardingSphereYamlShortcuts\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.swapper.mode.YamlModeConfigurationSwapper"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.YamlPersistRepositoryConfigurationSwapper\\E" @@ -69,18 +93,24 @@ }, { "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlRuleConfigurationSwapperEngine"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlRuleConfigurationSwapper\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.mode.manager.ContextManagerBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepository\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.route.standard.StandardReadwriteSplittingDataSourceRouter"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.readwritesplitting.route.standard.filter.ReadDataSourcesFilter\\E" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, - "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm\\E" + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm\\E" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, - "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm\\E" + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLDialectParserFacade\\E" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, - "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAuditAlgorithm\\E" + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sql.parser.spi.SQLStatementVisitorFacade\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.parser.dialect.OptimizerSQLPropertiesBuilder"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sqlfederation.optimizer.context.parser.dialect.OptimizerSQLDialectBuilder\\E" @@ -91,17 +121,17 @@ "condition":{"typeReachable":"org.apache.shardingsphere.sqltranslator.rule.SQLTranslatorRule"}, "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sqltranslator.spi.SQLTranslator\\E" }, { - "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.parser.dialect.impl.H2OptimizerBuilder"}, - "pattern":"\\Qsaffron.properties\\E" + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.timeservice.spi.TimestampService\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"}, "pattern":"\\Qsql\\E" - },{ - "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"}, - "pattern":"\\Qsql/H2.xml\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"}, - "pattern":"\\Qsql/MySQL.xml\\E" + "pattern":".*sql/.+\\.xml$" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.metadata.database.schema.builder.SystemSchemaBuilderRule"}, + "pattern":".*schema/.+\\.yaml$" }]}, "bundles":[] } diff --git a/pom.xml b/pom.xml index beba730a3d706..005806bb7e71c 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ 2.2 4.11.0 4.2.0 - 1.17.3 + 1.19.3 1.9.0 21.2.0 @@ -996,7 +996,6 @@ generateMetadata 17 - true @@ -1082,6 +1081,7 @@ ${project.build.outputDirectory} true + 0.3.5 diff --git a/test/native/native-image-filter/extra-filter.json b/test/native/native-image-filter/extra-filter.json index ac27751352147..ce94e860bc8d9 100644 --- a/test/native/native-image-filter/extra-filter.json +++ b/test/native/native-image-filter/extra-filter.json @@ -9,11 +9,14 @@ {"includeClasses": "java.lang.Thread"}, {"includeClasses": "java.util.Properties"}, {"excludeClasses": "javax.security.auth.x500.**"}, + {"excludeClasses": "javax.smartcardio.**"}, {"excludeClasses": "sun.misc.**"}, {"excludeClasses": "sun.security.**"}, {"excludeClasses": "com.github.benmanes.caffeine.cache.**"}, {"excludeClasses": "com.google.common.util.concurrent.**"}, + {"excludeClasses": "com.ibm.icu.text.**"}, + {"excludeClasses": "com.mysql.cj.**"}, {"excludeClasses": "com.sun.xml.bind.v2.**"}, {"excludeClasses": "com.zaxxer.hikari.**"}, {"excludeClasses": "javax.xml.bind.annotation.**"}, @@ -22,7 +25,9 @@ {"excludeClasses": "org.codehaus.groovy.**"}, {"excludeClasses": "org.h2.**"}, {"excludeClasses": "org.locationtech.jts.geom.**"}, + {"excludeClasses": "org.postgresql.**"}, {"excludeClasses": "org.slf4j.event.**"}, + {"excludeClasses": "org.testcontainers.jdbc.**"}, {"excludeClasses": "org.apache.shardingsphere.test.natived.**"} ], diff --git a/test/native/pom.xml b/test/native/pom.xml index 8f861e0099eaf..fa00a4ee96614 100644 --- a/test/native/pom.xml +++ b/test/native/pom.xml @@ -39,6 +39,26 @@ hamcrest test + + org.awaitility + awaitility + test + + + com.mysql + mysql-connector-j + test + + + org.postgresql + postgresql + test + + + org.testcontainers + postgresql + test + diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/AbstractShardingCommonTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/AbstractShardingCommonTest.java new file mode 100644 index 0000000000000..7b4d989ad058c --- /dev/null +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/AbstractShardingCommonTest.java @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.natived.jdbc.commons; + +import lombok.Getter; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Address; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Order; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.OrderItem; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.AddressRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderItemRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderRepository; + +import javax.sql.DataSource; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.LongStream; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +@Getter +public class AbstractShardingCommonTest { + + private final OrderRepository orderRepository; + + private final OrderItemRepository orderItemRepository; + + private final AddressRepository addressRepository; + + public AbstractShardingCommonTest(final DataSource dataSource) { + this.orderRepository = new OrderRepository(dataSource); + this.orderItemRepository = new OrderItemRepository(dataSource); + this.addressRepository = new AddressRepository(dataSource); + } + + /** + * process success. + * @throws SQLException An exception that provides information on a database access error or other errors. + */ + public void processSuccess() throws SQLException { + final Collection orderIds = insertData(); + Collection orders = orderRepository.selectAll(); + assertThat(orders.stream().map(Order::getOrderType).collect(Collectors.toList()), + equalTo(Arrays.asList(1, 1, 1, 1, 1, 0, 0, 0, 0, 0))); + assertThat(orders.stream().map(Order::getUserId).collect(Collectors.toList()), + equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); + assertThat(orders.stream().map(Order::getAddressId).collect(Collectors.toList()), + equalTo(new ArrayList<>(Arrays.asList(1L, 3L, 5L, 7L, 9L, 2L, 4L, 6L, 8L, 10L)))); + assertThat(orders.stream().map(Order::getStatus).collect(Collectors.toList()), + equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); + Collection orderItems = orderItemRepository.selectAll(); + assertThat(orderItems.stream().map(OrderItem::getUserId).collect(Collectors.toList()), + equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); + assertThat(orderItems.stream().map(OrderItem::getPhone).collect(Collectors.toList()), + equalTo(IntStream.range(1, 11).mapToObj(i -> "13800000001").collect(Collectors.toList()))); + assertThat(orderItems.stream().map(OrderItem::getStatus).collect(Collectors.toList()), + equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); + assertThat(addressRepository.selectAll(), + equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + deleteData(orderIds); + assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + } + + /** + * insert data. + * @return orderId of the insert statement. + * @throws SQLException An exception that provides information on a database access error or other errors. + */ + public Collection insertData() throws SQLException { + Collection result = new ArrayList<>(10); + for (int i = 1; i <= 10; i++) { + Order order = new Order(); + order.setUserId(i); + order.setOrderType(i % 2); + order.setAddressId(i); + order.setStatus("INSERT_TEST"); + orderRepository.insert(order); + OrderItem orderItem = new OrderItem(); + orderItem.setOrderId(order.getOrderId()); + orderItem.setUserId(i); + orderItem.setPhone("13800000001"); + orderItem.setStatus("INSERT_TEST"); + orderItemRepository.insert(orderItem); + Address address = new Address((long) i, "address_test_" + i); + addressRepository.insert(address); + result.add(order.getOrderId()); + } + return result; + } + + /** + * delete data. + * @param orderIds orderId of the insert statement. + * @throws SQLException An exception that provides information on a database access error or other errors. + */ + public void deleteData(final Collection orderIds) throws SQLException { + long count = 1; + for (Long each : orderIds) { + orderRepository.delete(each); + orderItemRepository.delete(each); + addressRepository.delete(count++); + } + } + + /** + * clean environment. + * @throws SQLException An exception that provides information on a database access error or other errors. + */ + public void cleanEnvironment() throws SQLException { + orderRepository.dropTable(); + orderItemRepository.dropTable(); + addressRepository.dropTable(); + } +} diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/FileTestUtils.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/FileTestUtils.java similarity index 97% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/FileTestUtils.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/FileTestUtils.java index cea3a8eaf69e2..ed61a51053b32 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/FileTestUtils.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/FileTestUtils.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived; +package org.apache.shardingsphere.test.natived.jdbc.commons; import java.io.BufferedReader; import java.io.IOException; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/ClassBasedInlineShardingAlgorithmFixture.java similarity index 96% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/ClassBasedInlineShardingAlgorithmFixture.java index 3dc473a80f105..9923409a72983 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/ClassBasedInlineShardingAlgorithmFixture.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.algorithm; +package org.apache.shardingsphere.test.natived.jdbc.commons.algorithm; import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue; import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java similarity index 95% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java index a7ca569e24a76..464c00a5225c1 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.algorithm; +package org.apache.shardingsphere.test.natived.jdbc.commons.algorithm; import lombok.Getter; import org.apache.shardingsphere.encrypt.api.context.EncryptContext; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Address.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/Address.java similarity index 94% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Address.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/Address.java index f68c72205d5e3..768bd8647665a 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Address.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/Address.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.entity; +package org.apache.shardingsphere.test.natived.jdbc.commons.entity; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Order.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/Order.java similarity index 94% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Order.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/Order.java index 7912036aab54d..57e091e13a2b4 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Order.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/Order.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.entity; +package org.apache.shardingsphere.test.natived.jdbc.commons.entity; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/OrderItem.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/OrderItem.java similarity index 94% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/OrderItem.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/OrderItem.java index 30c09206861a5..711e76098ac55 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/OrderItem.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/entity/OrderItem.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.entity; +package org.apache.shardingsphere.test.natived.jdbc.commons.entity; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/AddressRepository.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/AddressRepository.java similarity index 96% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/AddressRepository.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/AddressRepository.java index bb2c2271d934f..d3505fc67af45 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/AddressRepository.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/AddressRepository.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.repository; +package org.apache.shardingsphere.test.natived.jdbc.commons.repository; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Address; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Address; import javax.sql.DataSource; import java.sql.Connection; diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderItemRepository.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderItemRepository.java similarity index 87% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderItemRepository.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderItemRepository.java index 765bdb0f6c01c..3bfb69558ea31 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderItemRepository.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderItemRepository.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.repository; +package org.apache.shardingsphere.test.natived.jdbc.commons.repository; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.OrderItem; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.OrderItem; import javax.sql.DataSource; import java.sql.Connection; @@ -38,10 +38,10 @@ public OrderItemRepository(final DataSource dataSource) { } /** - * create table if not exists. + * create table if not exists in MySQL. * @throws SQLException SQL exception */ - public void createTableIfNotExists() throws SQLException { + public void createTableIfNotExistsInMySQL() throws SQLException { String sql = "CREATE TABLE IF NOT EXISTS t_order_item " + "(order_item_id BIGINT NOT NULL AUTO_INCREMENT, order_id BIGINT NOT NULL, user_id INT NOT NULL, phone VARCHAR(50), status VARCHAR(50), PRIMARY KEY (order_item_id))"; try ( @@ -51,6 +51,25 @@ public void createTableIfNotExists() throws SQLException { } } + /** + * create table if not exists in Postgres. + * @throws SQLException SQL exception + */ + public void createTableIfNotExistsInPostgres() throws SQLException { + String sql = "CREATE TABLE IF NOT EXISTS t_order_item (\n" + + " order_item_id BIGSERIAL PRIMARY KEY,\n" + + " order_id BIGINT NOT NULL,\n" + + " user_id INTEGER NOT NULL,\n" + + " phone VARCHAR(50),\n" + + " status VARCHAR(50)\n" + + ");"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + /** * drop table. * @throws SQLException SQL exception diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderRepository.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderRepository.java similarity index 88% rename from test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderRepository.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderRepository.java index 884285054b353..41a800949ec8a 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderRepository.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/repository/OrderRepository.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.test.natived.jdbc.features.repository; +package org.apache.shardingsphere.test.natived.jdbc.commons.repository; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Order; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Order; import javax.sql.DataSource; import java.sql.Connection; @@ -38,10 +38,10 @@ public OrderRepository(final DataSource dataSource) { } /** - * create table if not exists. + * create table if not exists in MySQL. * @throws SQLException SQL exception */ - public void createTableIfNotExists() throws SQLException { + public void createTableIfNotExistsInMySQL() throws SQLException { String sql = "CREATE TABLE IF NOT EXISTS t_order " + "(order_id BIGINT NOT NULL AUTO_INCREMENT, order_type INT(11), user_id INT NOT NULL, address_id BIGINT NOT NULL, status VARCHAR(50), PRIMARY KEY (order_id))"; try ( @@ -51,6 +51,25 @@ public void createTableIfNotExists() throws SQLException { } } + /** + * create table if not exists in Postgres. + * @throws SQLException SQL exception + */ + public void createTableIfNotExistsInPostgres() throws SQLException { + String sql = "CREATE TABLE IF NOT EXISTS t_order (\n" + + " order_id BIGSERIAL PRIMARY KEY,\n" + + " order_type INTEGER,\n" + + " user_id INTEGER NOT NULL,\n" + + " address_id BIGINT NOT NULL,\n" + + " status VARCHAR(50)\n" + + ");"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + /** * drop table. * TODO There is a bug in this function in shadow's unit test and requires additional fixes. diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java new file mode 100644 index 0000000000000..f4200b8d6729d --- /dev/null +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.natived.jdbc.databases; + +import com.mysql.cj.jdbc.exceptions.CommunicationsException; +import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; +import org.apache.shardingsphere.test.natived.jdbc.commons.AbstractShardingCommonTest; +import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils; +import org.awaitility.Awaitility; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledInNativeImage; + +import javax.sql.DataSource; +import java.io.File; +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.time.Duration; +import java.util.Properties; + +public class MySQLTest { + + private static final String USERNAME = "root"; + + private static final String PASSWORD = "123456"; + + private static final String DATABASE = "test"; + + private static final String JDBC_URL = "jdbc:mysql://localhost:65107/" + DATABASE; + + private static Process process; + + private AbstractShardingCommonTest abstractShardingCommonTest; + + private static Connection openConnection() throws SQLException { + Properties props = new Properties(); + props.setProperty("user", USERNAME); + props.setProperty("password", PASSWORD); + return DriverManager.getConnection(JDBC_URL, props); + } + + @SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"}) + @BeforeAll + static void beforeAll() throws IOException { + System.out.println("Starting MySQL ..."); + process = new ProcessBuilder( + "docker", "run", "--rm", "-p", "65107:3306", "-e", "MYSQL_DATABASE=" + DATABASE, + "-e", "MYSQL_ROOT_PASSWORD=" + PASSWORD, "mysql:8.2.0-oracle") + .redirectOutput(new File("target/mysql-stdout.txt")) + .redirectError(new File("target/mysql-stderr.txt")) + .start(); + Awaitility.await().atMost(Duration.ofMinutes(1)).ignoreExceptionsMatching(e -> e instanceof CommunicationsException) + .until(() -> { + openConnection().close(); + return true; + }); + try (Connection connection = openConnection()) { + connection.createStatement().executeUpdate("CREATE DATABASE demo_ds_0;"); + connection.createStatement().executeUpdate("CREATE DATABASE demo_ds_1;"); + connection.createStatement().executeUpdate("CREATE DATABASE demo_ds_2;"); + } catch (SQLException e) { + throw new RuntimeException(e); + } + System.out.println("MySQL started"); + } + + @AfterAll + static void tearDown() { + if (null != process && process.isAlive()) { + System.out.println("Shutting down MySQL"); + process.destroy(); + } + } + + @Test + @EnabledInNativeImage + void assertShardingInLocalTransactions() throws SQLException, IOException { + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/databases/mysql.yaml")); + abstractShardingCommonTest = new AbstractShardingCommonTest(dataSource); + this.initEnvironment(); + abstractShardingCommonTest.processSuccess(); + abstractShardingCommonTest.cleanEnvironment(); + } + + private void initEnvironment() throws SQLException { + abstractShardingCommonTest.getOrderRepository().createTableIfNotExistsInMySQL(); + abstractShardingCommonTest.getOrderItemRepository().createTableIfNotExistsInMySQL(); + abstractShardingCommonTest.getAddressRepository().createTableIfNotExists(); + abstractShardingCommonTest.getOrderRepository().truncateTable(); + abstractShardingCommonTest.getOrderItemRepository().truncateTable(); + abstractShardingCommonTest.getAddressRepository().truncateTable(); + } +} diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java new file mode 100644 index 0000000000000..d804325380b35 --- /dev/null +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PostgresTest.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.test.natived.jdbc.databases; + +import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; +import org.apache.shardingsphere.test.natived.jdbc.commons.AbstractShardingCommonTest; +import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledInNativeImage; + +import javax.sql.DataSource; +import java.io.IOException; +import java.sql.SQLException; + +public class PostgresTest { + + private AbstractShardingCommonTest abstractShardingCommonTest; + + @Test + @EnabledInNativeImage + void assertShardingInLocalTransactions() throws SQLException, IOException { + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/databases/postgresql.yaml")); + abstractShardingCommonTest = new AbstractShardingCommonTest(dataSource); + this.initEnvironment(); + abstractShardingCommonTest.processSuccess(); + abstractShardingCommonTest.cleanEnvironment(); + } + + private void initEnvironment() throws SQLException { + abstractShardingCommonTest.getOrderRepository().createTableIfNotExistsInPostgres(); + abstractShardingCommonTest.getOrderItemRepository().createTableIfNotExistsInPostgres(); + abstractShardingCommonTest.getAddressRepository().createTableIfNotExists(); + abstractShardingCommonTest.getOrderRepository().truncateTable(); + abstractShardingCommonTest.getOrderItemRepository().truncateTable(); + abstractShardingCommonTest.getAddressRepository().truncateTable(); + } +} diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java index e8ed3325fde58..e11830a89851c 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java @@ -18,13 +18,13 @@ package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.test.natived.FileTestUtils; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Address; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Order; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Address; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Order; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.OrderItem; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.AddressRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderItemRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderRepository; import org.junit.jupiter.api.Test; import javax.sql.DataSource; @@ -49,7 +49,7 @@ class EncryptTest { @Test void assertEncryptInLocalTransactions() throws SQLException, IOException { - DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/encrypt.yaml")); + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/features/encrypt.yaml")); orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); @@ -59,8 +59,8 @@ void assertEncryptInLocalTransactions() throws SQLException, IOException { } private void initEnvironment() throws SQLException { - orderRepository.createTableIfNotExists(); - orderItemRepository.createTableIfNotExists(); + orderRepository.createTableIfNotExistsInMySQL(); + orderItemRepository.createTableIfNotExistsInMySQL(); addressRepository.createTableIfNotExists(); orderRepository.truncateTable(); orderItemRepository.truncateTable(); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java index f3958de98929d..512bc207aaf0b 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java @@ -18,13 +18,13 @@ package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.test.natived.FileTestUtils; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Address; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Order; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Address; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Order; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.OrderItem; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.AddressRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderItemRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderRepository; import org.junit.jupiter.api.Test; import javax.sql.DataSource; @@ -49,7 +49,7 @@ class MaskTest { @Test void assertMaskInLocalTransactions() throws SQLException, IOException { - DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/mask.yaml")); + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/features/mask.yaml")); orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); @@ -59,8 +59,8 @@ void assertMaskInLocalTransactions() throws SQLException, IOException { } private void initEnvironment() throws SQLException { - orderRepository.createTableIfNotExists(); - orderItemRepository.createTableIfNotExists(); + orderRepository.createTableIfNotExistsInMySQL(); + orderItemRepository.createTableIfNotExistsInMySQL(); addressRepository.createTableIfNotExists(); orderRepository.truncateTable(); orderItemRepository.truncateTable(); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java index b50e7f0d570fa..3af60a478bb5e 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java @@ -18,13 +18,13 @@ package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.test.natived.FileTestUtils; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Address; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Order; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Address; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Order; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.OrderItem; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.AddressRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderItemRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderRepository; import org.h2.jdbc.JdbcSQLSyntaxErrorException; import org.junit.jupiter.api.Test; @@ -46,7 +46,7 @@ class ReadWriteSplittingTest { @Test void assertReadWriteSplittingInLocalTransactions() throws SQLException, IOException { - DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/readwrite-splitting.yaml")); + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/features/readwrite-splitting.yaml")); orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); @@ -56,8 +56,8 @@ void assertReadWriteSplittingInLocalTransactions() throws SQLException, IOExcept } private void initEnvironment() throws SQLException { - orderRepository.createTableIfNotExists(); - orderItemRepository.createTableIfNotExists(); + orderRepository.createTableIfNotExistsInMySQL(); + orderItemRepository.createTableIfNotExistsInMySQL(); addressRepository.createTableIfNotExists(); orderRepository.truncateTable(); orderItemRepository.truncateTable(); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java index 6abda5813fa3c..17645c3ae4ea9 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java @@ -18,13 +18,13 @@ package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.test.natived.FileTestUtils; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Address; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Order; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Address; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Order; +import org.apache.shardingsphere.test.natived.jdbc.commons.entity.OrderItem; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.AddressRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderItemRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderRepository; import org.junit.jupiter.api.Test; import javax.sql.DataSource; @@ -50,7 +50,7 @@ class ShadowTest { @Test void assertShadowInLocalTransactions() throws SQLException, IOException { - DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/shadow.yaml")); + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/features/shadow.yaml")); orderRepository = new OrderRepository(dataSource); orderItemRepository = new OrderItemRepository(dataSource); addressRepository = new AddressRepository(dataSource); @@ -60,8 +60,8 @@ void assertShadowInLocalTransactions() throws SQLException, IOException { } private void initEnvironment() throws SQLException { - orderRepository.createTableIfNotExists(); - orderItemRepository.createTableIfNotExists(); + orderRepository.createTableIfNotExistsInMySQL(); + orderItemRepository.createTableIfNotExistsInMySQL(); addressRepository.createTableIfNotExists(); orderRepository.truncateTable(); orderItemRepository.truncateTable(); diff --git a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java index 2352757c510ab..27f3e83357abf 100644 --- a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java @@ -18,116 +18,33 @@ package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.test.natived.FileTestUtils; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Address; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.Order; -import org.apache.shardingsphere.test.natived.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.test.natived.jdbc.features.repository.OrderRepository; +import org.apache.shardingsphere.test.natived.jdbc.commons.AbstractShardingCommonTest; +import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils; import org.junit.jupiter.api.Test; import javax.sql.DataSource; import java.io.IOException; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.LongStream; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; class ShardingTest { - private OrderRepository orderRepository; - - private OrderItemRepository orderItemRepository; - - private AddressRepository addressRepository; + private AbstractShardingCommonTest abstractShardingCommonTest; @Test void assertShardingInLocalTransactions() throws SQLException, IOException { - DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/sharding.yaml")); - orderRepository = new OrderRepository(dataSource); - orderItemRepository = new OrderItemRepository(dataSource); - addressRepository = new AddressRepository(dataSource); + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/features/sharding.yaml")); + abstractShardingCommonTest = new AbstractShardingCommonTest(dataSource); this.initEnvironment(); - this.processSuccess(); - this.cleanEnvironment(); + abstractShardingCommonTest.processSuccess(); + abstractShardingCommonTest.cleanEnvironment(); } private void initEnvironment() throws SQLException { - orderRepository.createTableIfNotExists(); - orderItemRepository.createTableIfNotExists(); - addressRepository.createTableIfNotExists(); - orderRepository.truncateTable(); - orderItemRepository.truncateTable(); - addressRepository.truncateTable(); - } - - private void processSuccess() throws SQLException { - final Collection orderIds = insertData(); - Collection orders = orderRepository.selectAll(); - assertThat(orders.stream().map(Order::getOrderType).collect(Collectors.toList()), - equalTo(Arrays.asList(1, 1, 1, 1, 1, 0, 0, 0, 0, 0))); - assertThat(orders.stream().map(Order::getUserId).collect(Collectors.toList()), - equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); - assertThat(orders.stream().map(Order::getAddressId).collect(Collectors.toList()), - equalTo(new ArrayList<>(Arrays.asList(1L, 3L, 5L, 7L, 9L, 2L, 4L, 6L, 8L, 10L)))); - assertThat(orders.stream().map(Order::getStatus).collect(Collectors.toList()), - equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); - Collection orderItems = orderItemRepository.selectAll(); - assertThat(orderItems.stream().map(OrderItem::getUserId).collect(Collectors.toList()), - equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); - assertThat(orderItems.stream().map(OrderItem::getPhone).collect(Collectors.toList()), - equalTo(IntStream.range(1, 11).mapToObj(i -> "13800000001").collect(Collectors.toList()))); - assertThat(orderItems.stream().map(OrderItem::getStatus).collect(Collectors.toList()), - equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); - assertThat(addressRepository.selectAll(), - equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); - deleteData(orderIds); - assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); - assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); - assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); - } - - private Collection insertData() throws SQLException { - Collection result = new ArrayList<>(10); - for (int i = 1; i <= 10; i++) { - Order order = new Order(); - order.setUserId(i); - order.setOrderType(i % 2); - order.setAddressId(i); - order.setStatus("INSERT_TEST"); - orderRepository.insert(order); - OrderItem orderItem = new OrderItem(); - orderItem.setOrderId(order.getOrderId()); - orderItem.setUserId(i); - orderItem.setPhone("13800000001"); - orderItem.setStatus("INSERT_TEST"); - orderItemRepository.insert(orderItem); - Address address = new Address((long) i, "address_test_" + i); - addressRepository.insert(address); - result.add(order.getOrderId()); - } - return result; - } - - private void deleteData(final Collection orderIds) throws SQLException { - long count = 1; - for (Long each : orderIds) { - orderRepository.delete(each); - orderItemRepository.delete(each); - addressRepository.delete(count++); - } - } - - private void cleanEnvironment() throws SQLException { - orderRepository.dropTable(); - orderItemRepository.dropTable(); - addressRepository.dropTable(); + abstractShardingCommonTest.getOrderRepository().createTableIfNotExistsInMySQL(); + abstractShardingCommonTest.getOrderItemRepository().createTableIfNotExistsInMySQL(); + abstractShardingCommonTest.getAddressRepository().createTableIfNotExists(); + abstractShardingCommonTest.getOrderRepository().truncateTable(); + abstractShardingCommonTest.getOrderItemRepository().truncateTable(); + abstractShardingCommonTest.getAddressRepository().truncateTable(); } } diff --git a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json index 607582b5bd370..2c18921fb05aa 100644 --- a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json +++ b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json @@ -1,8 +1,12 @@ [ { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithmFactory"}, - "name":"org.apache.shardingsphere.test.natived.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture", + "name":"org.apache.shardingsphere.test.natived.jdbc.commons.algorithm.ClassBasedInlineShardingAlgorithmFixture", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.rule.EncryptRule"}, + "name":"org.apache.shardingsphere.test.natived.jdbc.commons.algorithm.TestQueryAssistedShardingEncryptAlgorithm", "methods":[{"name":"","parameterTypes":[] }] } ] - \ No newline at end of file diff --git a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json index e470579314d3d..18dac387abc18 100644 --- a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json +++ b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/resource-config.json @@ -1,21 +1,26 @@ { "resources":{ "includes":[{ + "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.databases.MySQLTest"}, + "pattern":"\\Qtest-native/yaml/databases/mysql.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.databases.PostgresTest"}, + "pattern":"\\Qtest-native/yaml/databases/postgresql.yaml\\E" + }, { "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.EncryptTest"}, - "pattern":"\\Qyaml/encrypt.yaml\\E" + "pattern":"\\Qtest-native/yaml/features/encrypt.yaml\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.MaskTest"}, - "pattern":"\\Qyaml/mask.yaml\\E" + "pattern":"\\Qtest-native/yaml/features/mask.yaml\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.ReadWriteSplittingTest"}, - "pattern":"\\Qyaml/readwrite-splitting.yaml\\E" + "pattern":"\\Qtest-native/yaml/features/readwrite-splitting.yaml\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.ShadowTest"}, - "pattern":"\\Qyaml/shadow.yaml\\E" + "pattern":"\\Qtest-native/yaml/features/shadow.yaml\\E" }, { "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.ShardingTest"}, - "pattern":"\\Qyaml/sharding.yaml\\E" - } - ]}, + "pattern":"\\Qtest-native/yaml/features/sharding.yaml\\E" + }]}, "bundles":[] } diff --git a/test/native/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm b/test/native/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm index 7f5e14b0e246e..0f0223e7d2957 100644 --- a/test/native/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm +++ b/test/native/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.test.natived.jdbc.features.algorithm.TestQueryAssistedShardingEncryptAlgorithm +org.apache.shardingsphere.test.natived.jdbc.commons.algorithm.TestQueryAssistedShardingEncryptAlgorithm diff --git a/test/native/src/test/resources/logback-test.xml b/test/native/src/test/resources/logback-test.xml deleted file mode 100644 index d17f7efbfaf30..0000000000000 --- a/test/native/src/test/resources/logback-test.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n - - - - - - - - - - - diff --git a/test/native/src/test/resources/test-native/yaml/databases/mysql.yaml b/test/native/src/test/resources/test-native/yaml/databases/mysql.yaml new file mode 100644 index 0000000000000..8853f2ef924b8 --- /dev/null +++ b/test/native/src/test/resources/test-native/yaml/databases/mysql.yaml @@ -0,0 +1,78 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mode: + type: Standalone + repository: + type: JDBC + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: com.mysql.cj.jdbc.Driver + jdbcUrl: jdbc:mysql://localhost:65107/demo_ds_0 + username: root + password: 123456 + ds_1: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: com.mysql.cj.jdbc.Driver + jdbcUrl: jdbc:mysql://localhost:65107/demo_ds_1 + username: root + password: 123456 + ds_2: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: com.mysql.cj.jdbc.Driver + jdbcUrl: jdbc:mysql://localhost:65107/demo_ds_2 + username: root + password: 123456 + +rules: +- !SHARDING + tables: + t_order: + actualDataNodes: + keyGenerateStrategy: + column: order_id + keyGeneratorName: snowflake + t_order_item: + actualDataNodes: + keyGenerateStrategy: + column: order_item_id + keyGeneratorName: snowflake + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: inline + shardingAlgorithms: + inline: + type: CLASS_BASED + props: + strategy: STANDARD + algorithmClassName: org.apache.shardingsphere.test.natived.jdbc.commons.algorithm.ClassBasedInlineShardingAlgorithmFixture + keyGenerators: + snowflake: + type: SNOWFLAKE + auditors: + sharding_key_required_auditor: + type: DML_SHARDING_CONDITIONS + +- !BROADCAST + tables: + - t_address + +props: + sql-show: false diff --git a/test/native/src/test/resources/test-native/yaml/databases/postgresql.yaml b/test/native/src/test/resources/test-native/yaml/databases/postgresql.yaml new file mode 100644 index 0000000000000..6011240591694 --- /dev/null +++ b/test/native/src/test/resources/test-native/yaml/databases/postgresql.yaml @@ -0,0 +1,72 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mode: + type: Standalone + repository: + type: JDBC + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver + jdbcUrl: jdbc:tc:postgresql:16.1-bookworm://test-native-databases-postgres/demo_ds_0?TC_DAEMON=true + ds_1: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver + jdbcUrl: jdbc:tc:postgresql:16.1-bookworm://test-native-databases-postgres/demo_ds_1?TC_DAEMON=true + ds_2: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver + jdbcUrl: jdbc:tc:postgresql:16.1-bookworm://test-native-databases-postgres/demo_ds_2?TC_DAEMON=true + +rules: +- !SHARDING + tables: + t_order: + actualDataNodes: + keyGenerateStrategy: + column: order_id + keyGeneratorName: snowflake + t_order_item: + actualDataNodes: + keyGenerateStrategy: + column: order_item_id + keyGeneratorName: snowflake + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: inline + shardingAlgorithms: + inline: + type: CLASS_BASED + props: + strategy: STANDARD + algorithmClassName: org.apache.shardingsphere.test.natived.jdbc.commons.algorithm.ClassBasedInlineShardingAlgorithmFixture + keyGenerators: + snowflake: + type: SNOWFLAKE + auditors: + sharding_key_required_auditor: + type: DML_SHARDING_CONDITIONS + +- !BROADCAST + tables: + - t_address + +props: + sql-show: false diff --git a/test/native/src/test/resources/yaml/encrypt.yaml b/test/native/src/test/resources/test-native/yaml/features/encrypt.yaml similarity index 100% rename from test/native/src/test/resources/yaml/encrypt.yaml rename to test/native/src/test/resources/test-native/yaml/features/encrypt.yaml diff --git a/test/native/src/test/resources/yaml/mask.yaml b/test/native/src/test/resources/test-native/yaml/features/mask.yaml similarity index 100% rename from test/native/src/test/resources/yaml/mask.yaml rename to test/native/src/test/resources/test-native/yaml/features/mask.yaml diff --git a/test/native/src/test/resources/yaml/readwrite-splitting.yaml b/test/native/src/test/resources/test-native/yaml/features/readwrite-splitting.yaml similarity index 100% rename from test/native/src/test/resources/yaml/readwrite-splitting.yaml rename to test/native/src/test/resources/test-native/yaml/features/readwrite-splitting.yaml diff --git a/test/native/src/test/resources/yaml/shadow.yaml b/test/native/src/test/resources/test-native/yaml/features/shadow.yaml similarity index 100% rename from test/native/src/test/resources/yaml/shadow.yaml rename to test/native/src/test/resources/test-native/yaml/features/shadow.yaml diff --git a/test/native/src/test/resources/yaml/sharding.yaml b/test/native/src/test/resources/test-native/yaml/features/sharding.yaml similarity index 97% rename from test/native/src/test/resources/yaml/sharding.yaml rename to test/native/src/test/resources/test-native/yaml/features/sharding.yaml index 860cf57c9a421..f15400410a72f 100644 --- a/test/native/src/test/resources/yaml/sharding.yaml +++ b/test/native/src/test/resources/test-native/yaml/features/sharding.yaml @@ -65,7 +65,7 @@ rules: type: CLASS_BASED props: strategy: STANDARD - algorithmClassName: org.apache.shardingsphere.test.natived.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture + algorithmClassName: org.apache.shardingsphere.test.natived.jdbc.commons.algorithm.ClassBasedInlineShardingAlgorithmFixture keyGenerators: snowflake: type: SNOWFLAKE diff --git a/test/pom.xml b/test/pom.xml index d6729a62530aa..0eac1c7ec7d01 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -44,9 +44,10 @@ org.testcontainers - testcontainers + testcontainers-bom ${testcontainers.version} - test + pom + import @@ -68,6 +69,7 @@ org.testcontainers testcontainers + test