From 06e589fab049a31973741ebe6a5f2c3262155de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E4=BC=9F=E6=9D=B0?= Date: Sun, 18 Jul 2021 20:35:54 +0800 Subject: [PATCH] Remove plugins for ShardingSphere legacy and unstable versions (#7323) Remove the following plugins due to they are legacy and unstable releases. 1. sharding-jdbc-1.5.x-plugin 2. sharding-sphere-4.x-rc3-plugin 3. sharding-sphere-4.x-plugin (This is for RC1 and RC2) To people who want to use these removing versions, you still could copy the plugins from SkyWalking's 8.6.0 release to the '/plugins' folder to activate, unless SkyWalking has some core level APIs upgrade. This is very rare to happen. --- .github/workflows/plugins-test.2.yaml | 2 - CHANGES.md | 1 + apm-sniffer/apm-sdk-plugin/pom.xml | 3 - .../sharding-jdbc-1.5.x-plugin/pom.xml | 60 ----- .../plugin/sjdbc/ExecuteEventListener.java | 91 -------- .../sjdbc/define/AsyncExecuteInterceptor.java | 59 ----- .../sjdbc/define/ExecuteInterceptor.java | 56 ----- .../ExecutorEngineConstructorInterceptor.java | 35 --- .../sjdbc/define/ExecutorInstrumentation.java | 104 --------- .../src/main/resources/skywalking-plugin.def | 17 -- .../apm/plugin/sjdbc/InterceptorTest.java | 211 ------------------ .../sharding-sphere-4.x-RC3-plugin/pom.xml | 73 ------ .../plugin/shardingsphere/v4rc3/Constant.java | 24 -- .../v4rc3/ExecuteInterceptor.java | 64 ------ .../v4rc3/JDBCRootInvokeInterceptor.java | 56 ----- .../v4rc3/ParseInterceptor.java | 57 ----- .../v4rc3/ProxyRootInvokeInterceptor.java | 56 ----- ...ractShardingSphereV4R3Instrumentation.java | 29 --- .../v4rc3/define/ExecuteInstrumentation.java | 70 ------ .../define/JDBCRootInvokeInstrumentation.java | 71 ------ .../v4rc3/define/ParseInstrumentation.java | 70 ------ .../ProxyRootInvokeInstrumentation.java | 70 ------ .../src/main/resources/skywalking-plugin.def | 19 -- .../shardingsphere/v4rc3/InterceptorTest.java | 126 ----------- .../sharding-sphere-4.x-plugin/pom.xml | 73 ------ .../plugin/shardingsphere/v4/Constant.java | 24 -- .../shardingsphere/v4/ExecuteInterceptor.java | 64 ------ .../v4/JDBCRootInvokeInterceptor.java | 56 ----- .../shardingsphere/v4/ParseInterceptor.java | 57 ----- .../v4/ProxyRootInvokeInterceptor.java | 56 ----- ...stractShardingSphereV4Instrumentation.java | 29 --- .../v4/define/ExecuteInstrumentation.java | 70 ------ .../define/JDBCRootInvokeInstrumentation.java | 71 ------ .../v4/define/ParseInstrumentation.java | 71 ------ .../ProxyRootInvokeInstrumentation.java | 70 ------ .../src/main/resources/skywalking-plugin.def | 19 -- .../shardingsphere/InterceptorTest.java | 130 ----------- .../service-agent/java-agent/Plugin-list.md | 3 - .../java-agent/Supported-list.md | 3 +- .../bin/startup.sh | 21 -- .../config/expectedData.yaml | 174 --------------- .../configuration.yml | 20 -- .../pom.xml | 149 ------------- .../src/main/assembly/assembly.xml | 41 ---- .../testcase/shardingsphere/Application.java | 36 --- .../controller/CaseController.java | 59 ----- .../service/api/entity/Order.java | 61 ----- .../service/api/entity/OrderItem.java | 71 ------ .../api/repository/CommonRepository.java | 38 ---- .../api/repository/OrderItemRepository.java | 24 -- .../api/repository/OrderRepository.java | 24 -- .../service/api/service/CommonService.java | 32 --- .../api/service/CommonServiceImpl.java | 108 --------- ...atabasesAndTablesConfigurationPrecise.java | 76 ------- .../jdbc/JDBCOrderItemRepositoryImpl.java | 126 ----------- .../jdbc/JDBCOrderRepositoryImpl.java | 124 ---------- .../repository/service/RawPojoService.java | 60 ----- ...reciseModuloShardingDatabaseAlgorithm.java | 37 --- .../PreciseModuloShardingTableAlgorithm.java | 36 --- .../RangeModuloShardingDatabaseAlgorithm.java | 53 ----- .../RangeModuloShardingTableAlgorithm.java | 45 ---- .../utility/config/DataSourceUtil.java | 54 ----- .../utility/config/ExampleConfiguration.java | 29 --- .../src/main/resources/application.properties | 17 -- .../support-version.list | 17 -- .../bin/startup.sh | 21 -- .../config/expectedData.yaml | 174 --------------- .../configuration.yml | 20 -- .../shardingsphere-4.x-RC3-scenario/pom.xml | 149 ------------- .../src/main/assembly/assembly.xml | 41 ---- .../testcase/shardingsphere/Application.java | 36 --- .../controller/CaseController.java | 59 ----- .../service/api/entity/Order.java | 61 ----- .../service/api/entity/OrderItem.java | 71 ------ .../api/repository/CommonRepository.java | 38 ---- .../api/repository/OrderItemRepository.java | 24 -- .../api/repository/OrderRepository.java | 24 -- .../service/api/service/CommonService.java | 32 --- .../api/service/CommonServiceImpl.java | 108 --------- ...atabasesAndTablesConfigurationPrecise.java | 76 ------- .../jdbc/JDBCOrderItemRepositoryImpl.java | 126 ----------- .../jdbc/JDBCOrderRepositoryImpl.java | 124 ---------- .../repository/service/RawPojoService.java | 60 ----- ...reciseModuloShardingDatabaseAlgorithm.java | 37 --- .../PreciseModuloShardingTableAlgorithm.java | 36 --- .../RangeModuloShardingDatabaseAlgorithm.java | 53 ----- .../RangeModuloShardingTableAlgorithm.java | 45 ---- .../utility/config/DataSourceUtil.java | 54 ----- .../utility/config/ExampleConfiguration.java | 29 --- .../src/main/resources/application.properties | 17 -- .../support-version.list | 17 -- 91 files changed, 2 insertions(+), 5282 deletions(-) delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/pom.xml delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/AsyncExecuteInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecuteInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorEngineConstructorInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/resources/skywalking-plugin.def delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/sjdbc/InterceptorTest.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/pom.xml delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/Constant.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ExecuteInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/JDBCRootInvokeInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ParseInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ProxyRootInvokeInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/AbstractShardingSphereV4R3Instrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ParseInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/resources/skywalking-plugin.def delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/InterceptorTest.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/pom.xml delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/Constant.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ExecuteInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/JDBCRootInvokeInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ParseInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ProxyRootInvokeInterceptor.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/AbstractShardingSphereV4Instrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ParseInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/resources/skywalking-plugin.def delete mode 100644 apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/InterceptorTest.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/bin/startup.sh delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/configuration.yml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/pom.xml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/assembly/assembly.xml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/resources/application.properties delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/support-version.list delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/bin/startup.sh delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/configuration.yml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/pom.xml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/assembly/assembly.xml delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/resources/application.properties delete mode 100644 test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/support-version.list diff --git a/.github/workflows/plugins-test.2.yaml b/.github/workflows/plugins-test.2.yaml index a1191ddeb..d4e205861 100644 --- a/.github/workflows/plugins-test.2.yaml +++ b/.github/workflows/plugins-test.2.yaml @@ -56,8 +56,6 @@ jobs: - servicecomb-0.x-scenario - servicecomb-1.x-scenario - shardingsphere-3.x-scenario - - shardingsphere-4.x-RC1-RC2-scenario - - shardingsphere-4.x-RC3-scenario - shardingsphere-4.0.x-scenario - shardingsphere-4.x-scenario - shardingsphere-5.0.0-beta-scenario diff --git a/CHANGES.md b/CHANGES.md index 50628e191..4ab666c5f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -33,6 +33,7 @@ Release Notes. * Support Kafka SASL login module. * Fix gateway plugin async finish repeatedly when fallback url configured. * Chore: polish methods naming for `Spring-Kafka` plugins. +* Remove plugins for ShardingSphere legacy version. #### OAP-Backend diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml index df1ec7bec..224c31971 100644 --- a/apm-sniffer/apm-sdk-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/pom.xml @@ -46,10 +46,7 @@ nutz-plugins jetty-plugin spymemcached-2.x-plugin - sharding-jdbc-1.5.x-plugin sharding-sphere-3.x-plugin - sharding-sphere-4.x-plugin - sharding-sphere-4.x-RC3-plugin sharding-sphere-4.0.x-plugin sharding-sphere-4.1.0-plugin shardingsphere-5.0.0-beta-plugin diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/pom.xml deleted file mode 100644 index eaff12177..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - apm-sdk-plugin - org.apache.skywalking - 8.7.0-SNAPSHOT - - 4.0.0 - - apm-sharding-jdbc-1.5.x-plugin - jar - - sharding-jdbc-1.5.x-plugin - http://maven.apache.org - - - UTF-8 - - - - - mysql - mysql-connector-java - [2.0.14,6.0.6] - test - - - com.dangdang - sharding-jdbc-core - [1.5.0,2.0.0) - provided - - - - - - - maven-deploy-plugin - - - - diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java deleted file mode 100644 index 98128ed2c..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/ExecuteEventListener.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.skywalking.apm.plugin.sjdbc; - -import com.dangdang.ddframe.rdb.sharding.executor.event.AbstractExecutionEvent; -import com.dangdang.ddframe.rdb.sharding.executor.event.DMLExecutionEvent; -import com.dangdang.ddframe.rdb.sharding.executor.event.DQLExecutionEvent; -import com.dangdang.ddframe.rdb.sharding.executor.threadlocal.ExecutorDataMap; -import com.dangdang.ddframe.rdb.sharding.util.EventBusInstance; -import com.google.common.eventbus.AllowConcurrentEvents; -import com.google.common.eventbus.Subscribe; -import java.util.stream.Collectors; -import org.apache.skywalking.apm.agent.core.context.tag.Tags; -import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; -import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; -import org.apache.skywalking.apm.plugin.sjdbc.define.AsyncExecuteInterceptor; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; - -/** - * Sharding-jdbc provides {@link EventBusInstance} to help external systems getDefault events of sql execution. {@link - * ExecuteEventListener} can getDefault sql statement start and end events, resulting in db span. - */ -public class ExecuteEventListener { - - public static void init() { - EventBusInstance.getInstance().register(new ExecuteEventListener()); - } - - @Subscribe - @AllowConcurrentEvents - public void listenDML(DMLExecutionEvent event) { - handle(event, "MODIFY"); - } - - @Subscribe - @AllowConcurrentEvents - public void listenDQL(DQLExecutionEvent event) { - handle(event, "QUERY"); - } - - private void handle(AbstractExecutionEvent event, String operation) { - switch (event.getEventExecutionType()) { - case BEFORE_EXECUTE: - AbstractSpan span = ContextManager.createExitSpan("/SJDBC/BRANCH/" + operation, event.getDataSource()); - if (ExecutorDataMap.getDataMap().containsKey(AsyncExecuteInterceptor.SNAPSHOT_DATA_KEY)) { - ContextManager.continued((ContextSnapshot) ExecutorDataMap.getDataMap() - .get(AsyncExecuteInterceptor.SNAPSHOT_DATA_KEY)); - } - Tags.DB_TYPE.set(span, "sql"); - Tags.DB_INSTANCE.set(span, event.getDataSource()); - Tags.DB_STATEMENT.set(span, event.getSql()); - if (!event.getParameters().isEmpty()) { - String variables = event.getParameters() - .stream() - .map(String::valueOf) - .collect(Collectors.joining(",")); - Tags.DB_BIND_VARIABLES.set(span, variables); - } - span.setComponent(ComponentsDefine.SHARDING_JDBC); - SpanLayer.asDB(span); - break; - case EXECUTE_FAILURE: - span = ContextManager.activeSpan(); - span.errorOccurred(); - if (event.getException().isPresent()) { - span.log(event.getException().get()); - } - // fall through - case EXECUTE_SUCCESS: - ContextManager.stopSpan(); - } - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/AsyncExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/AsyncExecuteInterceptor.java deleted file mode 100644 index 2c5cdb483..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/AsyncExecuteInterceptor.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.skywalking.apm.plugin.sjdbc.define; - -import com.dangdang.ddframe.rdb.sharding.constant.SQLType; -import com.dangdang.ddframe.rdb.sharding.executor.ExecuteCallback; -import com.dangdang.ddframe.rdb.sharding.executor.threadlocal.ExecutorDataMap; -import java.util.Collection; -import java.util.List; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; - -import java.lang.reflect.Method; - -/** - * {@link AsyncExecuteInterceptor} enhances {@link com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine#asyncExecute(SQLType, - * Collection, List, ExecuteCallback)} so that the sql executor can get a {@link ContextSnapshot} of main thread when it - * is executed asynchronously. - */ -public class AsyncExecuteInterceptor implements InstanceMethodsAroundInterceptor { - - public static final String SNAPSHOT_DATA_KEY = "APM_SKYWALKING_SNAPSHOT_DATA"; - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) throws Throwable { - ExecutorDataMap.getDataMap().put(SNAPSHOT_DATA_KEY, ContextManager.capture()); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) throws Throwable { - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecuteInterceptor.java deleted file mode 100644 index f1d2f822b..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecuteInterceptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.skywalking.apm.plugin.sjdbc.define; - -import com.dangdang.ddframe.rdb.sharding.constant.SQLType; -import com.dangdang.ddframe.rdb.sharding.executor.ExecuteCallback; -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.List; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -/** - * {@link ExecuteInterceptor} enhances {@link com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine#execute(SQLType, - * Collection, List, ExecuteCallback)} ,creating a local span that records the overall execution of sql - */ -public class ExecuteInterceptor implements InstanceMethodsAroundInterceptor { - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) throws Throwable { - SQLType sqlType = (SQLType) allArguments[0]; - ContextManager.createLocalSpan("/SJDBC/TRUNK/" + sqlType.name()).setComponent(ComponentsDefine.SHARDING_JDBC); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) throws Throwable { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorEngineConstructorInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorEngineConstructorInterceptor.java deleted file mode 100644 index 28b7f407b..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorEngineConstructorInterceptor.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.skywalking.apm.plugin.sjdbc.define; - -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor; -import org.apache.skywalking.apm.plugin.sjdbc.ExecuteEventListener; - -/** - * {@link ExecutorEngineConstructorInterceptor} enhances {@link com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine}'s - * constructor, initializing {@link ExecuteEventListener} - */ -public class ExecutorEngineConstructorInterceptor implements InstanceConstructorInterceptor { - - @Override - public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { - ExecuteEventListener.init(); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorInstrumentation.java deleted file mode 100644 index b4625bb53..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/sjdbc/define/ExecutorInstrumentation.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.skywalking.apm.plugin.sjdbc.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.any; -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * {@link ExecutorInstrumentation} presents that skywalking intercepts {@link com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine}. - */ -public class ExecutorInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { - - private static final String ENHANCE_CLASS = "com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine"; - - private static final String EXECUTOR_ENGINE_CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.sjdbc.define.ExecutorEngineConstructorInterceptor"; - - private static final String EXECUTE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.sjdbc.define.ExecuteInterceptor"; - - private static final String ASYNC_EXECUTE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.sjdbc.define.AsyncExecuteInterceptor"; - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[] { - new ConstructorInterceptPoint() { - @Override - public ElementMatcher getConstructorMatcher() { - return any(); - } - - @Override - public String getConstructorInterceptor() { - return EXECUTOR_ENGINE_CONSTRUCTOR_INTERCEPTOR_CLASS; - } - } - }; - } - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("execute"); - } - - @Override - public String getMethodsInterceptor() { - return EXECUTE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - }, - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("asyncExecute"); - } - - @Override - public String getMethodsInterceptor() { - return ASYNC_EXECUTE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/resources/skywalking-plugin.def deleted file mode 100644 index bfb2fd770..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/main/resources/skywalking-plugin.def +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -sharding-jdbc-1.5.x=org.apache.skywalking.apm.plugin.sjdbc.define.ExecutorInstrumentation diff --git a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/sjdbc/InterceptorTest.java b/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/sjdbc/InterceptorTest.java deleted file mode 100644 index d9d65ba6e..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-jdbc-1.5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/sjdbc/InterceptorTest.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * 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.skywalking.apm.plugin.sjdbc; - -import com.dangdang.ddframe.rdb.sharding.constant.SQLType; -import com.dangdang.ddframe.rdb.sharding.executor.event.DMLExecutionEvent; -import com.dangdang.ddframe.rdb.sharding.executor.event.DQLExecutionEvent; -import com.dangdang.ddframe.rdb.sharding.executor.event.EventExecutionType; -import com.dangdang.ddframe.rdb.sharding.executor.threadlocal.ExecutorDataMap; -import com.dangdang.ddframe.rdb.sharding.util.EventBusInstance; -import com.google.common.base.Optional; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; -import org.apache.skywalking.apm.agent.test.helper.SegmentHelper; -import org.apache.skywalking.apm.agent.test.tools.SegmentStorage; -import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint; -import org.apache.skywalking.apm.agent.test.tools.SpanAssert; -import org.apache.skywalking.apm.plugin.sjdbc.define.AsyncExecuteInterceptor; -import org.apache.skywalking.apm.plugin.sjdbc.define.ExecutorEngineConstructorInterceptor; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.modules.junit4.PowerMockRunnerDelegate; -import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan; -import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment; -import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule; -import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; -import org.apache.skywalking.apm.plugin.sjdbc.define.ExecuteInterceptor; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.apache.skywalking.apm.agent.test.tools.SpanAssert.assertComponent; - -@RunWith(PowerMockRunner.class) -@PowerMockRunnerDelegate(TracingSegmentRunner.class) -public class InterceptorTest { - - private static ExecutorService ES; - - @SegmentStoragePoint - private SegmentStorage segmentStorage; - - @Rule - public AgentServiceRule serviceRule = new AgentServiceRule(); - - private ExecuteInterceptor executeInterceptor; - - private AsyncExecuteInterceptor asyncExecuteInterceptor; - - private Object[] allArguments; - - @BeforeClass - public static void init() { - ExecuteEventListener.init(); - new ExecutorEngineConstructorInterceptor().onConstruct(null, null); - ES = Executors.newSingleThreadExecutor(); - } - - @AfterClass - public static void finish() { - ES.shutdown(); - } - - @Before - public void setUp() throws SQLException { - executeInterceptor = new ExecuteInterceptor(); - asyncExecuteInterceptor = new AsyncExecuteInterceptor(); - allArguments = new Object[] { - SQLType.DQL, - null - }; - } - - @Test - public void assertSyncExecute() throws Throwable { - executeInterceptor.beforeMethod(null, null, allArguments, null, null); - sendEvent("ds_0", "select * from t_order_0"); - executeInterceptor.afterMethod(null, null, allArguments, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(2)); - assertSpan(spans.get(0), 0); - assertThat(spans.get(1).getOperationName(), is("/SJDBC/TRUNK/DQL")); - } - - @Test - public void assertAsyncExecute() throws Throwable { - executeInterceptor.beforeMethod(null, null, allArguments, null, null); - asyncExecuteInterceptor.beforeMethod(null, null, null, null, null); - final Map dataMap = ExecutorDataMap.getDataMap(); - ES.submit(new Runnable() { - @Override - public void run() { - ExecutorDataMap.setDataMap(dataMap); - sendEvent("ds_1", "select * from t_order_1"); - } - }).get(); - asyncExecuteInterceptor.afterMethod(null, null, null, null, null); - sendEvent("ds_0", "select * from t_order_0"); - executeInterceptor.afterMethod(null, null, allArguments, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(2)); - TraceSegment segment0 = segmentStorage.getTraceSegments().get(0); - TraceSegment segment1 = segmentStorage.getTraceSegments().get(1); - assertNotNull(segment0.getRef()); - assertNull(segment1.getRef()); - List spans0 = SegmentHelper.getSpans(segment0); - assertNotNull(spans0); - assertThat(spans0.size(), is(1)); - assertSpan(spans0.get(0), 1); - List spans1 = SegmentHelper.getSpans(segment1); - assertNotNull(spans1); - assertThat(spans1.size(), is(2)); - assertSpan(spans1.get(0), 0); - assertThat(spans1.get(1).getOperationName(), is("/SJDBC/TRUNK/DQL")); - } - - @Test - public void assertExecuteError() throws Throwable { - executeInterceptor.beforeMethod(null, null, allArguments, null, null); - asyncExecuteInterceptor.beforeMethod(null, null, null, null, null); - final Map dataMap = ExecutorDataMap.getDataMap(); - ES.submit(new Runnable() { - @Override - public void run() { - ExecutorDataMap.setDataMap(dataMap); - sendError(); - } - }).get(); - asyncExecuteInterceptor.handleMethodException(null, null, null, null, new SQLException("test")); - asyncExecuteInterceptor.afterMethod(null, null, null, null, null); - sendEvent("ds_0", "select * from t_order_0"); - executeInterceptor.handleMethodException(null, null, allArguments, null, new SQLException("Test")); - executeInterceptor.afterMethod(null, null, allArguments, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(2)); - TraceSegment segment0 = segmentStorage.getTraceSegments().get(0); - TraceSegment segment1 = segmentStorage.getTraceSegments().get(1); - List spans0 = SegmentHelper.getSpans(segment0); - assertNotNull(spans0); - assertThat(spans0.size(), is(1)); - assertErrorSpan(spans0.get(0)); - List spans1 = SegmentHelper.getSpans(segment1); - assertNotNull(spans1); - assertThat(spans1.size(), is(2)); - assertSpan(spans1.get(0), 0); - assertErrorSpan(spans1.get(1)); - } - - private void assertSpan(AbstractTracingSpan span, int index) { - assertComponent(span, ComponentsDefine.SHARDING_JDBC); - SpanAssert.assertLayer(span, SpanLayer.DB); - SpanAssert.assertTag(span, 0, "sql"); - SpanAssert.assertTag(span, 1, "ds_" + index); - SpanAssert.assertTag(span, 2, "select * from t_order_" + index); - assertThat(span.isExit(), is(true)); - assertThat(span.getOperationName(), is("/SJDBC/BRANCH/QUERY")); - } - - private void assertErrorSpan(AbstractTracingSpan span) { - SpanAssert.assertOccurException(span, true); - } - - private void sendEvent(String datasource, String sql) { - List parameters = new ArrayList(); - parameters.add("1"); - parameters.add(100); - - DQLExecutionEvent event = new DQLExecutionEvent(datasource, sql, parameters); - EventBusInstance.getInstance().post(event); - event.setEventExecutionType(EventExecutionType.EXECUTE_SUCCESS); - EventBusInstance.getInstance().post(event); - } - - private void sendError() { - DMLExecutionEvent event = new DMLExecutionEvent("", "", Collections.emptyList()); - EventBusInstance.getInstance().post(event); - event.setEventExecutionType(EventExecutionType.EXECUTE_FAILURE); - event.setException(Optional.of(new SQLException("Test"))); - EventBusInstance.getInstance().post(event); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/pom.xml deleted file mode 100644 index ef8965231..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - apm-sdk-plugin - org.apache.skywalking - 8.7.0-SNAPSHOT - - 4.0.0 - - apm-sharding-sphere-4.x-rc3-plugin - jar - - sharding-sphere-4.x-rc3-plugin - http://maven.apache.org - - - UTF-8 - 4.0.0-RC3 - - - - - mysql - mysql-connector-java - [2.0.14,6.0.6] - test - - - org.apache.shardingsphere - sharding-core-execute - ${shardingsphere.version} - provided - - - org.apache.shardingsphere - sharding-jdbc-core - ${shardingsphere.version} - provided - - - org.apache.shardingsphere - sharding-proxy-frontend-core - ${shardingsphere.version} - provided - - - - - - - maven-deploy-plugin - - - - diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/Constant.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/Constant.java deleted file mode 100644 index 2629d309b..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/Constant.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3; - -public final class Constant { - - public static final String CONTEXT_SNAPSHOT = "CONTEXT_SNAPSHOT"; -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ExecuteInterceptor.java deleted file mode 100644 index 1666611fa..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ExecuteInterceptor.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3; - -import org.apache.shardingsphere.core.execute.ShardingExecuteDataMap; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; -import java.util.Map; - -/** - * {@link ExecuteInterceptor} enhances {@link org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback}, - * creating a local span that records the execution of sql. - */ -public class ExecuteInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - ContextManager.createLocalSpan("/ShardingSphere/executeSQL/").setComponent(ComponentsDefine.SHARDING_SPHERE); - ContextSnapshot contextSnapshot = (ContextSnapshot) ShardingExecuteDataMap.getDataMap() - .get(Constant.CONTEXT_SNAPSHOT); - if (null == contextSnapshot) { - contextSnapshot = (ContextSnapshot) ((Map) allArguments[2]).get(Constant.CONTEXT_SNAPSHOT); - } - if (null != contextSnapshot) { - ContextManager.continued(contextSnapshot); - } - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/JDBCRootInvokeInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/JDBCRootInvokeInterceptor.java deleted file mode 100644 index 999d4e039..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/JDBCRootInvokeInterceptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3; - -import org.apache.shardingsphere.core.execute.ShardingExecuteDataMap; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; - -/** - * {@link JDBCRootInvokeInterceptor} enhances {@link org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}, - * creating a local span that records the overall execution of sql. - */ -public class JDBCRootInvokeInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - ContextManager.createLocalSpan("/ShardingSphere/JDBCRootInvoke/") - .setComponent(ComponentsDefine.SHARDING_SPHERE); - ShardingExecuteDataMap.getDataMap().put(Constant.CONTEXT_SNAPSHOT, ContextManager.capture()); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ParseInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ParseInterceptor.java deleted file mode 100644 index c2c36fc79..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ParseInterceptor.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3; - -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.context.tag.Tags; -import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; - -/** - * {@link ParseInterceptor} enhances {@link org.apache.shardingsphere.core.route.router.sharding.ShardingRouter}, - * creating a local span that records the parse of sql. - */ -public class ParseInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - AbstractSpan span = ContextManager.createLocalSpan("/ShardingSphere/parseSQL/") - .setComponent(ComponentsDefine.SHARDING_SPHERE); - Tags.DB_STATEMENT.set(span, (String) allArguments[0]); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ProxyRootInvokeInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ProxyRootInvokeInterceptor.java deleted file mode 100644 index 692c2b69e..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/ProxyRootInvokeInterceptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3; - -import org.apache.shardingsphere.core.execute.ShardingExecuteDataMap; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; - -/** - * ProxyRootInvokeInterceptor enhances org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask, - * creating a local span that records the overall execution of sql. - */ -public class ProxyRootInvokeInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - ContextManager.createLocalSpan("/ShardingSphere/ProxyRootInvoke/") - .setComponent(ComponentsDefine.SHARDING_SPHERE); - ShardingExecuteDataMap.getDataMap().put(Constant.CONTEXT_SNAPSHOT, ContextManager.capture()); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/AbstractShardingSphereV4R3Instrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/AbstractShardingSphereV4R3Instrumentation.java deleted file mode 100644 index aab714020..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/AbstractShardingSphereV4R3Instrumentation.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3.define; - -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; - -public abstract class AbstractShardingSphereV4R3Instrumentation extends ClassInstanceMethodsEnhancePluginDefine { - public static final String WITHNESS_CLASSES = "org.apache.shardingsphere.core.parse.SQLParseEngine"; - - @Override - protected final String[] witnessClasses() { - return new String[] {WITHNESS_CLASSES}; - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java deleted file mode 100644 index 7ca76d0c2..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ExecuteInstrumentation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * {@link ExecuteInstrumentation} presents that skywalking intercepts {@link org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback}. - */ -public class ExecuteInstrumentation extends AbstractShardingSphereV4R3Instrumentation { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback"; - - private static final String EXECUTE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.ExecuteInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("execute0"); - } - - @Override - public String getMethodsInterceptor() { - return EXECUTE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java deleted file mode 100644 index 5c8c15a65..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/JDBCRootInvokeInstrumentation.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts {@link - * org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}. - */ -public class JDBCRootInvokeInstrumentation extends AbstractShardingSphereV4R3Instrumentation { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor"; - - private static final String JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.JDBCRootInvokeInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("executeCallback"); - } - - @Override - public String getMethodsInterceptor() { - return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ParseInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ParseInstrumentation.java deleted file mode 100644 index c842de4e7..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ParseInstrumentation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * {@link ParseInstrumentation} presents that skywalking intercepts {@link org.apache.shardingsphere.core.route.router.sharding.ShardingRouter}. - */ -public class ParseInstrumentation extends AbstractShardingSphereV4R3Instrumentation { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.core.route.router.sharding.ShardingRouter"; - - private static final String EXECUTE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.ParseInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("parse"); - } - - @Override - public String getMethodsInterceptor() { - return EXECUTE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java deleted file mode 100644 index 80c631195..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/define/ProxyRootInvokeInstrumentation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * ProxyRootInvokeInstrumentation presents that skywalking intercepts org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask. - */ -public class ProxyRootInvokeInstrumentation extends AbstractShardingSphereV4R3Instrumentation { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask"; - - private static final String PROXY_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.ProxyRootInvokeInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("run"); - } - - @Override - public String getMethodsInterceptor() { - return PROXY_ROOT_INVOKE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/resources/skywalking-plugin.def deleted file mode 100644 index 5d1519ee8..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/main/resources/skywalking-plugin.def +++ /dev/null @@ -1,19 +0,0 @@ -# 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. -sharding-sphere-4.x-rc3=org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.define.ProxyRootInvokeInstrumentation -sharding-sphere-4.x-rc3=org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.define.JDBCRootInvokeInstrumentation -sharding-sphere-4.x-rc3=org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.define.ParseInstrumentation -sharding-sphere-4.x-rc3=org.apache.skywalking.apm.plugin.shardingsphere.v4rc3.define.ExecuteInstrumentation diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/InterceptorTest.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/InterceptorTest.java deleted file mode 100644 index be81a4351..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-RC3-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/v4rc3/InterceptorTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4rc3; - -import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan; -import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment; -import org.apache.skywalking.apm.agent.test.helper.SegmentHelper; -import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule; -import org.apache.skywalking.apm.agent.test.tools.SegmentStorage; -import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint; -import org.apache.skywalking.apm.agent.test.tools.SpanAssert; -import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.modules.junit4.PowerMockRunnerDelegate; - -import java.util.HashMap; -import java.util.List; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; - -@RunWith(PowerMockRunner.class) -@PowerMockRunnerDelegate(TracingSegmentRunner.class) -public class InterceptorTest { - - @SegmentStoragePoint - private SegmentStorage segmentStorage; - - @Rule - public AgentServiceRule serviceRule = new AgentServiceRule(); - - private ProxyRootInvokeInterceptor proxyRootInvokeInterceptor; - - private JDBCRootInvokeInterceptor jdbcRootInvokeInterceptor; - - private ParseInterceptor parseInterceptor; - - private ExecuteInterceptor executeInterceptor; - - @Before - public void setUp() { - proxyRootInvokeInterceptor = new ProxyRootInvokeInterceptor(); - jdbcRootInvokeInterceptor = new JDBCRootInvokeInterceptor(); - parseInterceptor = new ParseInterceptor(); - executeInterceptor = new ExecuteInterceptor(); - } - - @Test - public void assertProxyRootInvoke() { - proxyRootInvokeInterceptor.beforeMethod(null, null, null, null, null); - proxyRootInvokeInterceptor.afterMethod(null, null, null, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/ProxyRootInvoke/")); - } - - @Test - public void assertJDBCRootInvoke() { - jdbcRootInvokeInterceptor.beforeMethod(null, null, null, null, null); - jdbcRootInvokeInterceptor.afterMethod(null, null, null, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/JDBCRootInvoke/")); - } - - @Test - public void assertParse() { - Object[] allArguments = new Object[] { - "SELECT * FROM t_order", - false - }; - parseInterceptor.beforeMethod(null, null, allArguments, null, null); - parseInterceptor.afterMethod(null, null, allArguments, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/parseSQL/")); - SpanAssert.assertTag(spans.get(0), 0, "SELECT * FROM t_order"); - } - - @Test - public void assertExecute() { - Object[] allArguments = new Object[] { - null, - null, - new HashMap() - }; - executeInterceptor.beforeMethod(null, null, allArguments, null, null); - executeInterceptor.afterMethod(null, null, allArguments, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/executeSQL/")); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/pom.xml deleted file mode 100644 index 76f0060da..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - apm-sdk-plugin - org.apache.skywalking - 8.7.0-SNAPSHOT - - 4.0.0 - - apm-sharding-sphere-4.x-plugin - jar - - sharding-sphere-4.x-plugin - http://maven.apache.org - - - UTF-8 - [4.0.0-RC1, 4.0.0-RC2] - - - - - mysql - mysql-connector-java - [2.0.14,6.0.6] - test - - - org.apache.shardingsphere - sharding-core-execute - ${shardingsphere.version} - provided - - - org.apache.shardingsphere - sharding-jdbc-core - ${shardingsphere.version} - provided - - - org.apache.shardingsphere - sharding-proxy-frontend-core - ${shardingsphere.version} - provided - - - - - - - maven-deploy-plugin - - - - diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/Constant.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/Constant.java deleted file mode 100644 index c2fc12866..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/Constant.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4; - -public final class Constant { - - public static final String CONTEXT_SNAPSHOT = "CONTEXT_SNAPSHOT"; -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ExecuteInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ExecuteInterceptor.java deleted file mode 100644 index 7ebd16808..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ExecuteInterceptor.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4; - -import org.apache.shardingsphere.core.execute.ShardingExecuteDataMap; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; -import java.util.Map; - -/** - * {@link ExecuteInterceptor} enhances {@link org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback}, - * creating a local span that records the execution of sql. - */ -public class ExecuteInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - ContextManager.createLocalSpan("/ShardingSphere/executeSQL/").setComponent(ComponentsDefine.SHARDING_SPHERE); - ContextSnapshot contextSnapshot = (ContextSnapshot) ShardingExecuteDataMap.getDataMap() - .get(Constant.CONTEXT_SNAPSHOT); - if (null == contextSnapshot) { - contextSnapshot = (ContextSnapshot) ((Map) allArguments[2]).get(Constant.CONTEXT_SNAPSHOT); - } - if (null != contextSnapshot) { - ContextManager.continued(contextSnapshot); - } - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/JDBCRootInvokeInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/JDBCRootInvokeInterceptor.java deleted file mode 100644 index 36258950d..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/JDBCRootInvokeInterceptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4; - -import org.apache.shardingsphere.core.execute.ShardingExecuteDataMap; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; - -/** - * {@link JDBCRootInvokeInterceptor} enhances {@link org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}, - * creating a local span that records the overall execution of sql. - */ -public class JDBCRootInvokeInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - ContextManager.createLocalSpan("/ShardingSphere/JDBCRootInvoke/") - .setComponent(ComponentsDefine.SHARDING_SPHERE); - ShardingExecuteDataMap.getDataMap().put(Constant.CONTEXT_SNAPSHOT, ContextManager.capture()); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ParseInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ParseInterceptor.java deleted file mode 100644 index aa72170ce..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ParseInterceptor.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4; - -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.context.tag.Tags; -import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; - -/** - * {@link ParseInterceptor} enhances {@link org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter}, - * creating a local span that records the parse of sql. - */ -public class ParseInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - AbstractSpan span = ContextManager.createLocalSpan("/ShardingSphere/parseSQL/") - .setComponent(ComponentsDefine.SHARDING_SPHERE); - Tags.DB_STATEMENT.set(span, (String) allArguments[0]); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ProxyRootInvokeInterceptor.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ProxyRootInvokeInterceptor.java deleted file mode 100644 index 1f2771a50..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/ProxyRootInvokeInterceptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4; - -import org.apache.shardingsphere.core.execute.ShardingExecuteDataMap; -import org.apache.skywalking.apm.agent.core.context.ContextManager; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; -import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; - -import java.lang.reflect.Method; - -/** - * ProxyRootInvokeInterceptor enhances org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask, - * creating a local span that records the overall execution of sql. - */ -public class ProxyRootInvokeInterceptor implements InstanceMethodsAroundInterceptor { - - @Override - public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - MethodInterceptResult result) { - ContextManager.createLocalSpan("/ShardingSphere/ProxyRootInvoke/") - .setComponent(ComponentsDefine.SHARDING_SPHERE); - ShardingExecuteDataMap.getDataMap().put(Constant.CONTEXT_SNAPSHOT, ContextManager.capture()); - } - - @Override - public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class[] argumentsTypes, - Object ret) { - ContextManager.stopSpan(); - return ret; - } - - @Override - public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, - Class[] argumentsTypes, Throwable t) { - ContextManager.activeSpan().log(t); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/AbstractShardingSphereV4Instrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/AbstractShardingSphereV4Instrumentation.java deleted file mode 100644 index aadb1742e..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/AbstractShardingSphereV4Instrumentation.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4.define; - -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; - -public abstract class AbstractShardingSphereV4Instrumentation extends ClassInstanceMethodsEnhancePluginDefine { - public static final String WITHNESS_CLASSES = "org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter"; - - @Override - protected final String[] witnessClasses() { - return new String[] {WITHNESS_CLASSES}; - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java deleted file mode 100644 index 394e21286..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ExecuteInstrumentation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * {@link ExecuteInstrumentation} presents that skywalking intercepts {@link org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback}. - */ -public class ExecuteInstrumentation extends AbstractShardingSphereV4Instrumentation { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.core.execute.sql.execute.SQLExecuteCallback"; - - private static final String EXECUTE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4.ExecuteInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("execute0"); - } - - @Override - public String getMethodsInterceptor() { - return EXECUTE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java deleted file mode 100644 index bfd9deb33..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/JDBCRootInvokeInstrumentation.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * {@link JDBCRootInvokeInstrumentation} presents that skywalking intercepts {@link - * org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor}. - */ -public class JDBCRootInvokeInstrumentation extends AbstractShardingSphereV4Instrumentation { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingjdbc.executor.AbstractStatementExecutor"; - - private static final String JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4.JDBCRootInvokeInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("executeCallback"); - } - - @Override - public String getMethodsInterceptor() { - return JDBC_ROOT_INVOKE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ParseInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ParseInstrumentation.java deleted file mode 100644 index 05442c5b8..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ParseInstrumentation.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * {@link ParseInstrumentation} presents that skywalking intercepts {@link org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter}. - */ -public class ParseInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter"; - - private static final String EXECUTE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4.ParseInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("parse"); - } - - @Override - public String getMethodsInterceptor() { - return EXECUTE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java deleted file mode 100644 index 062c6d88b..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shardingsphere/v4/define/ProxyRootInvokeInstrumentation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere.v4.define; - -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; -import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; -import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch; - -import static net.bytebuddy.matcher.ElementMatchers.named; - -/** - * ProxyRootInvokeInstrumentation presents that skywalking intercepts org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask. - */ -public class ProxyRootInvokeInstrumentation extends AbstractShardingSphereV4Instrumentation { - - private static final String ENHANCE_CLASS = "org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask"; - - private static final String PROXY_ROOT_INVOKE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.shardingsphere.v4.ProxyRootInvokeInterceptor"; - - @Override - public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { - return new InstanceMethodsInterceptPoint[] { - new InstanceMethodsInterceptPoint() { - @Override - public ElementMatcher getMethodsMatcher() { - return named("run"); - } - - @Override - public String getMethodsInterceptor() { - return PROXY_ROOT_INVOKE_INTERCEPTOR_CLASS; - } - - @Override - public boolean isOverrideArgs() { - return false; - } - } - }; - } - - @Override - public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { - return new ConstructorInterceptPoint[0]; - } - - @Override - protected ClassMatch enhanceClass() { - return NameMatch.byName(ENHANCE_CLASS); - } -} diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/resources/skywalking-plugin.def deleted file mode 100644 index ba94b66b2..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/main/resources/skywalking-plugin.def +++ /dev/null @@ -1,19 +0,0 @@ -# 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. -sharding-sphere-4.x=org.apache.skywalking.apm.plugin.shardingsphere.v4.define.ProxyRootInvokeInstrumentation -sharding-sphere-4.x=org.apache.skywalking.apm.plugin.shardingsphere.v4.define.JDBCRootInvokeInstrumentation -sharding-sphere-4.x=org.apache.skywalking.apm.plugin.shardingsphere.v4.define.ParseInstrumentation -sharding-sphere-4.x=org.apache.skywalking.apm.plugin.shardingsphere.v4.define.ExecuteInstrumentation diff --git a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/InterceptorTest.java b/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/InterceptorTest.java deleted file mode 100644 index 919039866..000000000 --- a/apm-sniffer/apm-sdk-plugin/sharding-sphere-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/shardingsphere/InterceptorTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.skywalking.apm.plugin.shardingsphere; - -import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan; -import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment; -import org.apache.skywalking.apm.agent.test.helper.SegmentHelper; -import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule; -import org.apache.skywalking.apm.agent.test.tools.SegmentStorage; -import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint; -import org.apache.skywalking.apm.agent.test.tools.SpanAssert; -import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner; -import org.apache.skywalking.apm.plugin.shardingsphere.v4.ExecuteInterceptor; -import org.apache.skywalking.apm.plugin.shardingsphere.v4.JDBCRootInvokeInterceptor; -import org.apache.skywalking.apm.plugin.shardingsphere.v4.ParseInterceptor; -import org.apache.skywalking.apm.plugin.shardingsphere.v4.ProxyRootInvokeInterceptor; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.modules.junit4.PowerMockRunnerDelegate; - -import java.util.HashMap; -import java.util.List; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; - -@RunWith(PowerMockRunner.class) -@PowerMockRunnerDelegate(TracingSegmentRunner.class) -public class InterceptorTest { - - @SegmentStoragePoint - private SegmentStorage segmentStorage; - - @Rule - public AgentServiceRule serviceRule = new AgentServiceRule(); - - private ProxyRootInvokeInterceptor proxyRootInvokeInterceptor; - - private JDBCRootInvokeInterceptor jdbcRootInvokeInterceptor; - - private ParseInterceptor parseInterceptor; - - private ExecuteInterceptor executeInterceptor; - - @Before - public void setUp() { - proxyRootInvokeInterceptor = new ProxyRootInvokeInterceptor(); - jdbcRootInvokeInterceptor = new JDBCRootInvokeInterceptor(); - parseInterceptor = new ParseInterceptor(); - executeInterceptor = new ExecuteInterceptor(); - } - - @Test - public void assertProxyRootInvoke() { - proxyRootInvokeInterceptor.beforeMethod(null, null, null, null, null); - proxyRootInvokeInterceptor.afterMethod(null, null, null, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/ProxyRootInvoke/")); - } - - @Test - public void assertJDBCRootInvoke() { - jdbcRootInvokeInterceptor.beforeMethod(null, null, null, null, null); - jdbcRootInvokeInterceptor.afterMethod(null, null, null, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/JDBCRootInvoke/")); - } - - @Test - public void assertParse() { - Object[] allArguments = new Object[] { - "SELECT * FROM t_order", - false - }; - parseInterceptor.beforeMethod(null, null, allArguments, null, null); - parseInterceptor.afterMethod(null, null, allArguments, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/parseSQL/")); - SpanAssert.assertTag(spans.get(0), 0, "SELECT * FROM t_order"); - } - - @Test - public void assertExecute() { - Object[] allArguments = new Object[] { - null, - null, - new HashMap() - }; - executeInterceptor.beforeMethod(null, null, allArguments, null, null); - executeInterceptor.afterMethod(null, null, allArguments, null, null); - assertThat(segmentStorage.getTraceSegments().size(), is(1)); - TraceSegment segment = segmentStorage.getTraceSegments().get(0); - List spans = SegmentHelper.getSpans(segment); - assertNotNull(spans); - assertThat(spans.size(), is(1)); - assertThat(spans.get(0).getOperationName(), is("/ShardingSphere/executeSQL/")); - } -} diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md index 58d5ee5ca..3c54b631f 100644 --- a/docs/en/setup/service-agent/java-agent/Plugin-list.md +++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md @@ -69,12 +69,9 @@ - sentinel-1.x - servicecomb-0.x - servicecomb-1.x -- sharding-jdbc-1.5.x - sharding-sphere-3.x - sharding-sphere-4.0.0 - sharding-sphere-4.1.0 -- sharding-sphere-4.x -- sharding-sphere-4.x-rc3 - shardingsphere-5.0.0-beta - sofarpc - solrj-7.x diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md index a08d39cab..e5d1d97c7 100644 --- a/docs/en/setup/service-agent/java-agent/Supported-list.md +++ b/docs/en/setup/service-agent/java-agent/Supported-list.md @@ -35,8 +35,7 @@ metrics based on the tracing data. * Mysql Driver 5.x, 6.x, 8.x * Oracle Driver (Optional¹) * H2 Driver 1.3.x -> 1.4.x - * [Sharding-JDBC](https://github.com/shardingjdbc/sharding-jdbc) 1.5.x - * [ShardingSphere](https://github.com/apache/shardingsphere) 3.0.0, 4.0.0-RC1, 4.0.0, 4.0.1, 4.1.0, 4.1.1, 5.0.0-beta + * [ShardingSphere](https://github.com/apache/shardingsphere) 3.0.0, 4.0.0, 4.0.1, 4.1.0, 4.1.1, 5.0.0-beta * PostgreSQL Driver 8.x, 9.x, 42.x * Mariadb Driver 2.x, 1.8 * [InfluxDB](https://github.com/influxdata/influxdb-java) 2.5 -> 2.17 diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/bin/startup.sh b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/bin/startup.sh deleted file mode 100644 index 99d6645ff..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/bin/startup.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# 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. - -home="$(cd "$(dirname $0)"; pwd)" - -java -jar ${agent_opts} ${home}/../libs/shardingsphere-4.x-RC1-RC2-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml deleted file mode 100644 index b91745ae6..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml +++ /dev/null @@ -1,174 +0,0 @@ -# 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. -segmentItems: -- serviceName: shardingsphere-4.x-RC1-RC2-scenario - segmentSize: not null - segments: - - segmentId: not null - spans: - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_1} - - {key: db.statement, value: SELECT * FROM t_order_1} - skipAnalysis: 'false' - - operationName: /ShardingSphere/executeSQL/ - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - refs: - - {parentEndpoint: /shardingsphere-4.x-RC1-RC2-scenario/case/execute, networkAddress: '', - refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not - null, parentService: not null, traceId: not null} - skipAnalysis: 'false' - - segmentId: not null - spans: - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_0} - - {key: db.statement, value: SELECT * FROM t_order_1} - skipAnalysis: 'false' - - operationName: /ShardingSphere/executeSQL/ - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - refs: - - {parentEndpoint: /shardingsphere-4.x-RC1-RC2-scenario/case/execute, networkAddress: '', - refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not - null, parentService: not null, traceId: not null} - skipAnalysis: 'false' - - segmentId: not null - spans: - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_1} - - {key: db.statement, value: SELECT * FROM t_order_0} - skipAnalysis: 'false' - - operationName: /ShardingSphere/executeSQL/ - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - refs: - - {parentEndpoint: /shardingsphere-4.x-RC1-RC2-scenario/case/execute, networkAddress: '', - refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not - null, parentService: shardingsphere-4.x-RC1-RC2-scenario, traceId: not null} - skipAnalysis: 'false' - - segmentId: not null - spans: - - operationName: /ShardingSphere/parseSQL/ - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - tags: - - {key: db.statement, value: SELECT * FROM t_order} - skipAnalysis: 'false' - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 3 - spanId: 4 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_0} - - {key: db.statement, value: SELECT * FROM t_order_0} - skipAnalysis: 'false' - - {operationName: /ShardingSphere/executeSQL/, operationId: 0, parentSpanId: 2, - spanId: 3, spanLayer: Unknown, startTime: not null, endTime: not null, componentId: 60, - isError: false, spanType: Local, peer: '', skipAnalysis: 'false'} - - {operationName: /ShardingSphere/JDBCRootInvoke/, operationId: 0, parentSpanId: 0, - spanId: 2, spanLayer: Unknown, startTime: not null, endTime: not null, componentId: 60, - isError: false, spanType: Local, peer: '', skipAnalysis: 'false'} - - operationName: /shardingsphere-4.x-RC1-RC2-scenario/case/execute - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: not null - endTime: not null - componentId: 1 - isError: false - spanType: Entry - peer: '' - tags: - - {key: url, value: 'http://localhost:8080/shardingsphere-4.x-RC1-RC2-scenario/case/execute'} - - {key: http.method, value: GET} - skipAnalysis: 'false' diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/configuration.yml b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/configuration.yml deleted file mode 100644 index f7542015e..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/configuration.yml +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -type: jvm -entryService: http://localhost:8080/shardingsphere-4.x-RC1-RC2-scenario/case/execute -healthCheck: http://localhost:8080/shardingsphere-4.x-RC1-RC2-scenario/case/healthCheck -startScript: ./bin/startup.sh diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/pom.xml b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/pom.xml deleted file mode 100644 index e443f02ea..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - 4.0.0 - - org.apache.skywalking - shardingsphere-4.x-RC1-RC2-scenario - 5.0.0 - - skywalking-shardingsphere-4.x-RC1-RC2-scenario - - - UTF-8 - - 4.0.0-RC1 - - 2.6.2 - 4.3.8.RELEASE - 1.5.2.RELEASE - - - - - org.apache.shardingsphere - sharding-core-execute - ${test.framework.version} - - - org.apache.shardingsphere - sharding-jdbc-core - ${test.framework.version} - - - org.springframework.boot - spring-boot-starter - ${spring-boot-version} - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} - - - org.apache.logging.log4j - log4j-jcl - ${log4j.version} - - - org.springframework.boot - spring-boot-starter-tomcat - ${spring-boot-version} - - - org.springframework.boot - spring-boot-starter-web - ${spring-boot-version} - - - com.h2database - h2 - 1.4.196 - - - - shardingsphere-4.x-RC1-RC2-scenario - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - ${project.build.sourceEncoding} - - - - org.springframework.boot - spring-boot-maven-plugin - 1.5.9.RELEASE - - - - repackage - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - assemble - package - - single - - - - src/main/assembly/assembly.xml - - ./target/ - - - - - - - - - - spring-snapshots - https://repo.spring.io/snapshot - - - spring-milestones - https://repo.spring.io/milestone - - - diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/assembly/assembly.xml deleted file mode 100644 index d86b1ba13..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/assembly/assembly.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - zip - - - - - ./bin - 0775 - - - - - - ${project.build.directory}/shardingsphere-4.x-RC1-RC2-scenario.jar - ./libs - 0775 - - - diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java deleted file mode 100644 index 59ca2390a..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.support.SpringBootServletInitializer; - -@SpringBootApplication -public class Application extends SpringBootServletInitializer { - - public static void main(String[] args) { - try { - - SpringApplication.run(Application.class, args); - } catch (Exception e) { - // Never do this - } - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java deleted file mode 100644 index 33ccf6f5b..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.controller; - -import java.sql.SQLException; -import javax.sql.DataSource; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.service.CommonService; -import org.apache.skywalking.apm.testcase.shardingsphere.service.config.ShardingDatabasesAndTablesConfigurationPrecise; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderItemRepositoryImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderRepositoryImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.service.RawPojoService; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.config.DataSourceUtil; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/case") -public class CaseController { - - private CommonService commonService = null; - - @RequestMapping("/healthCheck") - @ResponseBody - public String healthCheck() throws SQLException { - DataSourceUtil.createDataSource(""); - DataSourceUtil.createSchema("demo_ds_0"); - DataSourceUtil.createSchema("demo_ds_1"); - DataSourceUtil.createDataSource("demo_ds_0"); - DataSourceUtil.createDataSource("demo_ds_1"); - DataSource dataSource = new ShardingDatabasesAndTablesConfigurationPrecise().createDataSource(); - commonService = new RawPojoService(new JDBCOrderRepositoryImpl(dataSource), new JDBCOrderItemRepositoryImpl(dataSource)); - commonService.initEnvironment(); - return "Success"; - } - - @RequestMapping("/execute") - @ResponseBody - public String execute() { - commonService.processSuccess(false); - return "Success"; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java deleted file mode 100644 index 5d00a352f..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.entity; - -import java.io.Serializable; - -public class Order implements Serializable { - - private static final long serialVersionUID = 661434701950670670L; - - private long orderId; - - private int userId; - - private String status; - - public long getOrderId() { - return orderId; - } - - public void setOrderId(final long orderId) { - this.orderId = orderId; - } - - public int getUserId() { - return userId; - } - - public void setUserId(final int userId) { - this.userId = userId; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } - - @Override - public String toString() { - return String.format("order_id: %s, user_id: %s, status: %s", orderId, userId, status); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java deleted file mode 100644 index 8ffa5b9fa..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.entity; - -import java.io.Serializable; - -public class OrderItem implements Serializable { - - private static final long serialVersionUID = 263434701950670170L; - - private long orderItemId; - - private long orderId; - - private int userId; - - private String status; - - public long getOrderItemId() { - return orderItemId; - } - - public void setOrderItemId(final long orderItemId) { - this.orderItemId = orderItemId; - } - - public long getOrderId() { - return orderId; - } - - public void setOrderId(final long orderId) { - this.orderId = orderId; - } - - public int getUserId() { - return userId; - } - - public void setUserId(final int userId) { - this.userId = userId; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } - - @Override - public String toString() { - return String.format("order_item_id:%s, order_id: %s, user_id: %s, status: %s", orderItemId, orderId, userId, status); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java deleted file mode 100644 index 51da35ec9..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.repository; - -import java.util.List; - -public interface CommonRepository { - - void createTableIfNotExists(); - - void dropTable(); - - void truncateTable(); - - Long insert(T entity); - - void delete(Long id); - - List selectAll(); - - List selectRange(); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java deleted file mode 100644 index ded004807..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.repository; - -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; - -public interface OrderItemRepository extends CommonRepository { -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java deleted file mode 100644 index 95e55a72c..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.repository; - -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; - -public interface OrderRepository extends CommonRepository { -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java deleted file mode 100644 index 066f122cd..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.service; - -public interface CommonService { - - void initEnvironment(); - - void cleanEnvironment(); - - void processSuccess(boolean isRangeSharding); - - void processFailure(); - - void printData(boolean isRangeSharding); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java deleted file mode 100644 index a1d358bbf..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.service; - -import java.util.ArrayList; -import java.util.List; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderItemRepository; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderRepository; - -public abstract class CommonServiceImpl implements CommonService { - - @Override - public void initEnvironment() { - getOrderRepository().createTableIfNotExists(); - getOrderItemRepository().createTableIfNotExists(); - getOrderRepository().truncateTable(); - getOrderItemRepository().truncateTable(); - insertData(); - } - - @Override - public void cleanEnvironment() { - getOrderRepository().dropTable(); - getOrderItemRepository().dropTable(); - } - - @Override - public void processSuccess(final boolean isRangeSharding) { - printData(isRangeSharding); - } - - @Override - public void processFailure() { - insertData(); - throw new RuntimeException("Exception occur for transaction test."); - } - - private List insertData() { - List result = new ArrayList<>(10); - for (int i = 1; i <= 10; i++) { - Order order = newOrder(); - order.setUserId(i); - order.setStatus("INSERT_TEST"); - getOrderRepository().insert(order); - OrderItem item = newOrderItem(); - item.setOrderId(order.getOrderId()); - item.setUserId(i); - item.setStatus("INSERT_TEST"); - getOrderItemRepository().insert(item); - result.add(order.getOrderId()); - } - return result; - } - - private void deleteData(final List orderIds) { - for (Long each : orderIds) { - getOrderRepository().delete(each); - getOrderItemRepository().delete(each); - } - } - - @Override - public void printData(final boolean isRangeSharding) { - if (isRangeSharding) { - printDataRange(); - } else { - printDataAll(); - } - } - - private void printDataRange() { - for (Object each : getOrderRepository().selectRange()) { - } - for (Object each : getOrderItemRepository().selectRange()) { - } - } - - private void printDataAll() { - for (Object each : getOrderRepository().selectAll()) { - } - } - - protected abstract OrderRepository getOrderRepository(); - - protected abstract OrderItemRepository getOrderItemRepository(); - - protected abstract Order newOrder(); - - protected abstract OrderItem newOrderItem(); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java deleted file mode 100644 index 0c5de3b9f..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.config; - -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import javax.sql.DataSource; -import org.apache.shardingsphere.api.config.sharding.KeyGeneratorConfiguration; -import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration; -import org.apache.shardingsphere.api.config.sharding.TableRuleConfiguration; -import org.apache.shardingsphere.api.config.sharding.strategy.InlineShardingStrategyConfiguration; -import org.apache.shardingsphere.api.config.sharding.strategy.StandardShardingStrategyConfiguration; -import org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.algorithm.PreciseModuloShardingTableAlgorithm; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.config.DataSourceUtil; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.config.ExampleConfiguration; - -public final class ShardingDatabasesAndTablesConfigurationPrecise implements ExampleConfiguration { - - private static DataSource DATA_SOURCE; - - @Override - public DataSource createDataSource() throws SQLException { - ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration(); - shardingRuleConfig.getTableRuleConfigs().add(getOrderTableRuleConfiguration()); - shardingRuleConfig.getTableRuleConfigs().add(getOrderItemTableRuleConfiguration()); - shardingRuleConfig.getBindingTableGroups().add("t_order, t_order_item"); - shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new InlineShardingStrategyConfiguration("user_id", "demo_ds_${user_id % 2}")); - shardingRuleConfig.setDefaultTableShardingStrategyConfig(new StandardShardingStrategyConfiguration("order_id", new PreciseModuloShardingTableAlgorithm())); - Properties properties = new Properties(); - properties.setProperty("max.connections.size.per.query", "16"); - DATA_SOURCE = ShardingDataSourceFactory.createDataSource(createDataSourceMap(), shardingRuleConfig, properties); - return DATA_SOURCE; - } - - @Override - public DataSource getDataSource() { - return DATA_SOURCE; - } - - private static TableRuleConfiguration getOrderTableRuleConfiguration() { - TableRuleConfiguration result = new TableRuleConfiguration("t_order", "demo_ds_${0..1}.t_order_${[0, 1]}"); - result.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "order_id")); - return result; - } - - private static TableRuleConfiguration getOrderItemTableRuleConfiguration() { - TableRuleConfiguration result = new TableRuleConfiguration("t_order_item", "demo_ds_${0..1}.t_order_item_${[0, 1]}"); - return result; - } - - private static Map createDataSourceMap() { - Map result = new HashMap<>(); - result.put("demo_ds_0", DataSourceUtil.getDataSource("demo_ds_0")); - result.put("demo_ds_1", DataSourceUtil.getDataSource("demo_ds_1")); - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java deleted file mode 100644 index b99d44057..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.repository.jdbc; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.LinkedList; -import java.util.List; -import javax.sql.DataSource; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderItemRepository; - -public final class JDBCOrderItemRepositoryImpl implements OrderItemRepository { - - private final DataSource dataSource; - - private final Connection connection; - - public JDBCOrderItemRepositoryImpl(final DataSource dataSource) throws SQLException { - this.dataSource = dataSource; - this.connection = dataSource.getConnection(); - } - - @Override - public void createTableIfNotExists() { - 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, status VARCHAR(50), PRIMARY KEY (order_item_id))"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void dropTable() { - String sql = "DROP TABLE t_order_item"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void truncateTable() { - String sql = "TRUNCATE TABLE t_order_item"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public Long insert(final OrderItem orderItem) { - String sql = "INSERT INTO t_order_item (order_id, user_id, status) VALUES (?, ?, ?)"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { - preparedStatement.setLong(1, orderItem.getOrderId()); - preparedStatement.setInt(2, orderItem.getUserId()); - preparedStatement.setString(3, orderItem.getStatus()); - preparedStatement.executeUpdate(); - try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { - if (resultSet.next()) { - orderItem.setOrderItemId(resultSet.getLong(1)); - } - } - } catch (final SQLException ignored) { - } - return orderItem.getOrderItemId(); - } - - @Override - public void delete(final Long orderItemId) { - String sql = "DELETE FROM t_order_item WHERE order_item_id=?"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) { - preparedStatement.setLong(1, orderItemId); - preparedStatement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public List selectAll() { - String sql = "SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id"; - return getOrderItems(sql); - } - - @Override - public List selectRange() { - String sql = "SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id AND o.user_id BETWEEN 1 AND 5"; - return getOrderItems(sql); - } - - private List getOrderItems(final String sql) { - List result = new LinkedList<>(); - try (PreparedStatement preparedStatement = connection.prepareStatement(sql); ResultSet resultSet = preparedStatement - .executeQuery()) { - while (resultSet.next()) { - OrderItem orderItem = new OrderItem(); - orderItem.setOrderItemId(resultSet.getLong(1)); - orderItem.setOrderId(resultSet.getLong(2)); - orderItem.setUserId(resultSet.getInt(3)); - orderItem.setStatus(resultSet.getString(4)); - result.add(orderItem); - } - } catch (final SQLException ignored) { - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java deleted file mode 100644 index dc4c80dd9..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.repository.jdbc; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.LinkedList; -import java.util.List; -import javax.sql.DataSource; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderRepository; - -public final class JDBCOrderRepositoryImpl implements OrderRepository { - - private final DataSource dataSource; - - private final Connection connection; - - public JDBCOrderRepositoryImpl(final DataSource dataSource) throws SQLException { - this.dataSource = dataSource; - this.connection = dataSource.getConnection(); - } - - @Override - public void createTableIfNotExists() { - String sql = "CREATE TABLE IF NOT EXISTS t_order (order_id BIGINT NOT NULL AUTO_INCREMENT, user_id INT NOT NULL, status VARCHAR(50), PRIMARY KEY (order_id))"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void dropTable() { - String sql = "DROP TABLE t_order"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void truncateTable() { - String sql = "TRUNCATE TABLE t_order"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public Long insert(final Order order) { - String sql = "INSERT INTO t_order (user_id, status) VALUES (?, ?)"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { - preparedStatement.setInt(1, order.getUserId()); - preparedStatement.setString(2, order.getStatus()); - preparedStatement.executeUpdate(); - try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { - if (resultSet.next()) { - order.setOrderId(resultSet.getLong(1)); - } - } - } catch (final SQLException ignored) { - } - return order.getOrderId(); - } - - @Override - public void delete(final Long orderId) { - String sql = "DELETE FROM t_order WHERE order_id=?"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) { - preparedStatement.setLong(1, orderId); - preparedStatement.executeUpdate(); - } catch (final SQLException ignored) { - } - } - - @Override - public List selectAll() { - String sql = "SELECT * FROM t_order"; - return getOrders(sql); - } - - @Override - public List selectRange() { - String sql = "SELECT * FROM t_order WHERE order_id BETWEEN 200000000000000000 AND 400000000000000000"; - return getOrders(sql); - } - - private List getOrders(final String sql) { - List result = new LinkedList<>(); - try (PreparedStatement preparedStatement = connection.prepareStatement(sql); ResultSet resultSet = preparedStatement - .executeQuery()) { - while (resultSet.next()) { - Order order = new Order(); - order.setOrderId(resultSet.getLong(1)); - order.setUserId(resultSet.getInt(2)); - order.setStatus(resultSet.getString(3)); - result.add(order); - } - } catch (final SQLException ignored) { - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java deleted file mode 100644 index 796856a43..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.repository.service; - -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderItemRepository; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderRepository; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.service.CommonServiceImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderItemRepositoryImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderRepositoryImpl; - -public class RawPojoService extends CommonServiceImpl { - - private final OrderRepository orderRepository; - - private final OrderItemRepository orderItemRepository; - - public RawPojoService(final JDBCOrderRepositoryImpl orderRepository, - final JDBCOrderItemRepositoryImpl orderItemRepository) { - this.orderRepository = orderRepository; - this.orderItemRepository = orderItemRepository; - } - - @Override - protected OrderRepository getOrderRepository() { - return orderRepository; - } - - @Override - protected OrderItemRepository getOrderItemRepository() { - return orderItemRepository; - } - - @Override - protected Order newOrder() { - return new Order(); - } - - @Override - protected OrderItem newOrderItem() { - return new OrderItem(); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java deleted file mode 100644 index 36898c2e1..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import java.util.Collection; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue; - -public class PreciseModuloShardingDatabaseAlgorithm implements PreciseShardingAlgorithm { - - @Override - public String doSharding(final Collection databaseNames, - final PreciseShardingValue shardingValue) { - for (String each : databaseNames) { - if (each.endsWith(shardingValue.getValue() % 2 + "")) { - return each; - } - } - throw new UnsupportedOperationException(); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java deleted file mode 100644 index 9c40c257c..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import java.util.Collection; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue; - -public class PreciseModuloShardingTableAlgorithm implements PreciseShardingAlgorithm { - - @Override - public String doSharding(final Collection tableNames, final PreciseShardingValue shardingValue) { - for (String each : tableNames) { - if (each.endsWith(shardingValue.getValue() % 2 + "")) { - return each; - } - } - throw new UnsupportedOperationException(); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java deleted file mode 100644 index 2e8fde81b..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import com.google.common.collect.Range; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Set; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue; - -public class RangeModuloShardingDatabaseAlgorithm implements RangeShardingAlgorithm { - - @Override - public Collection doSharding(final Collection databaseNames, - final RangeShardingValue shardingValue) { - Set result = new LinkedHashSet<>(); - if (Range.closed(1, 5).encloses(shardingValue.getValueRange())) { - for (String each : databaseNames) { - if (each.endsWith("0")) { - result.add(each); - } - } - } else if (Range.closed(6, 10).encloses(shardingValue.getValueRange())) { - for (String each : databaseNames) { - if (each.endsWith("1")) { - result.add(each); - } - } - } else if (Range.closed(1, 10).encloses(shardingValue.getValueRange())) { - result.addAll(databaseNames); - } else { - throw new UnsupportedOperationException(); - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java deleted file mode 100644 index 0a6b56f85..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import com.google.common.collect.Range; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Set; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue; - -public class RangeModuloShardingTableAlgorithm implements RangeShardingAlgorithm { - - @Override - public Collection doSharding(final Collection tableNames, - final RangeShardingValue shardingValue) { - Set result = new LinkedHashSet<>(); - if (Range.closed(200000000000000000L, 400000000000000000L).encloses(shardingValue.getValueRange())) { - for (String each : tableNames) { - if (each.endsWith("0")) { - result.add(each); - } - } - } else { - throw new UnsupportedOperationException(); - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java deleted file mode 100644 index 5a2bfa57e..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.config; - -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.HashMap; -import java.util.Map; -import javax.sql.DataSource; -import org.h2.jdbcx.JdbcDataSource; - -public class DataSourceUtil { - - private static final String DEFAULT_SCHEMA = ""; - - private static final Map DATA_SOURCE_MAP = new HashMap<>(); - - public static void createDataSource(final String dataSourceName) { - JdbcDataSource result = new JdbcDataSource(); - result.setUrl("jdbc:h2:mem:" + dataSourceName + ";DB_CLOSE_DELAY=-1"); - result.setUser("sa"); - result.setPassword(""); - DATA_SOURCE_MAP.put(dataSourceName, result); - } - - public static DataSource getDataSource(final String dataSourceName) { - return DATA_SOURCE_MAP.get(dataSourceName); - } - - public static void createSchema(final String dataSourceName) { - String sql = "CREATE SCHEMA " + dataSourceName; - try (Connection connection = getDataSource(DEFAULT_SCHEMA).getConnection(); Statement statement = connection.createStatement()) { - statement.execute(sql); - } catch (final SQLException ignored) { - } - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java deleted file mode 100644 index 0935ea72f..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.config; - -import java.sql.SQLException; -import javax.sql.DataSource; - -public interface ExampleConfiguration { - - DataSource createDataSource() throws SQLException; - - DataSource getDataSource(); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/resources/application.properties b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/resources/application.properties deleted file mode 100644 index 2ea3d51e4..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/src/main/resources/application.properties +++ /dev/null @@ -1,17 +0,0 @@ -# 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. -server.port=8080 -server.contextPath=/shardingsphere-4.x-RC1-RC2-scenario \ No newline at end of file diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/support-version.list b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/support-version.list deleted file mode 100644 index 9794986d2..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/support-version.list +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -4.0.0-RC2 diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/bin/startup.sh b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/bin/startup.sh deleted file mode 100644 index 222b3e91e..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/bin/startup.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# 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. - -home="$(cd "$(dirname $0)"; pwd)" - -java -jar ${agent_opts} ${home}/../libs/shardingsphere-4.x-RC3-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml deleted file mode 100644 index 6596fcea9..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml +++ /dev/null @@ -1,174 +0,0 @@ -# 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. -segmentItems: -- serviceName: shardingsphere-4.x-RC3-scenario - segmentSize: not null - segments: - - segmentId: not null - spans: - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_1} - - {key: db.statement, value: SELECT * FROM t_order_1} - skipAnalysis: 'false' - - operationName: /ShardingSphere/executeSQL/ - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - refs: - - {parentEndpoint: /shardingsphere-4.x-RC3-scenario/case/execute, networkAddress: '', - refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not - null, parentService: not null, traceId: not null} - skipAnalysis: 'false' - - segmentId: not null - spans: - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_0} - - {key: db.statement, value: SELECT * FROM t_order_1} - skipAnalysis: 'false' - - operationName: /ShardingSphere/executeSQL/ - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - refs: - - {parentEndpoint: /shardingsphere-4.x-RC3-scenario/case/execute, networkAddress: '', - refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not - null, parentService: not null, traceId: not null} - skipAnalysis: 'false' - - segmentId: not null - spans: - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_1} - - {key: db.statement, value: SELECT * FROM t_order_0} - skipAnalysis: 'false' - - operationName: /ShardingSphere/executeSQL/ - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - refs: - - {parentEndpoint: /shardingsphere-4.x-RC3-scenario/case/execute, networkAddress: '', - refType: CrossThread, parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not - null, parentService: shardingsphere-4.x-RC3-scenario, traceId: not null} - skipAnalysis: 'false' - - segmentId: not null - spans: - - operationName: /ShardingSphere/parseSQL/ - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Unknown - startTime: not null - endTime: not null - componentId: 60 - isError: false - spanType: Local - peer: '' - tags: - - {key: db.statement, value: SELECT * FROM t_order} - skipAnalysis: 'false' - - operationName: H2/JDBI/PreparedStatement/executeQuery - operationId: 0 - parentSpanId: 3 - spanId: 4 - spanLayer: Database - startTime: not null - endTime: not null - componentId: 32 - isError: false - spanType: Exit - peer: localhost:-1 - tags: - - {key: db.type, value: sql} - - {key: db.instance, value: demo_ds_0} - - {key: db.statement, value: SELECT * FROM t_order_0} - skipAnalysis: 'false' - - {operationName: /ShardingSphere/executeSQL/, operationId: 0, parentSpanId: 2, - spanId: 3, spanLayer: Unknown, startTime: not null, endTime: not null, componentId: 60, - isError: false, spanType: Local, peer: '', skipAnalysis: 'false'} - - {operationName: /ShardingSphere/JDBCRootInvoke/, operationId: 0, parentSpanId: 0, - spanId: 2, spanLayer: Unknown, startTime: not null, endTime: not null, componentId: 60, - isError: false, spanType: Local, peer: '', skipAnalysis: 'false'} - - operationName: /shardingsphere-4.x-RC3-scenario/case/execute - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - startTime: not null - endTime: not null - componentId: 1 - isError: false - spanType: Entry - peer: '' - tags: - - {key: url, value: 'http://localhost:8080/shardingsphere-4.x-RC3-scenario/case/execute'} - - {key: http.method, value: GET} - skipAnalysis: 'false' diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/configuration.yml b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/configuration.yml deleted file mode 100644 index ef75b6b3c..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/configuration.yml +++ /dev/null @@ -1,20 +0,0 @@ -# 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. - -type: jvm -entryService: http://localhost:8080/shardingsphere-4.x-RC3-scenario/case/execute -healthCheck: http://localhost:8080/shardingsphere-4.x-RC3-scenario/case/healthCheck -startScript: ./bin/startup.sh diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/pom.xml b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/pom.xml deleted file mode 100644 index 1d29f34f5..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - 4.0.0 - - org.apache.skywalking - shardingsphere-4.x-RC3-scenario - 5.0.0 - - skywalking-shardingsphere-4.x-RC3-scenario - - - UTF-8 - - 4.0.0-RC3 - - 2.6.2 - 4.3.8.RELEASE - 1.5.2.RELEASE - - - - - org.apache.shardingsphere - sharding-core-execute - ${test.framework.version} - - - org.apache.shardingsphere - sharding-jdbc-core - ${test.framework.version} - - - org.springframework.boot - spring-boot-starter - ${spring-boot-version} - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} - - - org.apache.logging.log4j - log4j-jcl - ${log4j.version} - - - org.springframework.boot - spring-boot-starter-tomcat - ${spring-boot-version} - - - org.springframework.boot - spring-boot-starter-web - ${spring-boot-version} - - - com.h2database - h2 - 1.4.196 - - - - shardingsphere-4.x-RC3-scenario - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - ${project.build.sourceEncoding} - - - - org.springframework.boot - spring-boot-maven-plugin - 1.5.9.RELEASE - - - - repackage - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - assemble - package - - single - - - - src/main/assembly/assembly.xml - - ./target/ - - - - - - - - - - spring-snapshots - https://repo.spring.io/snapshot - - - spring-milestones - https://repo.spring.io/milestone - - - diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/assembly/assembly.xml deleted file mode 100644 index 44a42ee83..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/assembly/assembly.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - zip - - - - - ./bin - 0775 - - - - - - ${project.build.directory}/shardingsphere-4.x-RC3-scenario.jar - ./libs - 0775 - - - diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java deleted file mode 100644 index 96dbecc8f..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/Application.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.support.SpringBootServletInitializer; - -@SpringBootApplication -public class Application extends SpringBootServletInitializer { - - public static void main(String[] args) { - try { - - SpringApplication.run(Application.class, args); - } catch (Exception e) { - // Never do this - } - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java deleted file mode 100644 index 33ccf6f5b..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/controller/CaseController.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.controller; - -import java.sql.SQLException; -import javax.sql.DataSource; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.service.CommonService; -import org.apache.skywalking.apm.testcase.shardingsphere.service.config.ShardingDatabasesAndTablesConfigurationPrecise; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderItemRepositoryImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderRepositoryImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.service.RawPojoService; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.config.DataSourceUtil; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/case") -public class CaseController { - - private CommonService commonService = null; - - @RequestMapping("/healthCheck") - @ResponseBody - public String healthCheck() throws SQLException { - DataSourceUtil.createDataSource(""); - DataSourceUtil.createSchema("demo_ds_0"); - DataSourceUtil.createSchema("demo_ds_1"); - DataSourceUtil.createDataSource("demo_ds_0"); - DataSourceUtil.createDataSource("demo_ds_1"); - DataSource dataSource = new ShardingDatabasesAndTablesConfigurationPrecise().createDataSource(); - commonService = new RawPojoService(new JDBCOrderRepositoryImpl(dataSource), new JDBCOrderItemRepositoryImpl(dataSource)); - commonService.initEnvironment(); - return "Success"; - } - - @RequestMapping("/execute") - @ResponseBody - public String execute() { - commonService.processSuccess(false); - return "Success"; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java deleted file mode 100644 index 5d00a352f..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/Order.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.entity; - -import java.io.Serializable; - -public class Order implements Serializable { - - private static final long serialVersionUID = 661434701950670670L; - - private long orderId; - - private int userId; - - private String status; - - public long getOrderId() { - return orderId; - } - - public void setOrderId(final long orderId) { - this.orderId = orderId; - } - - public int getUserId() { - return userId; - } - - public void setUserId(final int userId) { - this.userId = userId; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } - - @Override - public String toString() { - return String.format("order_id: %s, user_id: %s, status: %s", orderId, userId, status); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java deleted file mode 100644 index 8ffa5b9fa..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/entity/OrderItem.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.entity; - -import java.io.Serializable; - -public class OrderItem implements Serializable { - - private static final long serialVersionUID = 263434701950670170L; - - private long orderItemId; - - private long orderId; - - private int userId; - - private String status; - - public long getOrderItemId() { - return orderItemId; - } - - public void setOrderItemId(final long orderItemId) { - this.orderItemId = orderItemId; - } - - public long getOrderId() { - return orderId; - } - - public void setOrderId(final long orderId) { - this.orderId = orderId; - } - - public int getUserId() { - return userId; - } - - public void setUserId(final int userId) { - this.userId = userId; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } - - @Override - public String toString() { - return String.format("order_item_id:%s, order_id: %s, user_id: %s, status: %s", orderItemId, orderId, userId, status); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java deleted file mode 100644 index 51da35ec9..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/CommonRepository.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.repository; - -import java.util.List; - -public interface CommonRepository { - - void createTableIfNotExists(); - - void dropTable(); - - void truncateTable(); - - Long insert(T entity); - - void delete(Long id); - - List selectAll(); - - List selectRange(); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java deleted file mode 100644 index ded004807..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderItemRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.repository; - -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; - -public interface OrderItemRepository extends CommonRepository { -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java deleted file mode 100644 index 95e55a72c..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/repository/OrderRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.repository; - -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; - -public interface OrderRepository extends CommonRepository { -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java deleted file mode 100644 index 066f122cd..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.service; - -public interface CommonService { - - void initEnvironment(); - - void cleanEnvironment(); - - void processSuccess(boolean isRangeSharding); - - void processFailure(); - - void printData(boolean isRangeSharding); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java deleted file mode 100644 index a1d358bbf..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/api/service/CommonServiceImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.api.service; - -import java.util.ArrayList; -import java.util.List; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderItemRepository; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderRepository; - -public abstract class CommonServiceImpl implements CommonService { - - @Override - public void initEnvironment() { - getOrderRepository().createTableIfNotExists(); - getOrderItemRepository().createTableIfNotExists(); - getOrderRepository().truncateTable(); - getOrderItemRepository().truncateTable(); - insertData(); - } - - @Override - public void cleanEnvironment() { - getOrderRepository().dropTable(); - getOrderItemRepository().dropTable(); - } - - @Override - public void processSuccess(final boolean isRangeSharding) { - printData(isRangeSharding); - } - - @Override - public void processFailure() { - insertData(); - throw new RuntimeException("Exception occur for transaction test."); - } - - private List insertData() { - List result = new ArrayList<>(10); - for (int i = 1; i <= 10; i++) { - Order order = newOrder(); - order.setUserId(i); - order.setStatus("INSERT_TEST"); - getOrderRepository().insert(order); - OrderItem item = newOrderItem(); - item.setOrderId(order.getOrderId()); - item.setUserId(i); - item.setStatus("INSERT_TEST"); - getOrderItemRepository().insert(item); - result.add(order.getOrderId()); - } - return result; - } - - private void deleteData(final List orderIds) { - for (Long each : orderIds) { - getOrderRepository().delete(each); - getOrderItemRepository().delete(each); - } - } - - @Override - public void printData(final boolean isRangeSharding) { - if (isRangeSharding) { - printDataRange(); - } else { - printDataAll(); - } - } - - private void printDataRange() { - for (Object each : getOrderRepository().selectRange()) { - } - for (Object each : getOrderItemRepository().selectRange()) { - } - } - - private void printDataAll() { - for (Object each : getOrderRepository().selectAll()) { - } - } - - protected abstract OrderRepository getOrderRepository(); - - protected abstract OrderItemRepository getOrderItemRepository(); - - protected abstract Order newOrder(); - - protected abstract OrderItem newOrderItem(); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java deleted file mode 100644 index 0c5de3b9f..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/config/ShardingDatabasesAndTablesConfigurationPrecise.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.config; - -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import javax.sql.DataSource; -import org.apache.shardingsphere.api.config.sharding.KeyGeneratorConfiguration; -import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration; -import org.apache.shardingsphere.api.config.sharding.TableRuleConfiguration; -import org.apache.shardingsphere.api.config.sharding.strategy.InlineShardingStrategyConfiguration; -import org.apache.shardingsphere.api.config.sharding.strategy.StandardShardingStrategyConfiguration; -import org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.algorithm.PreciseModuloShardingTableAlgorithm; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.config.DataSourceUtil; -import org.apache.skywalking.apm.testcase.shardingsphere.service.utility.config.ExampleConfiguration; - -public final class ShardingDatabasesAndTablesConfigurationPrecise implements ExampleConfiguration { - - private static DataSource DATA_SOURCE; - - @Override - public DataSource createDataSource() throws SQLException { - ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration(); - shardingRuleConfig.getTableRuleConfigs().add(getOrderTableRuleConfiguration()); - shardingRuleConfig.getTableRuleConfigs().add(getOrderItemTableRuleConfiguration()); - shardingRuleConfig.getBindingTableGroups().add("t_order, t_order_item"); - shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new InlineShardingStrategyConfiguration("user_id", "demo_ds_${user_id % 2}")); - shardingRuleConfig.setDefaultTableShardingStrategyConfig(new StandardShardingStrategyConfiguration("order_id", new PreciseModuloShardingTableAlgorithm())); - Properties properties = new Properties(); - properties.setProperty("max.connections.size.per.query", "16"); - DATA_SOURCE = ShardingDataSourceFactory.createDataSource(createDataSourceMap(), shardingRuleConfig, properties); - return DATA_SOURCE; - } - - @Override - public DataSource getDataSource() { - return DATA_SOURCE; - } - - private static TableRuleConfiguration getOrderTableRuleConfiguration() { - TableRuleConfiguration result = new TableRuleConfiguration("t_order", "demo_ds_${0..1}.t_order_${[0, 1]}"); - result.setKeyGeneratorConfig(new KeyGeneratorConfiguration("SNOWFLAKE", "order_id")); - return result; - } - - private static TableRuleConfiguration getOrderItemTableRuleConfiguration() { - TableRuleConfiguration result = new TableRuleConfiguration("t_order_item", "demo_ds_${0..1}.t_order_item_${[0, 1]}"); - return result; - } - - private static Map createDataSourceMap() { - Map result = new HashMap<>(); - result.put("demo_ds_0", DataSourceUtil.getDataSource("demo_ds_0")); - result.put("demo_ds_1", DataSourceUtil.getDataSource("demo_ds_1")); - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java deleted file mode 100644 index b99d44057..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderItemRepositoryImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.repository.jdbc; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.LinkedList; -import java.util.List; -import javax.sql.DataSource; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderItemRepository; - -public final class JDBCOrderItemRepositoryImpl implements OrderItemRepository { - - private final DataSource dataSource; - - private final Connection connection; - - public JDBCOrderItemRepositoryImpl(final DataSource dataSource) throws SQLException { - this.dataSource = dataSource; - this.connection = dataSource.getConnection(); - } - - @Override - public void createTableIfNotExists() { - 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, status VARCHAR(50), PRIMARY KEY (order_item_id))"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void dropTable() { - String sql = "DROP TABLE t_order_item"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void truncateTable() { - String sql = "TRUNCATE TABLE t_order_item"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public Long insert(final OrderItem orderItem) { - String sql = "INSERT INTO t_order_item (order_id, user_id, status) VALUES (?, ?, ?)"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { - preparedStatement.setLong(1, orderItem.getOrderId()); - preparedStatement.setInt(2, orderItem.getUserId()); - preparedStatement.setString(3, orderItem.getStatus()); - preparedStatement.executeUpdate(); - try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { - if (resultSet.next()) { - orderItem.setOrderItemId(resultSet.getLong(1)); - } - } - } catch (final SQLException ignored) { - } - return orderItem.getOrderItemId(); - } - - @Override - public void delete(final Long orderItemId) { - String sql = "DELETE FROM t_order_item WHERE order_item_id=?"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) { - preparedStatement.setLong(1, orderItemId); - preparedStatement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public List selectAll() { - String sql = "SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id"; - return getOrderItems(sql); - } - - @Override - public List selectRange() { - String sql = "SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id AND o.user_id BETWEEN 1 AND 5"; - return getOrderItems(sql); - } - - private List getOrderItems(final String sql) { - List result = new LinkedList<>(); - try (PreparedStatement preparedStatement = connection.prepareStatement(sql); ResultSet resultSet = preparedStatement - .executeQuery()) { - while (resultSet.next()) { - OrderItem orderItem = new OrderItem(); - orderItem.setOrderItemId(resultSet.getLong(1)); - orderItem.setOrderId(resultSet.getLong(2)); - orderItem.setUserId(resultSet.getInt(3)); - orderItem.setStatus(resultSet.getString(4)); - result.add(orderItem); - } - } catch (final SQLException ignored) { - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java deleted file mode 100644 index dc4c80dd9..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/jdbc/JDBCOrderRepositoryImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.repository.jdbc; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.LinkedList; -import java.util.List; -import javax.sql.DataSource; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderRepository; - -public final class JDBCOrderRepositoryImpl implements OrderRepository { - - private final DataSource dataSource; - - private final Connection connection; - - public JDBCOrderRepositoryImpl(final DataSource dataSource) throws SQLException { - this.dataSource = dataSource; - this.connection = dataSource.getConnection(); - } - - @Override - public void createTableIfNotExists() { - String sql = "CREATE TABLE IF NOT EXISTS t_order (order_id BIGINT NOT NULL AUTO_INCREMENT, user_id INT NOT NULL, status VARCHAR(50), PRIMARY KEY (order_id))"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void dropTable() { - String sql = "DROP TABLE t_order"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public void truncateTable() { - String sql = "TRUNCATE TABLE t_order"; - try (Statement statement = connection.createStatement()) { - statement.executeUpdate(sql); - } catch (final SQLException ignored) { - } - } - - @Override - public Long insert(final Order order) { - String sql = "INSERT INTO t_order (user_id, status) VALUES (?, ?)"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { - preparedStatement.setInt(1, order.getUserId()); - preparedStatement.setString(2, order.getStatus()); - preparedStatement.executeUpdate(); - try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { - if (resultSet.next()) { - order.setOrderId(resultSet.getLong(1)); - } - } - } catch (final SQLException ignored) { - } - return order.getOrderId(); - } - - @Override - public void delete(final Long orderId) { - String sql = "DELETE FROM t_order WHERE order_id=?"; - try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) { - preparedStatement.setLong(1, orderId); - preparedStatement.executeUpdate(); - } catch (final SQLException ignored) { - } - } - - @Override - public List selectAll() { - String sql = "SELECT * FROM t_order"; - return getOrders(sql); - } - - @Override - public List selectRange() { - String sql = "SELECT * FROM t_order WHERE order_id BETWEEN 200000000000000000 AND 400000000000000000"; - return getOrders(sql); - } - - private List getOrders(final String sql) { - List result = new LinkedList<>(); - try (PreparedStatement preparedStatement = connection.prepareStatement(sql); ResultSet resultSet = preparedStatement - .executeQuery()) { - while (resultSet.next()) { - Order order = new Order(); - order.setOrderId(resultSet.getLong(1)); - order.setUserId(resultSet.getInt(2)); - order.setStatus(resultSet.getString(3)); - result.add(order); - } - } catch (final SQLException ignored) { - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java deleted file mode 100644 index 796856a43..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/repository/service/RawPojoService.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.repository.service; - -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.Order; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.entity.OrderItem; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderItemRepository; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.repository.OrderRepository; -import org.apache.skywalking.apm.testcase.shardingsphere.service.api.service.CommonServiceImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderItemRepositoryImpl; -import org.apache.skywalking.apm.testcase.shardingsphere.service.repository.jdbc.JDBCOrderRepositoryImpl; - -public class RawPojoService extends CommonServiceImpl { - - private final OrderRepository orderRepository; - - private final OrderItemRepository orderItemRepository; - - public RawPojoService(final JDBCOrderRepositoryImpl orderRepository, - final JDBCOrderItemRepositoryImpl orderItemRepository) { - this.orderRepository = orderRepository; - this.orderItemRepository = orderItemRepository; - } - - @Override - protected OrderRepository getOrderRepository() { - return orderRepository; - } - - @Override - protected OrderItemRepository getOrderItemRepository() { - return orderItemRepository; - } - - @Override - protected Order newOrder() { - return new Order(); - } - - @Override - protected OrderItem newOrderItem() { - return new OrderItem(); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java deleted file mode 100644 index 36898c2e1..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingDatabaseAlgorithm.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import java.util.Collection; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue; - -public class PreciseModuloShardingDatabaseAlgorithm implements PreciseShardingAlgorithm { - - @Override - public String doSharding(final Collection databaseNames, - final PreciseShardingValue shardingValue) { - for (String each : databaseNames) { - if (each.endsWith(shardingValue.getValue() % 2 + "")) { - return each; - } - } - throw new UnsupportedOperationException(); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java deleted file mode 100644 index 9c40c257c..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/PreciseModuloShardingTableAlgorithm.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import java.util.Collection; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue; - -public class PreciseModuloShardingTableAlgorithm implements PreciseShardingAlgorithm { - - @Override - public String doSharding(final Collection tableNames, final PreciseShardingValue shardingValue) { - for (String each : tableNames) { - if (each.endsWith(shardingValue.getValue() % 2 + "")) { - return each; - } - } - throw new UnsupportedOperationException(); - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java deleted file mode 100644 index 2e8fde81b..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingDatabaseAlgorithm.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import com.google.common.collect.Range; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Set; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue; - -public class RangeModuloShardingDatabaseAlgorithm implements RangeShardingAlgorithm { - - @Override - public Collection doSharding(final Collection databaseNames, - final RangeShardingValue shardingValue) { - Set result = new LinkedHashSet<>(); - if (Range.closed(1, 5).encloses(shardingValue.getValueRange())) { - for (String each : databaseNames) { - if (each.endsWith("0")) { - result.add(each); - } - } - } else if (Range.closed(6, 10).encloses(shardingValue.getValueRange())) { - for (String each : databaseNames) { - if (each.endsWith("1")) { - result.add(each); - } - } - } else if (Range.closed(1, 10).encloses(shardingValue.getValueRange())) { - result.addAll(databaseNames); - } else { - throw new UnsupportedOperationException(); - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java deleted file mode 100644 index 0a6b56f85..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/algorithm/RangeModuloShardingTableAlgorithm.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.algorithm; - -import com.google.common.collect.Range; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Set; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm; -import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue; - -public class RangeModuloShardingTableAlgorithm implements RangeShardingAlgorithm { - - @Override - public Collection doSharding(final Collection tableNames, - final RangeShardingValue shardingValue) { - Set result = new LinkedHashSet<>(); - if (Range.closed(200000000000000000L, 400000000000000000L).encloses(shardingValue.getValueRange())) { - for (String each : tableNames) { - if (each.endsWith("0")) { - result.add(each); - } - } - } else { - throw new UnsupportedOperationException(); - } - return result; - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java deleted file mode 100644 index 5a2bfa57e..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/DataSourceUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.config; - -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.HashMap; -import java.util.Map; -import javax.sql.DataSource; -import org.h2.jdbcx.JdbcDataSource; - -public class DataSourceUtil { - - private static final String DEFAULT_SCHEMA = ""; - - private static final Map DATA_SOURCE_MAP = new HashMap<>(); - - public static void createDataSource(final String dataSourceName) { - JdbcDataSource result = new JdbcDataSource(); - result.setUrl("jdbc:h2:mem:" + dataSourceName + ";DB_CLOSE_DELAY=-1"); - result.setUser("sa"); - result.setPassword(""); - DATA_SOURCE_MAP.put(dataSourceName, result); - } - - public static DataSource getDataSource(final String dataSourceName) { - return DATA_SOURCE_MAP.get(dataSourceName); - } - - public static void createSchema(final String dataSourceName) { - String sql = "CREATE SCHEMA " + dataSourceName; - try (Connection connection = getDataSource(DEFAULT_SCHEMA).getConnection(); Statement statement = connection.createStatement()) { - statement.execute(sql); - } catch (final SQLException ignored) { - } - } -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java deleted file mode 100644 index 0935ea72f..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/java/org/apache/skywalking/apm/testcase/shardingsphere/service/utility/config/ExampleConfiguration.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.skywalking.apm.testcase.shardingsphere.service.utility.config; - -import java.sql.SQLException; -import javax.sql.DataSource; - -public interface ExampleConfiguration { - - DataSource createDataSource() throws SQLException; - - DataSource getDataSource(); -} diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/resources/application.properties b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/resources/application.properties deleted file mode 100644 index ff2c4c41d..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/src/main/resources/application.properties +++ /dev/null @@ -1,17 +0,0 @@ -# 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. -server.port=8080 -server.contextPath=/shardingsphere-4.x-RC3-scenario \ No newline at end of file diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/support-version.list b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/support-version.list deleted file mode 100644 index 5e37c14f7..000000000 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/support-version.list +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -4.0.0-RC3