From 62312206f748e34cfac103c91791e0c1139a51d8 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Tue, 21 Nov 2023 19:00:05 +0800 Subject: [PATCH] Move native test from infra module to test module (#29107) * Move native test from infra module to test module * Move native test from infra module to test module * Move native test from infra module to test module --- .../graalvm-native-image/_index.cn.md | 10 ++++----- .../graalvm-native-image/_index.en.md | 10 ++++----- .../resource-config.json | 21 ------------------- infra/pom.xml | 1 - infra/reachability-metadata/pom.xml | 1 - pom.xml | 8 +++---- .../native-image-filter/extra-filter.json | 2 +- .../native-image-filter/user-code-filter.json | 0 {infra/nativetest => test/native}/pom.xml | 4 ++-- .../test/natived}/FileTestUtils.java | 2 +- .../natived}/jdbc/features/EncryptTest.java | 16 +++++++------- .../test/natived}/jdbc/features/MaskTest.java | 16 +++++++------- .../jdbc/features/ReadWriteSplittingTest.java | 16 +++++++------- .../natived}/jdbc/features/ShadowTest.java | 16 +++++++------- .../natived}/jdbc/features/ShardingTest.java | 16 +++++++------- ...ssBasedInlineShardingAlgorithmFixture.java | 2 +- ...QueryAssistedShardingEncryptAlgorithm.java | 2 +- .../jdbc/features/entity/Address.java | 2 +- .../natived}/jdbc/features/entity/Order.java | 2 +- .../jdbc/features/entity/OrderItem.java | 2 +- .../repository/AddressRepository.java | 4 ++-- .../repository/OrderItemRepository.java | 4 ++-- .../features/repository/OrderRepository.java | 4 ++-- .../reflect-config.json | 3 ++- .../resource-config.json | 21 +++++++++++++++++++ ...hardingsphere.encrypt.spi.EncryptAlgorithm | 2 +- .../src/test/resources/logback-test.xml | 0 .../src/test/resources/yaml/encrypt.yaml | 0 .../native}/src/test/resources/yaml/mask.yaml | 0 .../resources/yaml/readwrite-splitting.yaml | 0 .../src/test/resources/yaml/shadow.yaml | 0 .../src/test/resources/yaml/sharding.yaml | 2 +- test/pom.xml | 1 + 33 files changed, 95 insertions(+), 95 deletions(-) delete mode 100644 infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json rename {infra/nativetest => test/native}/native-image-filter/extra-filter.json (93%) rename {infra/nativetest => test/native}/native-image-filter/user-code-filter.json (100%) rename {infra/nativetest => test/native}/pom.xml (95%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/FileTestUtils.java (98%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/EncryptTest.java (87%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/MaskTest.java (87%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/ReadWriteSplittingTest.java (87%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/ShadowTest.java (90%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/ShardingTest.java (89%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java (96%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java (95%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/entity/Address.java (94%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/entity/Order.java (94%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/entity/OrderItem.java (94%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/repository/AddressRepository.java (96%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/repository/OrderItemRepository.java (97%) rename {infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest => test/native/src/test/java/org/apache/shardingsphere/test/natived}/jdbc/features/repository/OrderRepository.java (98%) rename {infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata => test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata}/reflect-config.json (62%) create mode 100644 test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata/resource-config.json rename {infra/nativetest => test/native}/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm (87%) rename {infra/nativetest => test/native}/src/test/resources/logback-test.xml (100%) rename {infra/nativetest => test/native}/src/test/resources/yaml/encrypt.yaml (100%) rename {infra/nativetest => test/native}/src/test/resources/yaml/mask.yaml (100%) rename {infra/nativetest => test/native}/src/test/resources/yaml/readwrite-splitting.yaml (100%) rename {infra/nativetest => test/native}/src/test/resources/yaml/shadow.yaml (100%) rename {infra/nativetest => test/native}/src/test/resources/yaml/sharding.yaml (94%) 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 ba6f3a41a2e6f..1a51293834662 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 @@ -214,13 +214,13 @@ ShardingSphere 对在 GraalVM Native Image 下的可用性的验证,是通过 在 GraalVM Native Image 下的单元测试覆盖率。请贡献者不要使用 `io.kotest:kotest-runner-junit5-jvm:5.5.4` 等在 `test listener` mode 下 failed to discover tests 的测试库。 -ShardingSphere 定义了 `shardingsphere-infra-nativetest` 的 Maven Module 用于为 native Test 提供小型的单元测试子集, +ShardingSphere 定义了 `shardingsphere-test-native` 的 Maven Module 用于为 native Test 提供小型的单元测试子集, 此单元测试子集避免了使用 Mockito 等 native Test 下无法使用的第三方库。 -ShardingSphere 定义了 `nativeTestInShardingSphere` 的 Maven Profile 用于为 `shardingsphere-infra-nativetest` 模块执行 nativeTest 。 +ShardingSphere 定义了 `nativeTestInShardingSphere` 的 Maven Profile 用于为 `shardingsphere-test-native` 模块执行 nativeTest 。 假设贡献者处于新的 Ubuntu 22.04.3 LTS 实例下,其可通过如下 bash 命令通过 SDKMAN! 管理 JDK 和工具链, -并为 `shardingsphere-infra-nativetest` 子模块执行 nativeTest。 +并为 `shardingsphere-test-native` 子模块执行 nativeTest。 ```bash sudo apt install unzip zip curl sed -y @@ -247,11 +247,11 @@ ShardingSphere 定义了 `generateMetadata` 的 Maven Profile 用于在 GraalVM 已有的 GraalVM Reachability Metadata 文件。可通过如下 bash 命令简单处理此流程。贡献者仍可能需要手动调整具体的 JSON 条目,并在适当的时候 调整 Maven Profile 和 GraalVM Tracing Agent 的 Filter 链。 -以下命令仅为 `shardingsphere-infra-nativetest` 生成 Conditional 形态的 GraalVM Reachability Metadata 的一个举例。生成的 GraalVM +以下命令仅为 `shardingsphere-test-native` 生成 Conditional 形态的 GraalVM Reachability Metadata 的一个举例。生成的 GraalVM Reachability Metadata 位于 `shardingsphere-infra-reachability-metadata` 子模块下。 对于测试类和测试文件独立使用的 GraalVM Reachability Metadata,贡献者应该放置到 -`${user.dir}/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/` +`${user.dir}/test/natived/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/` 文件夹下。`${}` 内为相关子模块对应的 POM 4.0 的常规系统变量,自行替换。 ```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 4037034abe0ae..7702642b5b5b8 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 @@ -225,13 +225,13 @@ and then build it as GraalVM Native Image for nativeTest to test Unit Test Cover Please do not use `io.kotest:kotest-runner-junit5-jvm:5.5.4` and some third-party test libraries, they are in `test listener` mode failed to discover tests. -ShardingSphere defines the Maven Module of `shardingsphere-infra-nativetest` to provide a small subset of unit tests for native Test. +ShardingSphere defines the Maven Module of `shardingsphere-test-native` to provide a small subset of unit tests for native Test. This subset of unit tests avoids the use of third-party libraries such as Mockito that are not available under native Test. -ShardingSphere defines the Maven Profile of `nativeTestInShardingSphere` for executing nativeTest for the `shardingsphere-infra-nativetest` module. +ShardingSphere defines the Maven Profile of `nativeTestInShardingSphere` for executing nativeTest for the `shardingsphere-test-native` module. 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-infra-nativetest` submodule. +`SDKMAN!` through the following bash command, and execute nativeTest for the `shardingsphere-test-native` submodule. ```bash sudo apt install unzip zip curl sed -y @@ -261,11 +261,11 @@ Metadata files in a specific directory. This process can be easily handled with the following bash command. Contributors may still need to manually adjust specific JSON entries and GraalVM Tracing Agent Filter chain of Maven Profile. -The following command is only an example of using `shardingsphere-infra-nativetest` to generate GraalVM Reachability Metadata +The following command is only an example of using `shardingsphere-test-native` to generate GraalVM Reachability Metadata in Conditional form. Generated GraalVM Reachability Metadata is located under the `shardingsphere-infra-reachability-metadata` submodule. For GraalVM Reachability Metadata used independently by test classes and test files, contributors should place -`${user.dir}/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/` +`${user.dir}/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/` folder. `${}` contains the regular system variables of POM 4.0 corresponding to the relevant submodules, which can be replaced by yourself. ```bash diff --git a/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json b/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json deleted file mode 100644 index 2773c5f2fde1b..0000000000000 --- a/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "resources":{ - "includes":[{ - "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.EncryptTest"}, - "pattern":"\\Qyaml/encrypt.yaml\\E" - }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.MaskTest"}, - "pattern":"\\Qyaml/mask.yaml\\E" - }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.ReadWriteSplittingTest"}, - "pattern":"\\Qyaml/readwrite-splitting.yaml\\E" - }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.ShadowTest"}, - "pattern":"\\Qyaml/shadow.yaml\\E" - }, { - "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.ShardingTest"}, - "pattern":"\\Qyaml/sharding.yaml\\E" - } - ]}, - "bundles":[] -} diff --git a/infra/pom.xml b/infra/pom.xml index 755c1f805ff2e..d831f53f2876d 100644 --- a/infra/pom.xml +++ b/infra/pom.xml @@ -45,7 +45,6 @@ expr util reachability-metadata - nativetest algorithm diff --git a/infra/reachability-metadata/pom.xml b/infra/reachability-metadata/pom.xml index 1d578449de5c1..f990db3c5dbd7 100644 --- a/infra/reachability-metadata/pom.xml +++ b/infra/reachability-metadata/pom.xml @@ -25,5 +25,4 @@ shardingsphere-infra-reachability-metadata ${project.artifactId} - diff --git a/pom.xml b/pom.xml index 7bd0c114d6a0c..ff32ff9b0442a 100644 --- a/pom.xml +++ b/pom.xml @@ -1026,7 +1026,7 @@ ${maven-surefire-plugin.version} - org.apache.shardingsphere.infra.nativetest.** + org.apache.shardingsphere.test.natived.** @@ -1041,8 +1041,8 @@ Conditional - ${user.dir}/infra/nativetest/native-image-filter/user-code-filter.json - ${user.dir}/infra/nativetest/native-image-filter/extra-filter.json + ${user.dir}/test/natived/native-image-filter/user-code-filter.json + ${user.dir}/test/natived/native-image-filter/extra-filter.json true @@ -1088,7 +1088,7 @@ maven-surefire-plugin - org.apache.shardingsphere.infra.nativetest.** + org.apache.shardingsphere.test.natived.** diff --git a/infra/nativetest/native-image-filter/extra-filter.json b/test/native/native-image-filter/extra-filter.json similarity index 93% rename from infra/nativetest/native-image-filter/extra-filter.json rename to test/native/native-image-filter/extra-filter.json index 0781beee69031..ac27751352147 100644 --- a/infra/nativetest/native-image-filter/extra-filter.json +++ b/test/native/native-image-filter/extra-filter.json @@ -24,7 +24,7 @@ {"excludeClasses": "org.locationtech.jts.geom.**"}, {"excludeClasses": "org.slf4j.event.**"}, - {"excludeClasses": "org.apache.shardingsphere.infra.nativetest.**"} + {"excludeClasses": "org.apache.shardingsphere.test.natived.**"} ], "regexRules": [ ] diff --git a/infra/nativetest/native-image-filter/user-code-filter.json b/test/native/native-image-filter/user-code-filter.json similarity index 100% rename from infra/nativetest/native-image-filter/user-code-filter.json rename to test/native/native-image-filter/user-code-filter.json diff --git a/infra/nativetest/pom.xml b/test/native/pom.xml similarity index 95% rename from infra/nativetest/pom.xml rename to test/native/pom.xml index 5fb8d91c8be18..49121ac32698a 100644 --- a/infra/nativetest/pom.xml +++ b/test/native/pom.xml @@ -20,10 +20,10 @@ 4.0.0 org.apache.shardingsphere - shardingsphere-infra + shardingsphere-test 5.4.2-SNAPSHOT - shardingsphere-infra-nativetest + shardingsphere-test-native ${project.artifactId} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/FileTestUtils.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/FileTestUtils.java similarity index 98% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/FileTestUtils.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/FileTestUtils.java index 30768fb598a65..cea3a8eaf69e2 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/FileTestUtils.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/FileTestUtils.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest; +package org.apache.shardingsphere.test.natived; import java.io.BufferedReader; import java.io.IOException; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java similarity index 87% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java index 562b95e58c6b8..e8ed3325fde58 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/EncryptTest.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features; +package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.infra.nativetest.FileTestUtils; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +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.junit.jupiter.api.Test; import javax.sql.DataSource; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java similarity index 87% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java index b7edf69c3d782..f3958de98929d 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/MaskTest.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features; +package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.infra.nativetest.FileTestUtils; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +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.junit.jupiter.api.Test; import javax.sql.DataSource; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java similarity index 87% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java index f0510a06cc2eb..b50e7f0d570fa 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ReadWriteSplittingTest.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features; +package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.infra.nativetest.FileTestUtils; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +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.h2.jdbc.JdbcSQLSyntaxErrorException; import org.junit.jupiter.api.Test; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java similarity index 90% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java index ab8defd31b379..6abda5813fa3c 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features; +package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.infra.nativetest.FileTestUtils; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +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.junit.jupiter.api.Test; import javax.sql.DataSource; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java similarity index 89% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java index 739361cb04fd7..2352757c510ab 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShardingTest.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features; +package org.apache.shardingsphere.test.natived.jdbc.features; import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; -import org.apache.shardingsphere.infra.nativetest.FileTestUtils; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +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.junit.jupiter.api.Test; import javax.sql.DataSource; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java similarity index 96% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java index 55652a13e6d49..3dc473a80f105 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm; +package org.apache.shardingsphere.test.natived.jdbc.features.algorithm; import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue; import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java similarity index 95% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java index c443adbb07d65..a7ca569e24a76 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm; +package org.apache.shardingsphere.test.natived.jdbc.features.algorithm; import lombok.Getter; import org.apache.shardingsphere.encrypt.api.context.EncryptContext; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Address.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Address.java similarity index 94% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Address.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Address.java index 530e1eb6d86c6..f68c72205d5e3 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Address.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Address.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.entity; +package org.apache.shardingsphere.test.natived.jdbc.features.entity; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Order.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Order.java similarity index 94% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Order.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Order.java index 751889802f8bc..7912036aab54d 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Order.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/Order.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.entity; +package org.apache.shardingsphere.test.natived.jdbc.features.entity; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/OrderItem.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/OrderItem.java similarity index 94% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/OrderItem.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/OrderItem.java index 3c4a00c691f46..30c09206861a5 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/OrderItem.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/entity/OrderItem.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.entity; +package org.apache.shardingsphere.test.natived.jdbc.features.entity; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/AddressRepository.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/AddressRepository.java similarity index 96% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/AddressRepository.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/AddressRepository.java index 65806f92e12cf..bb2c2271d934f 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/AddressRepository.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/AddressRepository.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.repository; +package org.apache.shardingsphere.test.natived.jdbc.features.repository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; +import org.apache.shardingsphere.test.natived.jdbc.features.entity.Address; import javax.sql.DataSource; import java.sql.Connection; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderItemRepository.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderItemRepository.java similarity index 97% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderItemRepository.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderItemRepository.java index 320a0786935df..765bdb0f6c01c 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderItemRepository.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderItemRepository.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.repository; +package org.apache.shardingsphere.test.natived.jdbc.features.repository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; +import org.apache.shardingsphere.test.natived.jdbc.features.entity.OrderItem; import javax.sql.DataSource; import java.sql.Connection; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderRepository.java b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderRepository.java similarity index 98% rename from infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderRepository.java rename to test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderRepository.java index fb5aad9c1bdf2..884285054b353 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderRepository.java +++ b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/repository/OrderRepository.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.nativetest.jdbc.features.repository; +package org.apache.shardingsphere.test.natived.jdbc.features.repository; -import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; +import org.apache.shardingsphere.test.natived.jdbc.features.entity.Order; import javax.sql.DataSource; import java.sql.Connection; diff --git a/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/reflect-config.json b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata/reflect-config.json similarity index 62% rename from infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/reflect-config.json rename to test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata/reflect-config.json index 4aed2e014fdd9..607582b5bd370 100644 --- a/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/reflect-config.json +++ b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata/reflect-config.json @@ -1,7 +1,8 @@ [ { "condition":{"typeReachable":"org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithmFactory"}, - "name":"org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture", + "name":"org.apache.shardingsphere.test.natived.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture", "methods":[{"name":"","parameterTypes":[] }] } ] + \ No newline at end of file diff --git a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata/resource-config.json b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata/resource-config.json new file mode 100644 index 0000000000000..e470579314d3d --- /dev/null +++ b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-metadata/resource-config.json @@ -0,0 +1,21 @@ +{ + "resources":{ + "includes":[{ + "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.EncryptTest"}, + "pattern":"\\Qyaml/encrypt.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.MaskTest"}, + "pattern":"\\Qyaml/mask.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.ReadWriteSplittingTest"}, + "pattern":"\\Qyaml/readwrite-splitting.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.ShadowTest"}, + "pattern":"\\Qyaml/shadow.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.test.natived.jdbc.features.ShardingTest"}, + "pattern":"\\Qyaml/sharding.yaml\\E" + } + ]}, + "bundles":[] +} diff --git a/infra/nativetest/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 similarity index 87% rename from infra/nativetest/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm rename to test/native/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm index be8532cc700cb..7f5e14b0e246e 100644 --- a/infra/nativetest/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.infra.nativetest.jdbc.features.algorithm.TestQueryAssistedShardingEncryptAlgorithm +org.apache.shardingsphere.test.natived.jdbc.features.algorithm.TestQueryAssistedShardingEncryptAlgorithm diff --git a/infra/nativetest/src/test/resources/logback-test.xml b/test/native/src/test/resources/logback-test.xml similarity index 100% rename from infra/nativetest/src/test/resources/logback-test.xml rename to test/native/src/test/resources/logback-test.xml diff --git a/infra/nativetest/src/test/resources/yaml/encrypt.yaml b/test/native/src/test/resources/yaml/encrypt.yaml similarity index 100% rename from infra/nativetest/src/test/resources/yaml/encrypt.yaml rename to test/native/src/test/resources/yaml/encrypt.yaml diff --git a/infra/nativetest/src/test/resources/yaml/mask.yaml b/test/native/src/test/resources/yaml/mask.yaml similarity index 100% rename from infra/nativetest/src/test/resources/yaml/mask.yaml rename to test/native/src/test/resources/yaml/mask.yaml diff --git a/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml b/test/native/src/test/resources/yaml/readwrite-splitting.yaml similarity index 100% rename from infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml rename to test/native/src/test/resources/yaml/readwrite-splitting.yaml diff --git a/infra/nativetest/src/test/resources/yaml/shadow.yaml b/test/native/src/test/resources/yaml/shadow.yaml similarity index 100% rename from infra/nativetest/src/test/resources/yaml/shadow.yaml rename to test/native/src/test/resources/yaml/shadow.yaml diff --git a/infra/nativetest/src/test/resources/yaml/sharding.yaml b/test/native/src/test/resources/yaml/sharding.yaml similarity index 94% rename from infra/nativetest/src/test/resources/yaml/sharding.yaml rename to test/native/src/test/resources/yaml/sharding.yaml index 10dc57f5e98ff..363122a894c59 100644 --- a/infra/nativetest/src/test/resources/yaml/sharding.yaml +++ b/test/native/src/test/resources/yaml/sharding.yaml @@ -65,7 +65,7 @@ rules: type: CLASS_BASED props: strategy: STANDARD - algorithmClassName: org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture + algorithmClassName: org.apache.shardingsphere.test.natived.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture keyGenerators: snowflake: type: SNOWFLAKE diff --git a/test/pom.xml b/test/pom.xml index 01483d29378ba..26fe73c0f8394 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -33,6 +33,7 @@ it e2e + native