From 38b9589ddfb37cd345684d98b76c45f797453dde Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 29 Mar 2026 15:49:40 +0800 Subject: [PATCH 1/2] [type:refactor] remove motan support --- .asf.yaml | 1 - .../workflows/integrated-test-k8s-ingress.yml | 1 - .github/workflows/integrated-test.yml | 1 - README.md | 2 +- db/init/mysql/schema.sql | 22 +- db/init/ob/schema.sql | 22 +- db/init/og/create-table.sql | 22 +- db/init/oracle/schema.sql | 4 +- db/init/pg/create-table.sql | 22 +- db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql | 29 ++ db/upgrade/2.7.0-upgrade-2.7.1-ob.sql | 31 +- db/upgrade/2.7.0-upgrade-2.7.1-og.sql | 33 ++ db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql | 33 ++ db/upgrade/2.7.0-upgrade-2.7.1-pg.sql | 33 ++ pom.xml | 25 - .../apache/shenyu/admin/model/dto/ApiDTO.java | 2 +- .../shenyu/admin/model/entity/ApiDO.java | 2 +- .../apache/shenyu/admin/model/vo/ApiVO.java | 2 +- .../ShenyuClientRegisterMotanServiceImpl.java | 62 --- .../main/resources/sql-script/h2/schema.sql | 12 +- ...nyuClientRegisterMotanServiceImplTest.java | 89 ---- shenyu-bootstrap/pom.xml | 41 -- shenyu-client/pom.xml | 1 - shenyu-client/shenyu-client-motan/pom.xml | 57 --- .../motan/MotanServiceEventListener.java | 233 --------- .../common/annotation/ShenyuMotanClient.java | 71 --- .../common/annotation/ShenyuMotanService.java | 293 ----------- .../client/motan/common/dto/MotanRpcExt.java | 210 -------- .../motan/MotanServiceEventListenerTest.java | 278 ---------- .../shenyu/common/constant/Constants.java | 10 - .../convert/plugin/MotanRegisterConfig.java | 193 ------- .../dto/convert/selector/MotanUpstream.java | 274 ---------- .../shenyu/common/enums/PluginEnum.java | 5 - .../shenyu/common/enums/RpcTypeEnum.java | 7 +- .../common/utils/PluginNameAdapter.java | 2 - .../plugin/MotanRegisterConfigTest.java | 56 -- .../shenyu/common/enums/RpcTypeEnumTest.java | 2 - .../src/main/release-docs/README.txt | 2 +- .../src/main/release-docs/LICENSE | 4 - .../src/main/release-docs/README.txt | 2 +- shenyu-e2e/shenyu-e2e-case/pom.xml | 1 - .../shenyu-e2e-case-motan/pom.xml | 30 -- .../e2e/testcase/motan/MotanPluginCases.java | 353 ------------- .../e2e/testcase/motan/MotanPluginTest.java | 140 ----- .../org/apache/shenyu/e2e/model/Plugin.java | 1 - shenyu-examples/pom.xml | 1 - shenyu-examples/shenyu-examples-motan/pom.xml | 36 -- .../shenyu-examples-motan-api/pom.xml | 107 ---- .../motan/service/MotanClassDemoService.java | 58 --- .../motan/service/MotanDemoService.java | 47 -- .../examples/motan/service/MotanTest.java | 84 --- .../shenyu-examples-motan-service/Dockerfile | 30 -- .../k8s/ingress.yml | 89 ---- .../k8s/shenyu-examples-motan.yml | 88 ---- .../k8s/shenyu-zookeeper.yml | 81 --- .../shenyu-examples-motan-service/pom.xml | 130 ----- .../src/main/http/motan-class-test-api.http | 49 -- .../src/main/http/motan-test-api.http | 35 -- .../motan/service/TestMotanApplication.java | 37 -- .../impl/MotanClassDemoServiceImpl.java | 69 --- .../service/impl/MotanDemoServiceImpl.java | 65 --- .../src/main/resources/application.yml | 54 -- shenyu-integrated-test/pom.xml | 2 - .../docker-compose.yml | 26 - .../pom.xml | 28 - .../SharedThreadPoolController.java | 13 - .../combination/SharedThreadPoolTest.java | 17 - .../integratedtest/common/dto/MotanDTO.java | 48 -- .../Dockerfile | 29 -- .../deploy/deploy-shenyu.yaml | 107 ---- .../deploy/kind-config.yaml | 36 -- .../pom.xml | 167 ------ .../script/build_k8s_cluster.sh | 24 - .../script/healthcheck.sh | 36 -- .../script/services.list | 17 - ...nIngressControllerIntegratedBootstrap.java | 38 -- .../src/main/resources/application.yml | 326 ------------ .../k8s/ingress/motan/MotanPluginTest.java | 49 -- .../shenyu-integrated-test-motan/Dockerfile | 29 -- .../docker-compose.yml | 97 ---- .../shenyu-integrated-test-motan/pom.xml | 134 ----- .../script/healthcheck.sh | 36 -- .../script/services.list | 20 - .../test/motan/MotanIntegratedBootstrap.java | 38 -- .../src/main/resources/application-local.yml | 59 --- .../src/main/resources/application.yml | 18 - .../motan/MotanPluginShareThreadPoolTest.java | 52 -- .../test/motan/MotanPluginTest.java | 52 -- .../shenyu/k8s/common/IngressConstants.java | 27 - .../shenyu/k8s/parser/IngressParser.java | 6 +- .../shenyu/k8s/parser/MotanIngressParser.java | 304 ----------- .../k8s/reconciler/IngressReconciler.java | 13 - .../shenyu/k8s/MotanReconcilerTest.java | 153 ------ .../plugin/api/result/ShenyuResultEnum.java | 5 - .../api/result/ShenyuResultEnumTest.java} | 18 +- .../shenyu-plugin-rpc/pom.xml | 1 - .../general/context/GeneralContextPlugin.java | 2 +- .../shenyu-plugin-motan/pom.xml | 55 -- .../shenyu/plugin/motan/MotanPlugin.java | 129 ----- .../motan/cache/ApplicationConfigCache.java | 480 ------------------ .../context/MotanShenyuContextDecorator.java | 43 -- .../motan/handler/MotanMetaDataHandler.java | 74 --- .../motan/handler/MotanPluginDataHandler.java | 79 --- .../plugin/motan/proxy/MotanProxyService.java | 197 ------- .../shenyu/plugin/motan/util/PrxInfoUtil.java | 120 ----- .../shenyu/plugin/motan/MotanPluginTest.java | 109 ---- .../cache/ApplicationConfigCacheTest.java | 92 ---- .../MotanShenyuContextDecoratorTest.java | 57 --- .../handler/MotanPluginDataHandlerTest.java | 54 -- .../motan/proxy/MotanProxyServiceTest.java | 98 ---- .../transform/RpcParamTransformPlugin.java | 1 - .../response/strategy/RPCMessageWriter.java | 4 +- .../plugin/response/ResponsePluginTest.java | 4 - .../common/dto/ApiDocRegisterDTO.java | 2 +- .../common/enums/RegisterTypeEnum.java | 5 - .../shenyu-spring-boot-starter-client/pom.xml | 1 - .../pom.xml | 47 -- .../motan/ShenyuMotanClientConfiguration.java | 178 ------- .../client/motan/property/RegistryConfig.java | 65 --- .../motan/property/ShenyuMotanConfig.java | 288 ----------- .../main/resources/META-INF/spring.factories | 19 - .../main/resources/META-INF/spring.provides | 18 - ...ot.autoconfigure.AutoConfiguration.imports | 18 - .../ShenyuMotanClientConfigurationTest.java | 69 --- .../shenyu-spring-boot-starter-plugin/pom.xml | 1 - .../pom.xml | 57 --- .../motan/MotanPluginConfiguration.java | 92 ---- .../main/resources/META-INF/spring.factories | 19 - .../main/resources/META-INF/spring.provides | 18 - ...ot.autoconfigure.AutoConfiguration.imports | 18 - .../motan/MotanPluginConfigurationTest.java | 85 ---- 131 files changed, 186 insertions(+), 8213 deletions(-) delete mode 100644 shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImpl.java delete mode 100644 shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImplTest.java delete mode 100644 shenyu-client/shenyu-client-motan/pom.xml delete mode 100644 shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceEventListener.java delete mode 100644 shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanClient.java delete mode 100644 shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanService.java delete mode 100644 shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/dto/MotanRpcExt.java delete mode 100644 shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java delete mode 100644 shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java delete mode 100644 shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/MotanUpstream.java delete mode 100644 shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.java delete mode 100644 shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml delete mode 100644 shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java delete mode 100644 shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java delete mode 100644 shenyu-examples/shenyu-examples-motan/pom.xml delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/pom.xml delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanClassDemoService.java delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanTest.java delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/Dockerfile delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/ingress.yml delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-examples-motan.yml delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-zookeeper.yml delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/pom.xml delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-class-test-api.http delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-test-api.http delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/TestMotanApplication.java delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java delete mode 100644 shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/dto/MotanDTO.java delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/Dockerfile delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/deploy-shenyu.yaml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/kind-config.yaml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/pom.xml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/build_k8s_cluster.sh delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/healthcheck.sh delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/services.list delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanIngressControllerIntegratedBootstrap.java delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/resources/application.yml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanPluginTest.java delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/Dockerfile delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/docker-compose.yml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/script/healthcheck.sh delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/script/services.list delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/src/main/java/org/apache/shenyu/integrated/test/motan/MotanIntegratedBootstrap.java delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application-local.yml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application.yml delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java delete mode 100644 shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/MotanIngressParser.java delete mode 100644 shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/MotanReconcilerTest.java rename shenyu-plugin/{shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtilTest.java => shenyu-plugin-api/src/test/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnumTest.java} (70%) delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/pom.xml delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/MotanPlugin.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecorator.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanMetaDataHandler.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandler.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtil.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/MotanPluginTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCacheTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecoratorTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyServiceTest.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/pom.xml delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfiguration.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/RegistryConfig.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/ShenyuMotanConfig.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.factories delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.provides delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/test/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfigurationTest.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/pom.xml delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.factories delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.provides delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java diff --git a/.asf.yaml b/.asf.yaml index ff339b1a669b..e91e3f2ab5ab 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -25,7 +25,6 @@ github: - grpc-proxy - dubbo-proxy - sofa-proxy - - motan-proxy - reactor-java enabled_merge_buttons: squash: true diff --git a/.github/workflows/integrated-test-k8s-ingress.yml b/.github/workflows/integrated-test-k8s-ingress.yml index c6aa33c88b55..cb8fdb08a8bf 100644 --- a/.github/workflows/integrated-test-k8s-ingress.yml +++ b/.github/workflows/integrated-test-k8s-ingress.yml @@ -28,7 +28,6 @@ jobs: case: - shenyu-integrated-test-k8s-ingress-http - shenyu-integrated-test-k8s-ingress-apache-dubbo - - shenyu-integrated-test-k8s-ingress-motan - shenyu-integrated-test-k8s-ingress-websocket - shenyu-integrated-test-k8s-ingress-grpc # - shenyu-integrated-test-k8s-ingress-sofa diff --git a/.github/workflows/integrated-test.yml b/.github/workflows/integrated-test.yml index 9afc310f1c2f..86073803a377 100644 --- a/.github/workflows/integrated-test.yml +++ b/.github/workflows/integrated-test.yml @@ -30,7 +30,6 @@ jobs: - shenyu-integrated-test-grpc - shenyu-integrated-test-http - shenyu-integrated-test-https - - shenyu-integrated-test-motan - shenyu-integrated-test-spring-cloud - shenyu-integrated-test-sofa - shenyu-integrated-test-websocket diff --git a/README.md b/README.md index 8cdbd00e80bd..bd529650a66f 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ He is known as one of the three greatest kings of ancient China, along with Yao # Features -* Proxy: Support for Apache® Dubbo™, Spring Cloud, gRPC, Motan, SOFA, TARS, WebSocket, MQTT +* Proxy: Support for Apache® Dubbo™, Spring Cloud, gRPC, SOFA, TARS, WebSocket, MQTT * Security: Sign, OAuth 2.0, JSON Web Tokens, WAF plugin * API governance: Request, response, parameter mapping, Hystrix, RateLimiter plugin * Observability: Tracing, metrics, logging plugin diff --git a/db/init/mysql/schema.sql b/db/init/mysql/schema.sql index c838022633b8..8891da9e819f 100644 --- a/db/init/mysql/schema.sql +++ b/db/init/mysql/schema.sql @@ -51,7 +51,7 @@ CREATE TABLE `api` ( `consume` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'consume content-type', `produce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'produce content-type', `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'api version,for example V0.01', - `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,motan,grpc', + `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,grpc', `state` tinyint(4) NOT NULL COMMENT '0-unpublished,1-published,2-offline', `ext` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'extended fields', `api_owner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'api_owner', @@ -980,7 +980,6 @@ INSERT INTO `plugin` VALUES ('13', 'tars', '{\"multiSelectorHandle\":\"1\",\"mul INSERT INTO `plugin` VALUES ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('15', 'grpc', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); -INSERT INTO `plugin` VALUES ('17', 'motan', '{\"registerProtocol\":\"direct\",\"registerAddress\":\"127.0.0.1:2181\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('18', 'loggingConsole', NULL, 'Logging', 160, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('19', 'jwt', '{\"secretKey\":\"key\"}', 'Authentication', 30, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('2', 'waf', '{\"model\":\"black\"}', 'Authentication', 50, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); @@ -1166,14 +1165,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613204172830', '26', 'loadBalance', INSERT INTO `plugin_handle` VALUES ('1529402613204172831', '26', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172832', '26', 'timeout', 'timeout', 1, 2, 2, '{\"defaultValue\":\"3000\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172833', '26', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 3, 0, '{\"required\":\"0\",\"defaultValue\":\"zk\",\"placeholder\":\"registerProtocol\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172835', '17', 'corethreads', 'corethreads', 1, 3, 2, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172836', '17', 'threads', 'threads', 1, 3, 3, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172837', '17', 'queues', 'queues', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172838', '17', 'threadpool', 'threadpool', 3, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"cached\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1678997557628272641', '17', 'registerAddress', 'registerAddress', 2, 3, 1, '{\"required\":\"0\",\"defaultValue\":\"127.0.0.1:2181\",\"placeholder\":\"registerAddress\",\"rule\":\"\"}', '2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'); -INSERT INTO `plugin_handle` VALUES ('1829402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 1, 0, '{\"required\":\"0\",\"defaultValue\":\"\",\"placeholder\":\"registerProtocol\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1878997557628272641', '17', 'registerAddress', 'registerAddress', 2, 1, 1, '{\"required\":\"0\",\"defaultValue\":\"\",\"placeholder\":\"registerAddress\",\"rule\":\"\"}', '2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'); INSERT INTO `plugin_handle` VALUES ('1529402613204172839', '28', 'port', 'port', 1, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172840', '28', 'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172841', '28', 'maxPayloadSize', 'maxPayloadSize', 1, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); @@ -1584,7 +1575,6 @@ INSERT INTO `resource` VALUES ('1529402639284355075', '1346775491550474240', 'ta INSERT INTO `resource` VALUES ('1529402639284355076', '1346775491550474240', 'contextPath', 'contextPath', '/plug/contextPath', 'contextPath', 1, 0, 'retweet', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639284355079', '1346775491550474240', 'motan', 'motan', '/plug/motan', 'motan', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355080', '1346775491550474240', 'loggingConsole', 'loggingConsole', '/plug/loggingConsole', 'loggingConsole', 1, 0, 'fire', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355081', '1346775491550474240', 'jwt', 'jwt', '/plug/jwt', 'jwt', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355082', '1346775491550474240', 'waf', 'waf', '/plug/waf', 'waf', 1, 0, 'block', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -1676,15 +1666,6 @@ INSERT INTO `resource` VALUES ('1529402639372435470', '1529402639284355078', 'SH INSERT INTO `resource` VALUES ('1529402639372435471', '1529402639284355078', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435472', '1529402639284355078', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435473', '1529402639284355078', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirect:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435474', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435475', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435476', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435477', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435478', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435479', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435480', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435481', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435482', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:motan:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435483', '1529402639284355080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435484', '1529402639284355080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435485', '1529402639284355080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -2620,7 +2601,6 @@ INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, ` INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822153','649330b6-c2d7-4edc-be8e-8a54df9eb385','17', '{\"registerProtocol\":\"direct\",\"registerAddress\":\"127.0.0.1:2181\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822154','649330b6-c2d7-4edc-be8e-8a54df9eb385','18', NULL, 160, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822155','649330b6-c2d7-4edc-be8e-8a54df9eb385','19', '{\"secretKey\":\"key\"}', 30, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822156','649330b6-c2d7-4edc-be8e-8a54df9eb385','2', '{\"model\":\"black\"}', 50, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/ob/schema.sql b/db/init/ob/schema.sql index 906323b20b10..d2fdbc7cb125 100644 --- a/db/init/ob/schema.sql +++ b/db/init/ob/schema.sql @@ -51,7 +51,7 @@ CREATE TABLE `api` ( `consume` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'consume content-type', `produce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'produce content-type', `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'api version,for example V0.01', - `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,motan,grpc', + `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,grpc', `state` tinyint(4) NOT NULL COMMENT '0-unpublished,1-published,2-offline', `ext` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'extended fields', `api_owner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'api_owner', @@ -951,7 +951,6 @@ INSERT INTO `plugin` VALUES ('13', 'tars', '{\"multiSelectorHandle\":\"1\",\"mul INSERT INTO `plugin` VALUES ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('15', 'grpc', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); -INSERT INTO `plugin` VALUES ('17', 'motan', '{\"registerProtocol\":\"direct\",\"registerAddress\":\"127.0.0.1:2181\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('18', 'loggingConsole', NULL, 'Logging', 160, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('19', 'jwt', '{\"secretKey\":\"key\"}', 'Authentication', 30, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('2', 'waf', '{\"model\":\"black\"}', 'Authentication', 50, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); @@ -1133,13 +1132,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613204172830', '26', 'loadBalance', INSERT INTO `plugin_handle` VALUES ('1529402613204172831', '26', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172832', '26', 'timeout', 'timeout', 1, 2, 2, '{\"defaultValue\":\"3000\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172833', '26', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 3, 0, '{\"required\":\"0\",\"defaultValue\":\"zk\",\"placeholder\":\"registerProtocol\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172835', '17', 'corethreads', 'corethreads', 1, 3, 2, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172836', '17', 'threads', 'threads', 1, 3, 3, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172837', '17', 'queues', 'queues', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172838', '17', 'threadpool', 'threadpool', 3, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"cached\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1829402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 1, 0, '{\"required\":\"0\",\"defaultValue\":\"\",\"placeholder\":\"registerProtocol\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1878997557628272641', '17', 'registerAddress', 'registerAddress', 2, 1, 1, '{\"required\":\"0\",\"defaultValue\":\"\",\"placeholder\":\"registerAddress\",\"rule\":\"\"}', '2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'); INSERT INTO `plugin_handle` VALUES ('1529402613204172839', '28', 'port', 'port', 1, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172840', '28', 'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172841', '28', 'maxPayloadSize', 'maxPayloadSize', 1, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); @@ -1328,7 +1320,6 @@ INSERT INTO `plugin_handle` VALUES ('1678997769998467072', '42', 'clientMaxLifeT INSERT INTO `plugin_handle` VALUES ('1678997277012557824', '42', 'clientMaxConnections', 'clientMaxConnections', 2, 1, 6, '{\"required\":\"0\",\"defaultValue\":\"20\",\"rule\":\"\"}', '2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'); INSERT INTO `plugin_handle` VALUES ('1678997557628272640', '42', 'clientPendingAcquireTimeout', 'clientPendingAcquireTimeout', 2, 1, 5, '{\"required\":\"0\",\"defaultValue\":\"5\",\"rule\":\"\"}', '2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'); -INSERT INTO `plugin_handle` VALUES ('1678997557628272641', '17', 'registerAddress', 'registerAddress', 2, 3, 1, '{\"required\":\"0\",\"defaultValue\":\"127.0.0.1:2181\",\"placeholder\":\"registerAddress\",\"rule\":\"\"}', '2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'); INSERT INTO `plugin_handle` VALUES ('1678997557628272642', '15', 'loadBalance', 'loadBalance', 3, 2, 3, '{\"required\":\"0\",\"defaultValue\":\"random\",\"rule\":\"\"}', '2023-09-05 18:02:53', '2023-09-05 18:02:53'); @@ -1533,7 +1524,6 @@ INSERT INTO `resource` VALUES ('1529402639284355075', '1346775491550474240', 'ta INSERT INTO `resource` VALUES ('1529402639284355076', '1346775491550474240', 'contextPath', 'contextPath', '/plug/contextPath', 'contextPath', 1, 0, 'retweet', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639284355079', '1346775491550474240', 'motan', 'motan', '/plug/motan', 'motan', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355080', '1346775491550474240', 'loggingConsole', 'loggingConsole', '/plug/loggingConsole', 'loggingConsole', 1, 0, 'fire', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355081', '1346775491550474240', 'jwt', 'jwt', '/plug/jwt', 'jwt', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355082', '1346775491550474240', 'waf', 'waf', '/plug/waf', 'waf', 1, 0, 'block', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -1625,15 +1615,6 @@ INSERT INTO `resource` VALUES ('1529402639372435470', '1529402639284355078', 'SH INSERT INTO `resource` VALUES ('1529402639372435471', '1529402639284355078', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435472', '1529402639284355078', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435473', '1529402639284355078', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirect:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435474', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435475', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435476', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435477', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435478', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435479', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435480', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435481', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435482', '1529402639284355079', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:motan:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435483', '1529402639284355080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435484', '1529402639284355080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435485', '1529402639284355080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -2547,7 +2528,6 @@ INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, ` INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822153','649330b6-c2d7-4edc-be8e-8a54df9eb385','17', '{\"registerProtocol\":\"direct\",\"registerAddress\":\"127.0.0.1:2181\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822154','649330b6-c2d7-4edc-be8e-8a54df9eb385','18', NULL, 160, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822155','649330b6-c2d7-4edc-be8e-8a54df9eb385','19', '{\"secretKey\":\"key\"}', 30, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822156','649330b6-c2d7-4edc-be8e-8a54df9eb385','2', '{\"model\":\"black\"}', 50, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/og/create-table.sql b/db/init/og/create-table.sql index 932dd7b449f8..bbaee3d598b2 100644 --- a/db/init/og/create-table.sql +++ b/db/init/og/create-table.sql @@ -49,7 +49,7 @@ COMMENT ON COLUMN "public"."api"."http_method" IS '0-get,1-head,2-post,3-put,4-p COMMENT ON COLUMN "public"."api"."consume" IS 'consume content-type'; COMMENT ON COLUMN "public"."api"."produce" IS 'produce content-type'; COMMENT ON COLUMN "public"."api"."version" IS 'api version,for example V0.01'; -COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,motan,grpc'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,grpc'; COMMENT ON COLUMN "public"."api"."state" IS '0-unpublished,1-published,2-offline'; COMMENT ON COLUMN "public"."api"."ext" IS 'extended fields'; COMMENT ON COLUMN "public"."api"."api_owner" IS 'api_owner'; @@ -953,7 +953,6 @@ INSERT INTO "public"."plugin" VALUES ('13', 'tars', '{"multiSelectorHandle":"1", INSERT INTO "public"."plugin" VALUES ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('15', 'grpc', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); -INSERT INTO "public"."plugin" VALUES ('17', 'motan', '{"registerProtocol":"direct",registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('18', 'loggingConsole', NULL, 'Logging', 160, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('19', 'jwt', '{"secretKey":"key"}', 'Authentication', 30, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('2', 'waf', '{"model":"black"}', 'Authentication', 50, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1155,14 +1154,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524875', '26', 'loadB INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524876', '26', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524877', '26', 'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524878', '26', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524879', '17', 'registerProtocol', 'registerProtocol', 2, 3, 0, '{"required":"0","defaultValue":"zk","placeholder":"registerProtocol","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1678997557628272641', '17', 'registerAddress', 'registerAddress', 2, 3, 1, '{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524880', '17', 'corethreads', 'corethreads', 1, 3, 2, '{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524881', '17', 'threads', 'threads', 1, 3, 3, '{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524882', '17', 'queues', 'queues', 1, 3, 4, '{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524883', '17', 'threadpool', 'threadpool', 3, 3, 5, '{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1829402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 1, 0, '{"required":"0","defaultValue":"","placeholder":"registerProtocol","rule":""}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO "public"."plugin_handle" VALUES ('1878997557628272641', '17', 'registerAddress', 'registerAddress', 2, 1, 1, '{"required":"0","defaultValue":"","placeholder":"registerAddress","rule":""}', '2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524884', '28', 'port', 'port', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524885', '28', 'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524886', '28', 'maxPayloadSize', 'maxPayloadSize', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); @@ -1555,7 +1546,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932781187075', '1346775491550474 INSERT INTO "public"."resource" VALUES ('1529403932781187076', '1346775491550474240', 'contextPath', 'contextPath', '/plug/contextPath', 'contextPath', 1, 0, 'thunderbolt', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932781187079', '1346775491550474240', 'motan', 'motan', '/plug/motan', 'motan', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187080', '1346775491550474240', 'loggingConsole', 'loggingConsole', '/plug/loggingConsole', 'loggingConsole', 1, 0, 'block', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187081', '1346775491550474240', 'jwt', 'jwt', '/plug/jwt', 'jwt', 1, 0, 'pic-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187082', '1346775491550474240', 'waf', 'waf', '/plug/waf', 'waf', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -1647,15 +1637,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932877656132', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932877656133', '1529403932781187078', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656134', '1529403932781187078', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656135', '1529403932781187078', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirect:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656136', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656137', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656138', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656139', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656140', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656141', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656142', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656143', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656144', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:motan:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656145', '1529403932781187080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656146', '1529403932781187080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656147', '1529403932781187080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2732,7 +2713,6 @@ INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822149','64933 INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822153','649330b6-c2d7-4edc-be8e-8a54df9eb385','17', '{"registerProtocol":"direct","registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822154','649330b6-c2d7-4edc-be8e-8a54df9eb385','18', NULL, 160, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822155','649330b6-c2d7-4edc-be8e-8a54df9eb385','19', '{"secretKey":"key"}', 30, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822156','649330b6-c2d7-4edc-be8e-8a54df9eb385','2', '{"model":"black"}', 50, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/oracle/schema.sql b/db/init/oracle/schema.sql index 7aeb47b46c50..6812ba975897 100644 --- a/db/init/oracle/schema.sql +++ b/db/init/oracle/schema.sql @@ -462,7 +462,7 @@ comment on column API.produce comment on column API.version is 'api version,for example V0.01'; comment on column API.rpc_type - is 'http,dubbo,sofa,tars,websocket,motan,grpc'; + is 'http,dubbo,sofa,tars,websocket,grpc'; comment on column API.state is '0-unpublished,1-published,2-offline'; comment on column API.ext @@ -1164,7 +1164,6 @@ INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('14', 'contextPath', 'HttpProcess', 80,'1'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config, enabled) VALUES ('15', 'grpc', 'Proxy', 310,'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}','0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('16', 'redirect', 'HttpProcess', 110,'0'); -INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config, enabled) VALUES ('17', 'motan', 'Proxy', 310,'{"registerProtocol":"zk",registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}','0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('18', 'loggingConsole', 'Logging', 160, '0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config, enabled) VALUES ('19', 'jwt', 'Authentication', 30, '{"secretKey":"key"}', '0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('20', 'request', 'HttpProcess', 120, '0'); @@ -3017,7 +3016,6 @@ INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespa INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0); -INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822153','649330b6-c2d7-4edc-be8e-8a54df9eb385','17', '{"registerProtocol":"direct","registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}', 310, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822154','649330b6-c2d7-4edc-be8e-8a54df9eb385','18', NULL, 160, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822155','649330b6-c2d7-4edc-be8e-8a54df9eb385','19', '{"secretKey":"key"}', 30, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822156','649330b6-c2d7-4edc-be8e-8a54df9eb385','2', '{"model":"black"}', 50, 0); diff --git a/db/init/pg/create-table.sql b/db/init/pg/create-table.sql index d1e0130fd33d..23cc1577a510 100644 --- a/db/init/pg/create-table.sql +++ b/db/init/pg/create-table.sql @@ -46,7 +46,7 @@ COMMENT ON COLUMN "public"."api"."http_method" IS '0-get,1-head,2-post,3-put,4-p COMMENT ON COLUMN "public"."api"."consume" IS 'consume content-type'; COMMENT ON COLUMN "public"."api"."produce" IS 'produce content-type'; COMMENT ON COLUMN "public"."api"."version" IS 'api version,for example V0.01'; -COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,motan,grpc'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,grpc'; COMMENT ON COLUMN "public"."api"."state" IS '0-unpublished,1-published,2-offline'; COMMENT ON COLUMN "public"."api"."ext" IS 'extended fields'; COMMENT ON COLUMN "public"."api"."api_owner" IS 'api_owner'; @@ -1011,7 +1011,6 @@ INSERT INTO "public"."plugin" VALUES ('13', 'tars', '{"multiSelectorHandle":"1", INSERT INTO "public"."plugin" VALUES ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('15', 'grpc', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); -INSERT INTO "public"."plugin" VALUES ('17', 'motan', '{"registerProtocol":"direct","registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('18', 'loggingConsole', NULL, 'Logging', 160, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('19', 'jwt', '{"secretKey":"key"}', 'Authentication', 30, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('2', 'waf', '{"model":"black"}', 'Authentication', 50, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1212,14 +1211,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524875', '26', 'loadB INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524876', '26', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524877', '26', 'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524878', '26', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524879', '17', 'registerProtocol', 'registerProtocol', 2, 3, 0, '{"required":"0","defaultValue":"zk","placeholder":"registerProtocol","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1678997557628272641', '17', 'registerAddress', 'registerAddress', 2, 3, 1, '{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524880', '17', 'corethreads', 'corethreads', 1, 3, 2, '{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524881', '17', 'threads', 'threads', 1, 3, 3, '{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524882', '17', 'queues', 'queues', 1, 3, 4, '{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524883', '17', 'threadpool', 'threadpool', 3, 3, 5, '{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1829403902783524879', '17', 'registerProtocol', 'registerProtocol', 2, 1, 0, '{"required":"0","defaultValue":"","placeholder":"registerProtocol","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1878997557628272641', '17', 'registerAddress', 'registerAddress', 2, 1, 1, '{"required":"0","defaultValue":"","placeholder":"registerAddress","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524884', '28', 'port', 'port', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524885', '28', 'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524886', '28', 'maxPayloadSize', 'maxPayloadSize', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); @@ -1612,7 +1603,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932781187075', '1346775491550474 INSERT INTO "public"."resource" VALUES ('1529403932781187076', '1346775491550474240', 'contextPath', 'contextPath', '/plug/contextPath', 'contextPath', 1, 0, 'thunderbolt', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932781187079', '1346775491550474240', 'motan', 'motan', '/plug/motan', 'motan', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187080', '1346775491550474240', 'loggingConsole', 'loggingConsole', '/plug/loggingConsole', 'loggingConsole', 1, 0, 'block', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187081', '1346775491550474240', 'jwt', 'jwt', '/plug/jwt', 'jwt', 1, 0, 'pic-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187082', '1346775491550474240', 'waf', 'waf', '/plug/waf', 'waf', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -1704,15 +1694,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932877656132', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932877656133', '1529403932781187078', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656134', '1529403932781187078', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirectRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656135', '1529403932781187078', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:redirect:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656136', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656137', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656138', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656139', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656140', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656141', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656142', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656143', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:motanRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656144', '1529403932781187079', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:motan:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656145', '1529403932781187080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656146', '1529403932781187080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656147', '1529403932781187080', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:loggingConsoleSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2849,7 +2830,6 @@ INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822149','64933 INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822153','649330b6-c2d7-4edc-be8e-8a54df9eb385','17', '{"registerProtocol":"direct","registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822154','649330b6-c2d7-4edc-be8e-8a54df9eb385','18', NULL, 160, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822155','649330b6-c2d7-4edc-be8e-8a54df9eb385','19', '{"secretKey":"key"}', 30, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822156','649330b6-c2d7-4edc-be8e-8a54df9eb385','2', '{"model":"black"}', 50, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql b/db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql index 8a911f7d61a7..978b4b53e749 100755 --- a/db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql +++ b/db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql @@ -331,3 +331,32 @@ ALTER TABLE `discovery_upstream` CHANGE COLUMN `url` `upstream_url` varchar(64) ALTER TABLE `discovery_upstream` CHANGE COLUMN `status` `upstream_status` int(0) NOT NULL COMMENT 'type (0, healthy, 1 unhealthy)'; ALTER TABLE `discovery` CHANGE COLUMN `level` `discovery_level` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '0 selector,1 plugin 2 global'; + +/* remove motan plugin */ +DELETE FROM `api_rule_relation` WHERE `rule_id` IN ( + SELECT `id` FROM (SELECT `r`.`id` + FROM `rule` `r` + INNER JOIN `selector` `s` ON `r`.`selector_id` = `s`.`id` + WHERE `s`.`plugin_id` = '17') AS `motan_rule_ids` +); +DELETE FROM `rule_condition` WHERE `rule_id` IN ( + SELECT `id` FROM (SELECT `r`.`id` + FROM `rule` `r` + INNER JOIN `selector` `s` ON `r`.`selector_id` = `s`.`id` + WHERE `s`.`plugin_id` = '17') AS `motan_rule_ids` +); +DELETE FROM `rule` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '17') AS `motan_selector_ids` +); +DELETE FROM `selector_condition` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '17') AS `motan_selector_ids` +); +DELETE FROM `selector` WHERE `plugin_id` = '17'; +DELETE FROM `meta_data` WHERE `rpc_type` = 'motan'; +DELETE FROM `api` WHERE `rpc_type` = 'motan'; +DELETE FROM `permission` WHERE `resource_id` IN ('1529402639284355079', '1529402639372435474', '1529402639372435475', '1529402639372435476', '1529402639372435477', '1529402639372435478', '1529402639372435479', '1529402639372435480', '1529402639372435481', '1529402639372435482'); +DELETE FROM `resource` WHERE `id` IN ('1529402639284355079', '1529402639372435474', '1529402639372435475', '1529402639372435476', '1529402639372435477', '1529402639372435478', '1529402639372435479', '1529402639372435480', '1529402639372435481', '1529402639372435482'); +DELETE FROM `namespace_plugin_rel` WHERE `plugin_id` = '17'; +DELETE FROM `plugin_handle` WHERE `plugin_id` = '17'; +DELETE FROM `plugin` WHERE `id` = '17'; +ALTER TABLE `api` MODIFY COLUMN `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,springCloud,grpc'; diff --git a/db/upgrade/2.7.0-upgrade-2.7.1-ob.sql b/db/upgrade/2.7.0-upgrade-2.7.1-ob.sql index 45f3ce69412a..6b8aac0afaf5 100755 --- a/db/upgrade/2.7.0-upgrade-2.7.1-ob.sql +++ b/db/upgrade/2.7.0-upgrade-2.7.1-ob.sql @@ -322,4 +322,33 @@ ALTER TABLE `discovery` CHANGE COLUMN `name` `discovery_name` varchar(128) CHARA ALTER TABLE `discovery_upstream` CHANGE COLUMN `url` `upstream_url` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'ip:port'; ALTER TABLE `discovery_upstream` CHANGE COLUMN `status` `upstream_status` int(0) NOT NULL COMMENT 'type (0, healthy, 1 unhealthy)'; -ALTER TABLE `discovery` CHANGE COLUMN `level` `discovery_level` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '0 selector,1 plugin 2 global'; \ No newline at end of file +ALTER TABLE `discovery` CHANGE COLUMN `level` `discovery_level` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '0 selector,1 plugin 2 global'; + +/* remove motan plugin */ +DELETE FROM `api_rule_relation` WHERE `rule_id` IN ( + SELECT `id` FROM (SELECT `r`.`id` + FROM `rule` `r` + INNER JOIN `selector` `s` ON `r`.`selector_id` = `s`.`id` + WHERE `s`.`plugin_id` = '17') AS `motan_rule_ids` +); +DELETE FROM `rule_condition` WHERE `rule_id` IN ( + SELECT `id` FROM (SELECT `r`.`id` + FROM `rule` `r` + INNER JOIN `selector` `s` ON `r`.`selector_id` = `s`.`id` + WHERE `s`.`plugin_id` = '17') AS `motan_rule_ids` +); +DELETE FROM `rule` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '17') AS `motan_selector_ids` +); +DELETE FROM `selector_condition` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '17') AS `motan_selector_ids` +); +DELETE FROM `selector` WHERE `plugin_id` = '17'; +DELETE FROM `meta_data` WHERE `rpc_type` = 'motan'; +DELETE FROM `api` WHERE `rpc_type` = 'motan'; +DELETE FROM `permission` WHERE `resource_id` IN ('1529402639284355079', '1529402639372435474', '1529402639372435475', '1529402639372435476', '1529402639372435477', '1529402639372435478', '1529402639372435479', '1529402639372435480', '1529402639372435481', '1529402639372435482'); +DELETE FROM `resource` WHERE `id` IN ('1529402639284355079', '1529402639372435474', '1529402639372435475', '1529402639372435476', '1529402639372435477', '1529402639372435478', '1529402639372435479', '1529402639372435480', '1529402639372435481', '1529402639372435482'); +DELETE FROM `namespace_plugin_rel` WHERE `plugin_id` = '17'; +DELETE FROM `plugin_handle` WHERE `plugin_id` = '17'; +DELETE FROM `plugin` WHERE `id` = '17'; +ALTER TABLE `api` MODIFY COLUMN `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,springCloud,grpc'; diff --git a/db/upgrade/2.7.0-upgrade-2.7.1-og.sql b/db/upgrade/2.7.0-upgrade-2.7.1-og.sql index 1f67b61212ce..36f6b4e1227e 100644 --- a/db/upgrade/2.7.0-upgrade-2.7.1-og.sql +++ b/db/upgrade/2.7.0-upgrade-2.7.1-og.sql @@ -347,3 +347,36 @@ ALTER TABLE "public"."discovery_upstream" RENAME COLUMN "url" TO "upstream_url"; ALTER TABLE "public"."discovery_upstream" RENAME COLUMN "status" TO "upstream_status"; ALTER TABLE "public"."discovery" RENAME COLUMN "level" TO "discovery_level"; + +/* remove motan plugin */ +DELETE FROM "public"."api_rule_relation" WHERE "rule_id" IN ( + SELECT "id" FROM ( + SELECT "r"."id" + FROM "public"."rule" "r" + INNER JOIN "public"."selector" "s" ON "r"."selector_id" = "s"."id" + WHERE "s"."plugin_id" = '17' + ) AS "motan_rule_ids" +); +DELETE FROM "public"."rule_condition" WHERE "rule_id" IN ( + SELECT "id" FROM ( + SELECT "r"."id" + FROM "public"."rule" "r" + INNER JOIN "public"."selector" "s" ON "r"."selector_id" = "s"."id" + WHERE "s"."plugin_id" = '17' + ) AS "motan_rule_ids" +); +DELETE FROM "public"."rule" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '17') AS "motan_selector_ids" +); +DELETE FROM "public"."selector_condition" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '17') AS "motan_selector_ids" +); +DELETE FROM "public"."selector" WHERE "plugin_id" = '17'; +DELETE FROM "public"."meta_data" WHERE "rpc_type" = 'motan'; +DELETE FROM "public"."api" WHERE "rpc_type" = 'motan'; +DELETE FROM "public"."permission" WHERE "resource_id" IN ('1529403932781187079', '1529403932877656136', '1529403932877656137', '1529403932877656138', '1529403932877656139', '1529403932877656140', '1529403932877656141', '1529403932877656142', '1529403932877656143', '1529403932877656144'); +DELETE FROM "public"."resource" WHERE "id" IN ('1529403932781187079', '1529403932877656136', '1529403932877656137', '1529403932877656138', '1529403932877656139', '1529403932877656140', '1529403932877656141', '1529403932877656142', '1529403932877656143', '1529403932877656144'); +DELETE FROM "public"."namespace_plugin_rel" WHERE "plugin_id" = '17'; +DELETE FROM "public"."plugin_handle" WHERE "plugin_id" = '17'; +DELETE FROM "public"."plugin" WHERE "id" = '17'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,springCloud,grpc'; diff --git a/db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql b/db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql index 5393946f3e0f..c3ec9c2f9c8d 100755 --- a/db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql +++ b/db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql @@ -702,3 +702,36 @@ ALTER TABLE discovery_upstream RENAME COLUMN "url" TO "upstream_url"; ALTER TABLE discovery_upstream RENAME COLUMN "status" TO "upstream_status"; ALTER TABLE discovery RENAME COLUMN "level" TO discovery_level; + +/* remove motan plugin */ +DELETE FROM api_rule_relation WHERE rule_id IN ( + SELECT id FROM ( + SELECT r.id + FROM rule r + INNER JOIN selector s ON r.selector_id = s.id + WHERE s.plugin_id = '17' + ) +); +DELETE FROM rule_condition WHERE rule_id IN ( + SELECT id FROM ( + SELECT r.id + FROM rule r + INNER JOIN selector s ON r.selector_id = s.id + WHERE s.plugin_id = '17' + ) +); +DELETE FROM rule WHERE selector_id IN ( + SELECT id FROM (SELECT id FROM selector WHERE plugin_id = '17') +); +DELETE FROM selector_condition WHERE selector_id IN ( + SELECT id FROM (SELECT id FROM selector WHERE plugin_id = '17') +); +DELETE FROM selector WHERE plugin_id = '17'; +DELETE FROM meta_data WHERE rpc_type = 'motan'; +DELETE FROM api WHERE rpc_type = 'motan'; +DELETE FROM permission WHERE resource_id IN ('1529403932781187079', '1529403932877656136', '1529403932877656137', '1529403932877656138', '1529403932877656139', '1529403932877656140', '1529403932877656141', '1529403932877656142', '1529403932877656143', '1529403932877656144'); +DELETE FROM resource WHERE id IN ('1529403932781187079', '1529403932877656136', '1529403932877656137', '1529403932877656138', '1529403932877656139', '1529403932877656140', '1529403932877656141', '1529403932877656142', '1529403932877656143', '1529403932877656144'); +DELETE FROM namespace_plugin_rel WHERE plugin_id = '17'; +DELETE FROM plugin_handle WHERE plugin_id = '17'; +DELETE FROM plugin WHERE id = '17'; +COMMENT ON COLUMN api.rpc_type IS 'http,dubbo,sofa,tars,websocket,springCloud,grpc'; diff --git a/db/upgrade/2.7.0-upgrade-2.7.1-pg.sql b/db/upgrade/2.7.0-upgrade-2.7.1-pg.sql index 7b8c3f3ee809..eca5d2cc532c 100755 --- a/db/upgrade/2.7.0-upgrade-2.7.1-pg.sql +++ b/db/upgrade/2.7.0-upgrade-2.7.1-pg.sql @@ -345,3 +345,36 @@ ALTER TABLE "public"."discovery_upstream" RENAME COLUMN "url" TO "upstream_url"; ALTER TABLE "public"."discovery_upstream" RENAME COLUMN "status" TO "upstream_status"; ALTER TABLE "public"."discovery" RENAME COLUMN "level" TO "discovery_level"; + +/* remove motan plugin */ +DELETE FROM "public"."api_rule_relation" WHERE "rule_id" IN ( + SELECT "id" FROM ( + SELECT "r"."id" + FROM "public"."rule" "r" + INNER JOIN "public"."selector" "s" ON "r"."selector_id" = "s"."id" + WHERE "s"."plugin_id" = '17' + ) AS "motan_rule_ids" +); +DELETE FROM "public"."rule_condition" WHERE "rule_id" IN ( + SELECT "id" FROM ( + SELECT "r"."id" + FROM "public"."rule" "r" + INNER JOIN "public"."selector" "s" ON "r"."selector_id" = "s"."id" + WHERE "s"."plugin_id" = '17' + ) AS "motan_rule_ids" +); +DELETE FROM "public"."rule" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '17') AS "motan_selector_ids" +); +DELETE FROM "public"."selector_condition" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '17') AS "motan_selector_ids" +); +DELETE FROM "public"."selector" WHERE "plugin_id" = '17'; +DELETE FROM "public"."meta_data" WHERE "rpc_type" = 'motan'; +DELETE FROM "public"."api" WHERE "rpc_type" = 'motan'; +DELETE FROM "public"."permission" WHERE "resource_id" IN ('1529403932781187079', '1529403932877656136', '1529403932877656137', '1529403932877656138', '1529403932877656139', '1529403932877656140', '1529403932877656141', '1529403932877656142', '1529403932877656143', '1529403932877656144'); +DELETE FROM "public"."resource" WHERE "id" IN ('1529403932781187079', '1529403932877656136', '1529403932877656137', '1529403932877656138', '1529403932877656139', '1529403932877656140', '1529403932877656141', '1529403932877656142', '1529403932877656143', '1529403932877656144'); +DELETE FROM "public"."namespace_plugin_rel" WHERE "plugin_id" = '17'; +DELETE FROM "public"."plugin_handle" WHERE "plugin_id" = '17'; +DELETE FROM "public"."plugin" WHERE "id" = '17'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,springCloud,grpc'; diff --git a/pom.xml b/pom.xml index a76f38c74578..dafa9aeef0d2 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,6 @@ 0.10 1.13.0 3.12.0 - 1.2.1 3.3.1 1.9.6 1.4.200 @@ -231,30 +230,6 @@ ${bytebuddy.version} - - com.weibo - motan-core - ${motan.version} - - - - com.weibo - motan-transport-netty4 - ${motan.version} - - - - com.weibo - motan-registry-zookeeper - ${motan.version} - - - - com.weibo - motan-springsupport - ${motan.version} - - com.google.code.gson gson diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/ApiDTO.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/ApiDTO.java index 9fed0fa046bc..0837d9a8c803 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/ApiDTO.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/ApiDTO.java @@ -75,7 +75,7 @@ public class ApiDTO implements Serializable { private String version; /** - * http,dubbo,sofa,tars,websocket,springCloud,motan,grpc. + * http,dubbo,sofa,tars,websocket,springCloud,grpc. */ private String rpcType; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java index c85fce9959e2..b52d2098b1b3 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java @@ -66,7 +66,7 @@ public class ApiDO { private String version; /** - * http,dubbo,sofa,tars,websocket,springCloud,motan,grpc. + * http,dubbo,sofa,tars,websocket,springCloud,grpc. */ private String rpcType; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java index a9088f515b95..72e9c9f935e0 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java @@ -68,7 +68,7 @@ public class ApiVO implements Serializable { private String version; /** - * http,dubbo,sofa,tars,websocket,springCloud,motan,grpc. + * http,dubbo,sofa,tars,websocket,springCloud,grpc. */ private String rpcType; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImpl.java deleted file mode 100644 index a1dd5a22ed5a..000000000000 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImpl.java +++ /dev/null @@ -1,62 +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.shenyu.admin.service.register; - -import org.apache.shenyu.admin.model.entity.MetaDataDO; -import org.apache.shenyu.admin.model.entity.SelectorDO; -import org.apache.shenyu.admin.service.MetaDataService; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * motan service register. - */ -@Service -public class ShenyuClientRegisterMotanServiceImpl extends AbstractShenyuClientRegisterServiceImpl { - - @Override - public String rpcType() { - return RpcTypeEnum.MOTAN.getName(); - } - - @Override - protected String selectorHandler(final MetaDataRegisterDTO metaDataDTO) { - return ""; - } - - @Override - protected String ruleHandler() { - return ""; - } - - @Override - protected void registerMetadata(final MetaDataRegisterDTO metaDataDTO) { - MetaDataService metaDataService = getMetaDataService(); - MetaDataDO exist = metaDataService.findByPathAndNamespaceId(metaDataDTO.getPath(), metaDataDTO.getNamespaceId()); - metaDataService.saveOrUpdateMetaData(exist, metaDataDTO); - } - - @Override - protected String buildHandle(final List uriList, final SelectorDO selectorDO) { - return ""; - } -} diff --git a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql index dc6a0c385491..c4186d5a881d 100644 --- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql +++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql @@ -390,7 +390,7 @@ CREATE TABLE IF NOT EXISTS `api` `consume` varchar(255) NOT NULL COMMENT 'consume', `produce` varchar(255) NOT NULL COMMENT 'produce', `version` varchar(255) NOT NULL COMMENT 'api version,for example V0.01', - `rpc_type` varchar(64) NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,motan,grpc', + `rpc_type` varchar(64) NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,grpc', `state` tinyint NOT NULL COMMENT '0-unpublished,1-published,2-offline', `ext` varchar(1024) NOT NULL COMMENT 'extended fields', `api_owner` varchar(255) NOT NULL COMMENT 'api_owner', @@ -572,7 +572,6 @@ INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('14', 'contextPath', 'HttpProcess', 80,'1'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) VALUES ('15', 'grpc', 'Proxy', 310,'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}','0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('16', 'redirect', 'HttpProcess', 110,'0'); -INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) VALUES ('17', 'motan', 'Proxy', 310,'{"registerProtocol":"zk","registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}','0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('18', 'loggingConsole', 'Logging', 160, '0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) VALUES ('19', 'jwt', 'Authentication', 30, '{"secretKey":"key"}', '0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('20', 'request', 'HttpProcess', 120, '0'); @@ -733,14 +732,6 @@ INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`, INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613204172831', '26', 'retry', 'retryCount', 1, 2, 1); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172832', '26', 'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613204172833', '26', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 3, 0, '{"required":"0","defaultValue":"direct","placeholder":"registerProtocol","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172835', '17', 'corethreads', 'corethreads', 1, 3, 2, '{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172836', '17', 'threads', 'threads', 1, 3, 3, '{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172837', '17', 'queues', 'queues', 1, 3, 4, '{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172838', '17', 'threadpool', 'threadpool', 3, 3, 5, '{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1678997557628272641', '17', 'registerAddress', 'registerAddress', 2, 3, 1,'{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1829402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 1, 0, '{"required":"0","defaultValue":"","placeholder":"registerProtocol","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1878997557628272641', '17', 'registerAddress', 'registerAddress', 2, 1, 1,'{"required":"0","defaultValue":"","placeholder":"registerAddress","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613204172839', '28', 'port', 'port', 1, 3, 1); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613204172840', '28', 'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613204172841', '28', 'maxPayloadSize', 'maxPayloadSize', 1, 3, 1); @@ -1448,7 +1439,6 @@ INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `con INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822153','649330b6-c2d7-4edc-be8e-8a54df9eb385','17', '{"registerProtocol":"direct","registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822154','649330b6-c2d7-4edc-be8e-8a54df9eb385','18', NULL, 160, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822155','649330b6-c2d7-4edc-be8e-8a54df9eb385','19', '{"secretKey":"key"}', 30, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822156','649330b6-c2d7-4edc-be8e-8a54df9eb385','2', '{"model":"black"}', 50, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImplTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImplTest.java deleted file mode 100644 index 31358fb06bb3..000000000000 --- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterMotanServiceImplTest.java +++ /dev/null @@ -1,89 +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.shenyu.admin.service.register; - -import org.apache.commons.lang3.StringUtils; -import org.apache.shenyu.admin.model.entity.MetaDataDO; -import org.apache.shenyu.admin.model.entity.SelectorDO; -import org.apache.shenyu.admin.service.impl.MetaDataServiceImpl; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.junit.jupiter.MockitoSettings; -import org.mockito.quality.Strictness; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -/** - * Test cases for {@link ShenyuClientRegisterMotanServiceImpl}. - */ -@ExtendWith(MockitoExtension.class) -@MockitoSettings(strictness = Strictness.LENIENT) -public final class ShenyuClientRegisterMotanServiceImplTest { - - @InjectMocks - private ShenyuClientRegisterMotanServiceImpl shenyuClientRegisterMotanService; - - @Mock - private MetaDataServiceImpl metaDataService; - - @Test - public void testRpcType() { - String rpcType = shenyuClientRegisterMotanService.rpcType(); - assertEquals(RpcTypeEnum.MOTAN.getName(), rpcType); - } - - @Test - public void testSelectorHandler() { - MetaDataRegisterDTO metaDataRegisterDTO = MetaDataRegisterDTO.builder().build(); - assertEquals(StringUtils.EMPTY, shenyuClientRegisterMotanService.selectorHandler(metaDataRegisterDTO)); - } - - @Test - public void testRuleHandler() { - assertEquals(StringUtils.EMPTY, shenyuClientRegisterMotanService.ruleHandler()); - } - - @Test - public void testRegisterMetadata() { - MetaDataDO metaDataDO = MetaDataDO.builder().build(); - when(metaDataService.findByPathAndNamespaceId(any(), any())).thenReturn(metaDataDO); - MetaDataRegisterDTO metaDataDTO = MetaDataRegisterDTO.builder().build(); - shenyuClientRegisterMotanService.registerMetadata(metaDataDTO); - verify(metaDataService).saveOrUpdateMetaData(metaDataDO, metaDataDTO); - } - - @Test - public void testBuildHandle() { - List list = new ArrayList<>(); - list.add(URIRegisterDTO.builder().build()); - assertEquals(StringUtils.EMPTY, - shenyuClientRegisterMotanService.buildHandle(list, SelectorDO.builder().build())); - } -} diff --git a/shenyu-bootstrap/pom.xml b/shenyu-bootstrap/pom.xml index abe6c1598f4b..1cd22e65c871 100644 --- a/shenyu-bootstrap/pom.xml +++ b/shenyu-bootstrap/pom.xml @@ -417,47 +417,6 @@ - - - - com.weibo - motan-core - ${motan.version} - - - com.weibo - motan-transport-netty4 - ${motan.version} - - - com.weibo - motan-registry-zookeeper - ${motan.version} - - - log4j - log4j - - - org.slf4j - slf4j-log4j12 - - - - - com.weibo - motan-springsupport - ${motan.version} - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-motan - ${project.version} - - - org.apache.shenyu diff --git a/shenyu-client/pom.xml b/shenyu-client/pom.xml index 99c44202b153..65cca80d2265 100644 --- a/shenyu-client/pom.xml +++ b/shenyu-client/pom.xml @@ -34,7 +34,6 @@ shenyu-client-sofa shenyu-client-tars shenyu-client-grpc - shenyu-client-motan shenyu-client-websocket shenyu-client-api-docs-annotations shenyu-client-autoconfig diff --git a/shenyu-client/shenyu-client-motan/pom.xml b/shenyu-client/shenyu-client-motan/pom.xml deleted file mode 100644 index 404224c205d4..000000000000 --- a/shenyu-client/shenyu-client-motan/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-client - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-client-motan - - - - org.apache.shenyu - shenyu-client-core - ${project.version} - - - org.springframework - spring-beans - provided - - - org.springframework - spring-context - provided - - - org.springframework - spring-core - provided - - - com.weibo - motan-springsupport - provided - - - - diff --git a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceEventListener.java b/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceEventListener.java deleted file mode 100644 index f8fdcf3a6eb6..000000000000 --- a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/MotanServiceEventListener.java +++ /dev/null @@ -1,233 +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.shenyu.client.motan; - -import com.weibo.api.motan.config.springsupport.BasicServiceConfigBean; -import com.weibo.api.motan.config.springsupport.annotation.MotanService; -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Collectors; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.shenyu.client.core.client.AbstractContextRefreshedEventListener; -import org.apache.shenyu.client.core.constant.ShenyuClientConstants; -import org.apache.shenyu.client.core.disruptor.ShenyuClientRegisterEventPublisher; -import org.apache.shenyu.client.core.exception.ShenyuClientIllegalArgumentException; -import org.apache.shenyu.client.motan.common.annotation.ShenyuMotanClient; -import org.apache.shenyu.client.motan.common.dto.MotanRpcExt; -import org.apache.shenyu.common.enums.ApiHttpMethodEnum; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; -import org.apache.shenyu.register.common.enums.EventType; -import org.javatuples.Sextet; -import org.springframework.context.ApplicationContext; -import org.springframework.core.StandardReflectionParameterNameDiscoverer; -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; -import org.springframework.util.ReflectionUtils; - -/** - * Motan Service Event Listener. - */ -public class MotanServiceEventListener extends AbstractContextRefreshedEventListener { - - protected static final String BASE_SERVICE_CONFIG = "baseServiceConfig"; - - private final StandardReflectionParameterNameDiscoverer localVariableTableParameterNameDiscoverer = new StandardReflectionParameterNameDiscoverer(); - - private final ShenyuClientRegisterEventPublisher publisher = ShenyuClientRegisterEventPublisher.getInstance(); - - private ApplicationContext applicationContext; - - private String group; - - public MotanServiceEventListener(final ShenyuClientConfig clientConfig, - final ShenyuClientRegisterRepository shenyuClientRegisterRepository) { - super(clientConfig, shenyuClientRegisterRepository); - } - - @Override - protected Sextet buildApiDocSextet(final Method method, final Annotation annotation, final Map beans) { - ShenyuMotanClient shenyuMotanClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuMotanClient.class); - if (Objects.isNull(shenyuMotanClient)) { - return null; - } - String produce = ShenyuClientConstants.MEDIA_TYPE_ALL_VALUE; - String consume = ShenyuClientConstants.MEDIA_TYPE_ALL_VALUE; - String[] values = new String[]{shenyuMotanClient.value()}; - ApiHttpMethodEnum[] apiHttpMethodEnums = new ApiHttpMethodEnum[]{ApiHttpMethodEnum.NOT_HTTP}; - String version = "v0.01"; - return Sextet.with(values, consume, produce, apiHttpMethodEnums, RpcTypeEnum.MOTAN, version); - } - - @Override - protected Map getBeans(final ApplicationContext context) { - applicationContext = context; - group = ((BasicServiceConfigBean) applicationContext.getBean(BASE_SERVICE_CONFIG)).getGroup(); - return context.getBeansWithAnnotation(ShenyuMotanClient.class); - } - - @Override - protected URIRegisterDTO buildURIRegisterDTO(final ApplicationContext context, - final Map beans, - final String namespaceId) { - return URIRegisterDTO.builder() - .contextPath(this.getContextPath()) - .appName(this.getAppName()) - .rpcType(RpcTypeEnum.MOTAN.getName()) - .eventType(EventType.REGISTER) - .host(this.getHost()) - .port(Integer.parseInt(this.getPort())) - .namespaceId(namespaceId) - .build(); - } - - @Override - protected String getClientName() { - return RpcTypeEnum.MOTAN.getName(); - } - - @Override - protected String buildApiSuperPath(final Class clazz, final ShenyuMotanClient shenyuMotanClient) { - if (Objects.nonNull(shenyuMotanClient) && !StringUtils.isBlank(shenyuMotanClient.path())) { - return shenyuMotanClient.path(); - } - return ""; - } - - @Override - protected Class getAnnotationType() { - return ShenyuMotanClient.class; - } - - @Override - protected MetaDataRegisterDTO buildMetaDataDTO(final Object bean, - @NonNull final ShenyuMotanClient shenyuMotanClient, - final String path, - final Class clazz, - final Method method, - final String namespaceId) { - Integer timeout = Optional.ofNullable(((BasicServiceConfigBean) applicationContext.getBean(BASE_SERVICE_CONFIG)).getRequestTimeout()).orElse(1000); - MotanService service = AnnotatedElementUtils.findMergedAnnotation(clazz, MotanService.class); - String desc = shenyuMotanClient.desc(); - String configRuleName = shenyuMotanClient.ruleName(); - String ruleName = ("".equals(configRuleName)) ? path : configRuleName; - String methodName = method.getName(); - Class[] parameterTypesClazz = method.getParameterTypes(); - String parameterTypes = Arrays.stream(parameterTypesClazz).map(Class::getName) - .collect(Collectors.joining(",")); - String serviceName = getServiceName(clazz, service); - String protocol = StringUtils.isNotEmpty(service.protocol()) ? service.protocol() : (getProtocolFromExport()); - return MetaDataRegisterDTO.builder() - .appName(this.getAppName()) - .serviceName(serviceName) - .methodName(methodName) - .contextPath(this.getContextPath()) - .path(path) - .port(Integer.parseInt(super.getPort())) - .host(super.getHost()) - .ruleName(ruleName) - .pathDesc(desc) - .parameterTypes(parameterTypes) - .rpcType(RpcTypeEnum.MOTAN.getName()) - .rpcExt(buildRpcExt(method, timeout, protocol)) - .enabled(shenyuMotanClient.enabled()) - .namespaceId(namespaceId) - .build(); - } - - @Override - protected String buildApiPath(final Method method, - final String superPath, - @Nullable final ShenyuMotanClient methodShenyuClient) { - return superPath.contains("*") - ? pathJoin(this.getContextPath(), superPath.replace("*", ""), method.getName()) - : pathJoin(this.getContextPath(), superPath, Objects.requireNonNull(methodShenyuClient).path()); - } - - @Override - protected void handleClass(final Class clazz, final Object bean, final ShenyuMotanClient beanShenyuClient, final String superPath) { - Method[] methods = ReflectionUtils.getDeclaredMethods(clazz); - List namespaceIds = super.getNamespace(); - for (String namespaceId : namespaceIds) { - for (Method method : methods) { - final MetaDataRegisterDTO metaData = buildMetaDataDTO(bean, beanShenyuClient, - buildApiPath(method, superPath, null), clazz, method, namespaceId); - publisher.publishEvent(metaData); - getMetaDataMap().put(method, metaData); - } - } - } - - private MotanRpcExt.RpcExt buildRpcExt(final Method method) { - String[] paramNames = localVariableTableParameterNameDiscoverer.getParameterNames(method); - List> params = new ArrayList<>(); - if (Objects.nonNull(paramNames) && paramNames.length > 0) { - Class[] paramTypes = method.getParameterTypes(); - for (int i = 0; i < paramNames.length; i++) { - params.add(Pair.of(paramTypes[i].getName(), paramNames[i])); - } - } - return new MotanRpcExt.RpcExt(method.getName(), params); - } - - private String buildRpcExt(final Method method, final Integer timeout, final String rpcProtocol) { - List list = new ArrayList<>(); - list.add(buildRpcExt(method)); - MotanRpcExt buildList = new MotanRpcExt(list, group, timeout, rpcProtocol); - return GsonUtils.getInstance().toJson(buildList); - } - - /** - * Get the protocol from BasicServiceConfigBean export. - * @return rpc protocol - */ - private String getProtocolFromExport() { - String export = Optional.ofNullable(((BasicServiceConfigBean) applicationContext.getBean(BASE_SERVICE_CONFIG)).getExport()).orElse(""); - if (StringUtils.isNotEmpty(export) && export.contains(":")) { - return export.split(":")[0]; - } - return "motan2"; - } - - private String getServiceName(final Class clazz, @Nullable final MotanService service) { - String serviceName; - if (void.class.equals(service.interfaceClass())) { - if (clazz.getInterfaces().length > 0) { - serviceName = clazz.getInterfaces()[0].getName(); - } else { - throw new ShenyuClientIllegalArgumentException("Failed to export remote service class " + clazz.getName() - + ", cause: The @Service undefined interfaceClass or interfaceName, and the service class unimplemented any interfaces."); - } - } else { - serviceName = service.interfaceClass().getName(); - } - return serviceName; - } -} diff --git a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanClient.java b/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanClient.java deleted file mode 100644 index 9be0ef1cc2c5..000000000000 --- a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanClient.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.shenyu.client.motan.common.annotation; - -import org.springframework.core.annotation.AliasFor; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * The interface shenyu client. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.METHOD}) -@Inherited -public @interface ShenyuMotanClient { - - /** - * Path string. - * - * @return the string - */ - @AliasFor(attribute = "path") - String value() default ""; - - /** - * Path string. - * - * @return the string - */ - @AliasFor(attribute = "value") - String path() default ""; - /** - * Rule name string. - * - * @return the string - */ - String ruleName() default ""; - - /** - * Desc string. - * - * @return String string - */ - String desc() default ""; - - /** - * Enabled boolean. - * - * @return the boolean - */ - boolean enabled() default true; -} diff --git a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanService.java b/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanService.java deleted file mode 100644 index abef51d75642..000000000000 --- a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/annotation/ShenyuMotanService.java +++ /dev/null @@ -1,293 +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.shenyu.client.motan.common.annotation; - -import com.weibo.api.motan.config.springsupport.annotation.MotanService; -import org.springframework.core.annotation.AliasFor; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * The interface shenyu client. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Inherited -@MotanService -@ShenyuMotanClient -public @interface ShenyuMotanService { - - /** - * interface class. - * - * @return class - */ - @AliasFor(annotation = MotanService.class) - Class interfaceClass() default void.class; - - /** - * basic service string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String basicService() default ""; - - /** - * export string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String export() default ""; - - /** - * export string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String host() default ""; - - /** - * protocol string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String protocol() default ""; - - /** - * methods strings. - * - * @return strings - */ - @AliasFor(annotation = MotanService.class) - String[] methods() default {}; - - /** - * registry string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String registry() default ""; - - /** - * extConfig string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String extConfig() default ""; - - /** - * application string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String application() default ""; - - /** - * module string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String module() default ""; - - /** - * group string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String group() default ""; - - /** - * version string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String version() default ""; - - /** - * proxy string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String proxy() default ""; - - /** - * filter string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String filter() default ""; - - /** - * actives int. - * - * @return the int - */ - @AliasFor(annotation = MotanService.class) - int actives() default 0; - - /** - * async boolean. - * - * @return the boolean - */ - @AliasFor(annotation = MotanService.class) - boolean async() default false; - - /** - * mock string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String mock() default ""; - - /** - * shareChannel boolean. - * - * @return the boolean - */ - @AliasFor(annotation = MotanService.class) - boolean shareChannel() default false; - - /** - * throwException boolean. - * - * @return the boolean - */ - @AliasFor(annotation = MotanService.class) - boolean throwException() default false; - - /** - * requestTimeout int. - * - * @return the int - */ - @AliasFor(annotation = MotanService.class) - int requestTimeout() default 0; - - /** - * register boolean. - * - * @return the boolean - */ - @AliasFor(annotation = MotanService.class) - boolean register() default false; - - /** - * accessLog boolean. - * - * @return the boolean - */ - @AliasFor(annotation = MotanService.class) - boolean accessLog() default false; - - /** - * check boolean. - * - * @return the boolean - */ - @AliasFor(annotation = MotanService.class) - boolean check() default false; - - /** - * retries int. - * - * @return the int - */ - @AliasFor(annotation = MotanService.class) - int retries() default 0; - - /** - * usegz boolean. - * - * @return the boolean - */ - @AliasFor(annotation = MotanService.class) - boolean usegz() default false; - - /** - * mingzSize int. - * - * @return the int - */ - @AliasFor(annotation = MotanService.class) - int mingzSize() default 0; - - /** - * codec string. - * - * @return the string - */ - @AliasFor(annotation = MotanService.class) - String codec() default ""; - - /** - * Path string. - * - * @return the string - */ - @AliasFor(annotation = ShenyuMotanClient.class) - String value() default ""; - - /** - * Path string. - * - * @return the string - */ - @AliasFor(annotation = ShenyuMotanClient.class) - String path() default ""; - /** - * Rule name string. - * - * @return the string - */ - @AliasFor(annotation = ShenyuMotanClient.class) - String ruleName() default ""; - - /** - * Desc string. - * - * @return String string - */ - @AliasFor(annotation = ShenyuMotanClient.class) - String desc() default ""; - - /** - * Enabled boolean. - * - * @return the boolean - */ - @AliasFor(annotation = ShenyuMotanClient.class) - boolean enabled() default true; -} diff --git a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/dto/MotanRpcExt.java b/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/dto/MotanRpcExt.java deleted file mode 100644 index 44a927c513ee..000000000000 --- a/shenyu-client/shenyu-client-motan/src/main/java/org/apache/shenyu/client/motan/common/dto/MotanRpcExt.java +++ /dev/null @@ -1,210 +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.shenyu.client.motan.common.dto; - -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; - -/** - * Motan rpc ext. - */ -public class MotanRpcExt { - - /** - * in order to be compatible with the old version, - * we can't change the type of this field. - */ - private List methodInfo; - - private String group; - - private Integer timeout; - - private String rpcProtocol; - - /** - * constructor without params. - */ - public MotanRpcExt() { - } - - /** - * constructor with all params. - * - * @param methodInfo methodInfo - * @param group group - * @param timeout timeout - * @param rpcProtocol rpcProtocol - */ - public MotanRpcExt(final List methodInfo, final String group, final Integer timeout, final String rpcProtocol) { - this.methodInfo = methodInfo; - this.group = group; - this.timeout = timeout; - this.rpcProtocol = rpcProtocol; - } - - /** - * get methodInfo. - * - * @return methodInfo - */ - public List getMethodInfo() { - return methodInfo; - } - - /** - * set methodInfo. - * - * @param methodInfo methodInfo - */ - public void setMethodInfo(final List methodInfo) { - this.methodInfo = methodInfo; - } - - /** - * get group. - * - * @return group - */ - public String getGroup() { - return group; - } - - /** - * set group. - * @param group group - */ - public void setGroup(final String group) { - this.group = group; - } - - /** - * get timeout. - * - * @return timeout - */ - public Integer getTimeout() { - return timeout; - } - - /** - * set timeout. - * @param timeout timeout - */ - public void setTimeout(final Integer timeout) { - this.timeout = timeout; - } - - /** - * get rpc protocol. - * @return rpcProtocol - */ - public String getRpcProtocol() { - return rpcProtocol; - } - - /** - * set rpcProtocol. - * @param rpcProtocol rpc protocol - */ - public void setRpcProtocol(final String rpcProtocol) { - this.rpcProtocol = rpcProtocol; - } - - @Override - public String toString() { - return "MotanRpcExt{" - + "methodInfo=" + methodInfo - + ", group='" + group + '\'' - + ", timeout='" + timeout + '\'' - + ", rpcProtocol='" + rpcProtocol + '\'' - + '}'; - } - - /** - * The type Rpc ext. - */ - public static class RpcExt { - - private String methodName; - - private List> params; - - /** - * constructor without params. - */ - public RpcExt() { - } - - /** - * constructor with all params. - * - * @param methodName methodName - * @param params params - */ - public RpcExt(final String methodName, final List> params) { - this.methodName = methodName; - this.params = params; - } - - /** - * get methodName. - * - * @return methodName - */ - public String getMethodName() { - return methodName; - } - - /** - * set methodName. - * - * @param methodName methodName - */ - public void setMethodName(final String methodName) { - this.methodName = methodName; - } - - /** - * get params. - * - * @return params - */ - public List> getParams() { - return params; - } - - /** - * set params. - * - * @param params params - */ - public void setParams(final List> params) { - this.params = params; - } - - @Override - public String toString() { - return "RpcExt{" - + "methodName='" + methodName + '\'' - + ", params=" + params - + '}'; - } - } -} diff --git a/shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java b/shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java deleted file mode 100644 index 0f14ce88e876..000000000000 --- a/shenyu-client/shenyu-client-motan/src/test/java/org/apache/shenyu/client/motan/MotanServiceEventListenerTest.java +++ /dev/null @@ -1,278 +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.shenyu.client.motan; - -import com.weibo.api.motan.config.springsupport.BasicServiceConfigBean; -import com.weibo.api.motan.config.springsupport.annotation.MotanService; -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Properties; -import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepositoryFactory; -import org.apache.shenyu.client.motan.common.annotation.ShenyuMotanClient; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.register.common.config.ShenyuClientConfig.ClientPropertiesConfig; -import org.apache.shenyu.register.common.config.ShenyuRegisterCenterConfig; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; -import org.apache.shenyu.register.common.enums.EventType; -import org.jetbrains.annotations.NotNull; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import static org.mockito.BDDMockito.given; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.context.ApplicationContext; -import org.springframework.util.ReflectionUtils; - -/** - * Test for {@link MotanServiceEventListener}. - */ -@ExtendWith(MockitoExtension.class) -public final class MotanServiceEventListenerTest { - - private static final String CONTEXT_PATH = "/motan"; - - private static final String PORT = "8080"; - - private static final String HOST = "127.0.0.1"; - - private static final String USERNAME = "admin"; - - private static final String PASSWORD = "123456"; - - private static final String PATH = "path"; - - private static final String APP_NAME = "appName"; - - private static final String SUPER_PATH_CONTAINS_STAR = "/demo/**"; - - private static final String SUPER_PATH_NOT_CONTAINS_STAR = "/findByIdsAndName"; - - private static final String METHOD_NAME = "buildURIRegisterDTO"; - - private static final String SERVICE_NAME = "java.lang.Comparable"; - - private static final String DESC = "desc"; - - private static final String CONFIG_RULE_NAME = "configRuleName"; - - private static final boolean ENABLED = true; - - @InjectMocks - private MotanServiceEventListener motanServiceEventListener = buildMotanServiceEventListener(); - - @Mock - private ApplicationContext applicationContext; - - @Mock - private ShenyuMotanClient shenyuMotanClient; - - @Mock - private Method method; - - @Mock - private BasicServiceConfigBean basicServiceConfigBean; - - @Test - public void testGetBeans() { - given(applicationContext.getBean(MotanServiceEventListener.BASE_SERVICE_CONFIG)).willReturn(basicServiceConfigBean); - given(basicServiceConfigBean.getGroup()).willReturn("testGroup"); - Map mockBeans = new HashMap<>(); - mockBeans.put("bean1", new Object()); - given(applicationContext.getBeansWithAnnotation(ShenyuMotanClient.class)).willReturn(mockBeans); - Map result = motanServiceEventListener.getBeans(applicationContext); - - assertEquals(mockBeans, result); - verify(applicationContext, times(1)).getBean(MotanServiceEventListener.BASE_SERVICE_CONFIG); - verify(applicationContext, times(1)).getBeansWithAnnotation(ShenyuMotanClient.class); - } - - @Test - public void testBuildURIRegisterDTO() { - URIRegisterDTO expectedURIRegisterDTO = URIRegisterDTO.builder() - .contextPath(CONTEXT_PATH) - .appName(APP_NAME) - .rpcType(RpcTypeEnum.MOTAN.getName()) - .eventType(EventType.REGISTER) - .host(HOST) - .port(Integer.parseInt(PORT)) - .namespaceId(Constants.SYS_DEFAULT_NAMESPACE_ID) - .build(); - Map beans = new HashMap<>(); - URIRegisterDTO realURIRegisterDTO = motanServiceEventListener.buildURIRegisterDTO(applicationContext, beans, Constants.SYS_DEFAULT_NAMESPACE_ID); - - assertEquals(expectedURIRegisterDTO, realURIRegisterDTO); - } - - @Test - public void testBuildApiSuperPathWhenShenyuMotanClientIsNull() { - Class clazz = Class.class; - String realSuperPath = motanServiceEventListener.buildApiSuperPath(clazz, null); - - verify(shenyuMotanClient, times(0)).path(); - assertEquals("", realSuperPath); - } - - @Test - public void testBuildApiSuperPathWhenShenyuMotanClientPathIsEmpty() { - Class clazz = Class.class; - given(shenyuMotanClient.path()).willReturn(""); - String realSuperPath = motanServiceEventListener.buildApiSuperPath(clazz, shenyuMotanClient); - - verify(shenyuMotanClient, times(1)).path(); - assertEquals("", realSuperPath); - } - - @Test - public void testBuildApiSuperPath() { - Class clazz = Class.class; - given(shenyuMotanClient.path()).willReturn(PATH); - String realSuperPath = motanServiceEventListener.buildApiSuperPath(clazz, shenyuMotanClient); - - verify(shenyuMotanClient, times(2)).path(); - assertEquals(PATH, realSuperPath); - } - - @Test - public void testGetAnnotationType() { - Class clazz = motanServiceEventListener.getAnnotationType(); - - assertEquals(ShenyuMotanClient.class, clazz); - } - - @Test - public void testBuildMetaDataDTOForMotan() throws NoSuchMethodException { - given(shenyuMotanClient.desc()).willReturn(DESC); - given(shenyuMotanClient.ruleName()).willReturn(CONFIG_RULE_NAME); - given(shenyuMotanClient.enabled()).willReturn(ENABLED); - given(basicServiceConfigBean.getRequestTimeout()).willReturn(1000); - given(applicationContext.getBean(MotanServiceEventListener.BASE_SERVICE_CONFIG)).willReturn(basicServiceConfigBean); - - final String expectedParameterTypes = "org.springframework.context.ApplicationContext,java.util.Map,java.lang.String"; - final String expectedRpcExt = "{\"methodInfo\":[{\"methodName\":\"buildURIRegisterDTO\"," - + "\"params\":[{\"left\":\"org.springframework.context.ApplicationContext\",\"right\":\"context\"}," - + "{\"left\":\"java.util.Map\",\"right\":\"beans\"},{\"left\":\"java.lang.String\",\"right\":\"namespaceId\"}]}],\"timeout\":1000,\"rpcProtocol\":\"motan2\"}"; - Method method = MotanServiceEventListener.class.getDeclaredMethod(METHOD_NAME, ApplicationContext.class, Map.class, String.class); - - MetaDataRegisterDTO realMetaDataRegisterDTO = motanServiceEventListener.buildMetaDataDTO( - null, - shenyuMotanClient, - SUPER_PATH_NOT_CONTAINS_STAR, - MockMotanServiceClass.class, - method, - Constants.SYS_DEFAULT_NAMESPACE_ID); - - MetaDataRegisterDTO expectedMetaDataRegisterDTO = MetaDataRegisterDTO.builder() - .appName(APP_NAME) - .serviceName(SERVICE_NAME) - .methodName(METHOD_NAME) - .contextPath(CONTEXT_PATH) - .path(SUPER_PATH_NOT_CONTAINS_STAR) - .port(Integer.parseInt(PORT)) - .host(HOST) - .ruleName(CONFIG_RULE_NAME) - .pathDesc(DESC) - .parameterTypes(expectedParameterTypes) - .rpcType(RpcTypeEnum.MOTAN.getName()) - .rpcExt(expectedRpcExt) - .enabled(ENABLED) - .namespaceId(Constants.SYS_DEFAULT_NAMESPACE_ID) - .build(); - - assertEquals(expectedMetaDataRegisterDTO, realMetaDataRegisterDTO); - } - - - - @Test - public void testBuildApiPathSuperPathContainsStar() { - given(method.getName()).willReturn(METHOD_NAME); - String realApiPath = motanServiceEventListener.buildApiPath(method, SUPER_PATH_CONTAINS_STAR, shenyuMotanClient); - String expectedApiPath = "/motan/demo/buildURIRegisterDTO"; - - assertEquals(expectedApiPath, realApiPath); - } - - @Test - public void testBuildApiPathSuperPathNotContainsStar() { - given(shenyuMotanClient.path()).willReturn(PATH); - String realApiPath = motanServiceEventListener.buildApiPath(method, SUPER_PATH_NOT_CONTAINS_STAR, shenyuMotanClient); - String expectedApiPath = "/motan/findByIdsAndName/path"; - - assertEquals(expectedApiPath, realApiPath); - } - - - - private MotanServiceEventListener buildMotanServiceEventListener() { - Properties properties = new Properties(); - properties.setProperty("contextPath", CONTEXT_PATH); - properties.setProperty("port", PORT); - properties.setProperty("host", HOST); - properties.setProperty("username", USERNAME); - properties.setProperty("password", PASSWORD); - properties.setProperty("appName", APP_NAME); - ClientPropertiesConfig config = new ClientPropertiesConfig(); - config.setProps(properties); - - ShenyuRegisterCenterConfig shenyuRegisterCenterConfig = new ShenyuRegisterCenterConfig(); - shenyuRegisterCenterConfig.setServerLists("http://localhost:58080"); - shenyuRegisterCenterConfig.setRegisterType("http"); - shenyuRegisterCenterConfig.setProps(properties); - ShenyuClientConfig clientConfig = new ShenyuClientConfig(); - Map client = new LinkedHashMap<>(); - client.put(RpcTypeEnum.MOTAN.getName(), config); - clientConfig.setClient(client); - return new MotanServiceEventListener(clientConfig, ShenyuClientRegisterRepositoryFactory.newInstance(shenyuRegisterCenterConfig)); - } - - @Test - public void testBuildApiDocSextet() throws NoSuchMethodException { - Method method = MockShenyuMotanClientClass.class.getDeclaredMethod("mockMethod"); - ReflectionUtils.makeAccessible(method); - assertNull(motanServiceEventListener.buildApiDocSextet(method, mock(Annotation.class), Collections.emptyMap())); - } - - @ShenyuMotanClient - private static class MockShenyuMotanClientClass { - public void mockMethod() { - - } - } - - - @MotanService(interfaceClass = Comparable.class) - private class MockMotanServiceClass implements Comparable { - @Override - public int compareTo(@NotNull final Object o) { - return 0; - } - } -} diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java b/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java index c597a6b72e56..5295c8552b8c 100644 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java +++ b/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java @@ -102,21 +102,11 @@ public interface Constants { */ String RPC_RESULT = "rpc_result"; - /** - * The constant MOTAN_RPC_RESULT. - */ - String MOTAN_RPC_RESULT = "motan_rpc_result"; - /** * The constant TARS_RPC_RESULT_EMPTY. */ String TARS_RPC_RESULT_EMPTY = "tars has not return value!"; - /** - * The constant MOTAN_RPC_RESULT_EMPTY. - */ - String MOTAN_RPC_RESULT_EMPTY = "motan has not return value!"; - /** * The constant CLIENT_RESPONSE_RESULT_TYPE. */ diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java deleted file mode 100644 index ead3bf7606b1..000000000000 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java +++ /dev/null @@ -1,193 +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.shenyu.common.dto.convert.plugin; - -import java.io.Serializable; -import java.util.Objects; - -/** - * The type motan register config. - */ -public class MotanRegisterConfig implements Serializable { - - private static final long serialVersionUID = 2488053756247710408L; - - private String registerProtocol; - - private String registerAddress; - - private String threadpool; - - private Integer corethreads; - - private Integer threads; - - private Integer queues; - - /** - * get threadpool. - * - * @return threadpool - */ - public String getThreadpool() { - return threadpool; - } - - /** - * set threadpool. - * - * @param threadpool threadpool - */ - public void setThreadpool(final String threadpool) { - this.threadpool = threadpool; - } - - - /** - * get corethreads. - * - * @return corethreads - */ - public Integer getCorethreads() { - return corethreads; - } - - /** - * set corethreads. - * - * @param corethreads corethreads - */ - public void setCorethreads(final Integer corethreads) { - this.corethreads = corethreads; - } - - /** - * get threads. - * - * @return threads threads - */ - public Integer getThreads() { - return threads; - } - - /** - * set threads. - * - * @param threads threads - */ - public void setThreads(final Integer threads) { - this.threads = threads; - } - - /** - * get queues. - * - * @return queues - */ - public Integer getQueues() { - return queues; - } - - /** - * set queues. - * - * @param queues queues - */ - public void setQueues(final Integer queues) { - this.queues = queues; - } - - /** - * get RegisterProtocol. - * - * @return registerProtocol - */ - public String getRegisterProtocol() { - return registerProtocol; - } - - /** - * set registerProtocol. - * - * @param registerProtocol registerProtocol - */ - public void setRegisterProtocol(final String registerProtocol) { - this.registerProtocol = registerProtocol; - } - - /** - * get RegisterAddress. - * - * @return registerAddress - */ - public String getRegisterAddress() { - return registerAddress; - } - - /** - * set RegisterAddress. - * - * @param registerAddress registerAddress - */ - public void setRegisterAddress(final String registerAddress) { - this.registerAddress = registerAddress; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (Objects.isNull(o) || getClass() != o.getClass()) { - return false; - } - MotanRegisterConfig that = (MotanRegisterConfig) o; - return Objects.equals(registerProtocol, that.registerProtocol) && Objects.equals(registerAddress, that.registerAddress) && Objects.equals(threadpool, that.threadpool) - && Objects.equals(corethreads, that.corethreads) && Objects.equals(threads, that.threads) - && Objects.equals(queues, that.queues); - } - - @Override - public int hashCode() { - return Objects.hash(registerProtocol, registerAddress, threadpool, corethreads, threads, queues); - } - - @Override - public String toString() { - return "MotanRegisterConfig{" - + "registerProtocol='" - + registerProtocol - + '\'' - + ", registerAddress='" - + registerAddress - + '\'' - + ", threadpool='" - + threadpool - + '\'' - + ", corethreads='" - + corethreads - + '\'' - + ", threads='" - + threads - + '\'' - + ", queues='" - + queues - + '\'' - + '}'; - } -} diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/MotanUpstream.java b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/MotanUpstream.java deleted file mode 100644 index 40732fc0c977..000000000000 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/MotanUpstream.java +++ /dev/null @@ -1,274 +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.shenyu.common.dto.convert.selector; - -import java.util.Objects; - -/** - * this is motan upstream. - */ -public final class MotanUpstream extends CommonUpstream { - - /** - * registerAddress. - */ - private String registerAddress; - - /** - * registerProtocol. - */ - private String registerProtocol; - - /** - * builder constructor. - * - * @param builder builder - */ - private MotanUpstream(final Builder builder) { - boolean statusValue = builder.statusValue; - if (!builder.statusSet) { - statusValue = defaultStatus(); - } - setUpstreamHost(builder.upstreamHost); - setProtocol(builder.protocol); - setUpstreamUrl(builder.upstreamUrl); - setStatus(statusValue); - setTimestamp(builder.timestamp); - setRegisterAddress(builder.registerAddress); - setRegisterProtocol(builder.registerProtocol); - } - - /** - * class builder. - * - * @return Builder - */ - public static Builder builder() { - return new Builder(); - } - - /** - * get registerAddress. - * - * @return registerAddress - */ - public String getRegisterAddress() { - return registerAddress; - } - - /** - * set registerAddress. - * - * @param registerAddress registerAddress - */ - public void setRegisterAddress(final String registerAddress) { - this.registerAddress = registerAddress; - } - - /** - * get registerProtocol. - * - * @return registerProtocol - */ - public String getRegisterProtocol() { - return registerProtocol; - } - - /** - * set registerProtocol. - * - * @param registerProtocol registerProtocol - */ - public void setRegisterProtocol(final String registerProtocol) { - this.registerProtocol = registerProtocol; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof MotanUpstream)) { - return false; - } - MotanUpstream that = (MotanUpstream) o; - return Objects.equals(registerAddress, that.registerAddress) - && Objects.equals(this.getProtocol(), that.getProtocol()) - && Objects.equals(this.getUpstreamUrl(), that.getUpstreamUrl()) - && Objects.equals(this.isGray(), that.isGray()) - && Objects.equals(this.registerProtocol, that.registerProtocol); - } - - @Override - public int hashCode() { - return Objects.hash(registerAddress, registerProtocol, this.isGray()); - } - - @Override - public String toString() { - return "MotanUpstream{" - + "registerAddress='" + registerAddress - + ", registerProtocol=" + registerProtocol - + "', protocol='" + this.getProtocol() - + ", upstreamUrl='" + this.getUpstreamUrl() - + "', gray=" + this.isGray() - + ", status=" + isStatus() - + ", timestamp=" + getTimestamp() - + "'}"; - } - - /** - * class builder. - */ - public static final class Builder { - - /** - * upstreamHost. - */ - private String upstreamHost; - - /** - * protocol. - */ - private String protocol; - - /** - * upstreamUrl. - */ - private String upstreamUrl; - - /** - * status. - */ - private boolean statusSet; - - /** - * status. - */ - private boolean statusValue; - - /** - * timestamp. - */ - private long timestamp; - - /** - * registerAddress. - */ - private String registerAddress; - - /** - * registerProtocol. - */ - private String registerProtocol; - - /** - * no args constructor. - */ - private Builder() { - } - - /** - * build new Object. - * - * @return DivideUpstream - */ - public MotanUpstream build() { - return new MotanUpstream(this); - } - - /** - * build upstreamHost. - * - * @param upstreamHost upstreamHost - * @return this - */ - public Builder upstreamHost(final String upstreamHost) { - this.upstreamHost = upstreamHost; - return this; - } - - /** - * build protocol. - * - * @param protocol protocol - * @return this - */ - public Builder protocol(final String protocol) { - this.protocol = protocol; - return this; - } - - /** - * build upstreamUrl. - * - * @param upstreamUrl upstreamUrl - * @return this - */ - public Builder upstreamUrl(final String upstreamUrl) { - this.upstreamUrl = upstreamUrl; - return this; - } - - /** - * build status. - * - * @param status status - * @return this - */ - public Builder status(final boolean status) { - this.statusValue = status; - this.statusSet = true; - return this; - } - - /** - * build timestamp. - * - * @param timestamp timestamp - * @return this - */ - public Builder timestamp(final long timestamp) { - this.timestamp = timestamp; - return this; - } - - /** - * build registerAddress. - * - * @param registerAddress registerAddress - * @return this - */ - public Builder registerAddress(final String registerAddress) { - this.registerAddress = registerAddress; - return this; - } - - /** - * build registerAddress. - * - * @param registerProtocol registerProtocol - * @return this - */ - public Builder registerProtocol(final String registerProtocol) { - this.registerProtocol = registerProtocol; - return this; - } - } - -} diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/enums/PluginEnum.java b/shenyu-common/src/main/java/org/apache/shenyu/common/enums/PluginEnum.java index 0ef7c419b8f8..0a7d9b5210f9 100644 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/enums/PluginEnum.java +++ b/shenyu-common/src/main/java/org/apache/shenyu/common/enums/PluginEnum.java @@ -262,11 +262,6 @@ public enum PluginEnum { */ GRPC(310, 0, "grpc"), - /** - * Motan plugin enum. - */ - MOTAN(310, 0, "motan"), - /** * Cryptor response plugin enum. */ diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/enums/RpcTypeEnum.java b/shenyu-common/src/main/java/org/apache/shenyu/common/enums/RpcTypeEnum.java index 2db75d9d19fa..e4120b08734d 100644 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/enums/RpcTypeEnum.java +++ b/shenyu-common/src/main/java/org/apache/shenyu/common/enums/RpcTypeEnum.java @@ -58,11 +58,6 @@ public enum RpcTypeEnum { */ SPRING_CLOUD("springCloud", true), - /** - * motan. - */ - MOTAN("motan", true), - /** * grpc. */ @@ -136,7 +131,7 @@ public static List acquireSupportURIs() { * @return operator support. */ public static List acquireSupportMetadatas() { - return Arrays.asList(RpcTypeEnum.HTTP, RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.SPRING_CLOUD, RpcTypeEnum.SOFA, RpcTypeEnum.TARS, RpcTypeEnum.MOTAN); + return Arrays.asList(RpcTypeEnum.HTTP, RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.SPRING_CLOUD, RpcTypeEnum.SOFA, RpcTypeEnum.TARS); } /** diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/PluginNameAdapter.java b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/PluginNameAdapter.java index eed57b7b7cf7..9cbf6c17717b 100644 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/PluginNameAdapter.java +++ b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/PluginNameAdapter.java @@ -46,8 +46,6 @@ public static String rpcTypeAdapter(final String rpcType) { return PluginEnum.SOFA.getName(); case WEB_SOCKET: return PluginEnum.WEB_SOCKET.getName(); - case MOTAN: - return PluginEnum.MOTAN.getName(); case MCP: return PluginEnum.MCP_SERVER.getName(); case HTTP: diff --git a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.java b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.java deleted file mode 100644 index 8471d2d9b78f..000000000000 --- a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.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.shenyu.common.dto.convert.plugin; - -import com.google.common.collect.ImmutableSet; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.core.Is.is; - -/** - * Test case for MotanRegisterConfig. - */ -public class MotanRegisterConfigTest { - - @Test - public void testGetterSetter() { - MotanRegisterConfig config = new MotanRegisterConfig(); - config.setRegisterAddress("reg"); - config.setRegisterProtocol("zk"); - config.setCorethreads(10); - config.setThreads(10); - config.setQueues(2); - - assertThat(config.getRegisterAddress(), is("reg")); - assertThat(config.getRegisterProtocol(), is("zk")); - assertThat(config.getCorethreads(), is(10)); - assertThat(config.getThreads(), is(10)); - assertThat(config.getQueues(), is(2)); - } - - @Test - public void testEqualsAndHashCode() { - MotanRegisterConfig config1 = new MotanRegisterConfig(); - MotanRegisterConfig config2 = new MotanRegisterConfig(); - - assertThat(ImmutableSet.of(config1, config2), hasSize(1)); - } - -} diff --git a/shenyu-common/src/test/java/org/apache/shenyu/common/enums/RpcTypeEnumTest.java b/shenyu-common/src/test/java/org/apache/shenyu/common/enums/RpcTypeEnumTest.java index affdba8a1303..fbe83b651762 100644 --- a/shenyu-common/src/test/java/org/apache/shenyu/common/enums/RpcTypeEnumTest.java +++ b/shenyu-common/src/test/java/org/apache/shenyu/common/enums/RpcTypeEnumTest.java @@ -34,7 +34,6 @@ public void testGetName() { assertEquals("grpc", RpcTypeEnum.GRPC.getName()); assertEquals("dubbo", RpcTypeEnum.DUBBO.getName()); assertEquals("http", RpcTypeEnum.HTTP.getName()); - assertEquals("motan", RpcTypeEnum.MOTAN.getName()); assertEquals("sofa", RpcTypeEnum.SOFA.getName()); assertEquals("springCloud", RpcTypeEnum.SPRING_CLOUD.getName()); assertEquals("tars", RpcTypeEnum.TARS.getName()); @@ -46,7 +45,6 @@ public void testSupport() { assertTrue(RpcTypeEnum.GRPC.getSupport()); assertTrue(RpcTypeEnum.DUBBO.getSupport()); assertTrue(RpcTypeEnum.HTTP.getSupport()); - assertTrue(RpcTypeEnum.MOTAN.getSupport()); assertTrue(RpcTypeEnum.SOFA.getSupport()); assertTrue(RpcTypeEnum.TARS.getSupport()); assertTrue(RpcTypeEnum.WEB_SOCKET.getSupport()); diff --git a/shenyu-dist/shenyu-admin-dist/src/main/release-docs/README.txt b/shenyu-dist/shenyu-admin-dist/src/main/release-docs/README.txt index 184f3422489c..d81fb12e50c7 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/release-docs/README.txt +++ b/shenyu-dist/shenyu-admin-dist/src/main/release-docs/README.txt @@ -3,7 +3,7 @@ Welcome to Apache ShenYu Apache ShenYu is an asynchronous, high-performance, cross-language, responsive API gateway. -* Support various languages (http protocol), support Dubbo, Spring-Cloud, Grpc, Motan, Sofa, Tars and other protocols. +* Support various languages (http protocol), support Dubbo, Spring-Cloud, Grpc, Sofa, Tars and other protocols. * Plugin design idea, plugin hot swap, easy to expand. * Flexible flow filtering to meet various flow control. * Built-in rich plugin support, authentication, limiting, fuse, firewall, etc. diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE index b44296f94bf4..eb028a3a5094 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE @@ -367,10 +367,6 @@ The text of each license is the standard Apache 2.0 license. lz4-java 1.8.0: https://github.com/jpountz/lz4-java, Apache 2.0 metrics-core 3.0.1: https://mvnrepository.com/artifact/com.codahale.metrics/metrics-core, Apache 2.0 micrometer-core 1.13.1: https://github.com/micrometer-metrics/micrometer, Apache 2.0 - motan-core 1.2.1: https://github.com/weibocom/motan, Apache 2.0 - motan-transport-netty4 1.2.1: https://github.com/weibocom/motan, Apache 2.0 - motan-registry-zookeeper 1.2.1: https://github.com/weibocom/motan, Apache 2.0 - motan-springsupport 1.2.1: https://github.com/weibocom/motan, Apache 2.0 micrometer-observation 1.13.1: https://mvnrepository.com/artifact/io.micrometer/micrometer-observation, Apache 2.0 micrometer-jakarta9 1.13.1: https://mvnrepository.com/artifact/io.micrometer/micrometer-jakarta9, Apache 2.0 micrometer-commons 1.13.1: https://mvnrepository.com/artifact/io.micrometer/micrometer-commons, Apache 2.0 diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/README.txt b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/README.txt index 184f3422489c..d81fb12e50c7 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/README.txt +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/README.txt @@ -3,7 +3,7 @@ Welcome to Apache ShenYu Apache ShenYu is an asynchronous, high-performance, cross-language, responsive API gateway. -* Support various languages (http protocol), support Dubbo, Spring-Cloud, Grpc, Motan, Sofa, Tars and other protocols. +* Support various languages (http protocol), support Dubbo, Spring-Cloud, Grpc, Sofa, Tars and other protocols. * Plugin design idea, plugin hot swap, easy to expand. * Flexible flow filtering to meet various flow control. * Built-in rich plugin support, authentication, limiting, fuse, firewall, etc. diff --git a/shenyu-e2e/shenyu-e2e-case/pom.xml b/shenyu-e2e/shenyu-e2e-case/pom.xml index a181b2d04c0d..129ad6d09741 100644 --- a/shenyu-e2e/shenyu-e2e-case/pom.xml +++ b/shenyu-e2e/shenyu-e2e-case/pom.xml @@ -37,7 +37,6 @@ shenyu-e2e-case-spring-cloud shenyu-e2e-case-apache-dubbo shenyu-e2e-case-sofa - shenyu-e2e-case-motan shenyu-e2e-case-grpc shenyu-e2e-case-websocket diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml deleted file mode 100644 index b3f4f52920cc..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - shenyu-e2e-case - org.apache.shenyu - 0.0.1-SNAPSHOT - - 4.0.0 - - shenyu-e2e-case-motan - - diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java deleted file mode 100644 index ff9793a2ecab..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java +++ /dev/null @@ -1,353 +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.shenyu.e2e.testcase.motan; - -import com.google.common.collect.Lists; -import io.restassured.http.Method; -import org.apache.shenyu.e2e.engine.scenario.ShenYuScenarioProvider; -import org.apache.shenyu.e2e.engine.scenario.specification.ScenarioSpec; -import org.apache.shenyu.e2e.engine.scenario.specification.ShenYuAfterEachSpec; -import org.apache.shenyu.e2e.engine.scenario.specification.ShenYuBeforeEachSpec; -import org.apache.shenyu.e2e.engine.scenario.specification.ShenYuCaseSpec; -import org.apache.shenyu.e2e.engine.scenario.specification.ShenYuScenarioSpec; -import org.apache.shenyu.e2e.model.Plugin; -import org.apache.shenyu.e2e.model.data.Condition; -import org.apache.shenyu.e2e.model.handle.DivideRuleHandle; - -import java.util.List; - -import static org.apache.shenyu.e2e.engine.scenario.function.HttpCheckers.exists; -import static org.apache.shenyu.e2e.engine.scenario.function.HttpCheckers.notExists; -import static org.apache.shenyu.e2e.template.ResourceDataTemplate.newCondition; -import static org.apache.shenyu.e2e.template.ResourceDataTemplate.newConditions; -import static org.apache.shenyu.e2e.template.ResourceDataTemplate.newRuleBuilder; -import static org.apache.shenyu.e2e.template.ResourceDataTemplate.newSelectorBuilder; - -public class MotanPluginCases implements ShenYuScenarioProvider { - - @Override - public List get() { - return Lists.newArrayList( - testWithUriEquals(), - testWithUriPathPattern(), - testWithUriStartWith(), - testWithEndWith(), - testWithMethodGet(), - testWithMethodPost(), - testWithMethodPut(), - testWithMethodDelete() - ); - } - - /** - * test with uri equal. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithUriEquals() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri =]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi")) - .handle(DivideRuleHandle.builder().timeout(100000).retry(10).build()) - .build() - ) - .checker(notExists("/motan/demo/hi")) - .waiting(exists("/motan/demo/hi")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists("/motan/demo/hi") - .addNotExists("/motan/demo/h") - .addNotExists("/put") - .addNotExists("/get") - .build() - ) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) - .build(); - } - - /** - * test with uri path pattern. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithUriPathPattern() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri path_pattern]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.PATH_PATTERN, "/motan/demo/**")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.PATH_PATTERN, "/motan/demo/**")) - .build() - ) - .checker(notExists("/motan/demo/hi")) - .waiting(exists("/motan/demo/hi")) - .build() - ).caseSpec( - ShenYuCaseSpec.builder() - .addExists("/motan/demo/hi") - .addNotExists("/motan/de") - .addExists(Method.POST, "/motan/demo/hi") - .addExists(Method.PUT, "/motan/demo/hi") - .addExists(Method.DELETE, "/motan/demo/hi") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) - .build(); - } - - /** - * test with uri start with. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithUriStartWith() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri starts_with]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.STARTS_WITH, "/motan/")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.STARTS_WITH, "/motan/")) - .build() - ) - .checker(notExists("/motan/demo/hi")) - .waiting(exists("/motan/demo/hi")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists("/motan/demo/hi") - .addNotExists("/mota/") - .addExists(Method.POST, "/motan/demo/hi") - .addExists(Method.PUT, "/motan/demo/hi") - .addExists(Method.DELETE, "/motan/demo/hi") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) - .build(); - } - - /** - * test with uri end with. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithEndWith() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri ends_with]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.ENDS_WITH, "/hi")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.ENDS_WITH, "/hi")) - .build() - ) - .checker(notExists("/motan/demo/hi")) - .waiting(exists("/motan/demo/hi")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists("/motan/demo/hi") - .addNotExists("/motan/demo/h") - .addExists(Method.POST, "/motan/demo/hi") - .addExists(Method.PUT, "/motan/demo/hi") - .addExists(Method.DELETE, "/motan/demo/hi") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) - .build(); - } - - /** - * test with uri method get. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodGet() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri method GET]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "GET"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "GET"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build() - ) - .checker(notExists(Method.GET, "/motan/demo/hi")) - .waiting(exists(Method.GET, "/motan/demo/hi")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.GET, "/motan/demo/hi") - .addNotExists(Method.GET, "/motan/demo/h") - .addNotExists(Method.POST, "/motan/demo/hi") - .addNotExists(Method.PUT, "/motan/demo/hi") - .addNotExists(Method.DELETE, "/motan/demo/hi") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/motan/demo/hi")).build()) - .build(); - } - - /** - * test with uri method post. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodPost() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri method POST]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "POST"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "POST"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build() - ) - .checker(notExists(Method.POST, "/motan/demo/hi")) - .waiting(exists(Method.POST, "/motan/demo/hi")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.POST, "/motan/demo/hi") - .addNotExists(Method.POST, "/motan/demo/h") - .addNotExists(Method.GET, "/motan/demo/hi") - .addNotExists(Method.PUT, "/motan/demo/hi") - .addNotExists(Method.DELETE, "/motan/demo/hi") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/motan/demo/hi")).build()) - .build(); - } - - /** - * test with uri method put. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodPut() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri method PUT]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "PUT"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "PUT"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build() - ) - .checker(notExists(Method.PUT, "/motan/demo/hi")) - .waiting(exists(Method.PUT, "/motan/demo/hi")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.PUT, "/motan/demo/hi") - .addNotExists(Method.PUT, "/motan/demo/h") - .addNotExists(Method.GET, "/motan/demo/hi") - .addNotExists(Method.POST, "/motan/demo/hi") - .addNotExists(Method.DELETE, "/motan/demo/hi") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/motan/demo/hi")).build()) - .build(); - } - - - /** - * test with uri method delete. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodDelete() { - return ShenYuScenarioSpec.builder() - .name("single-motan uri method DELETE]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.MOTAN) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "DELETE"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "DELETE"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/motan/demo/hi") - )) - .build() - ) - .checker(notExists(Method.DELETE, "/motan/demo/hi")) - .waiting(exists(Method.DELETE, "/motan/demo/hi")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.DELETE, "/motan/demo/hi") - .addNotExists(Method.DELETE, "/motan/demo/h") - .addNotExists(Method.GET, "/motan/demo/hi") - .addNotExists(Method.POST, "/motan/demo/hi") - .addNotExists(Method.PUT, "/motan/demo/hi") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/motan/demo/hi")).build()) - .build(); - } -} diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java deleted file mode 100644 index 172faa82415c..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java +++ /dev/null @@ -1,140 +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.shenyu.e2e.testcase.motan; -// -//import io.restassured.RestAssured; -//import io.restassured.parsing.Parser; -//import org.apache.shenyu.e2e.client.WaitDataSync; -//import org.apache.shenyu.e2e.client.admin.AdminClient; -//import org.apache.shenyu.e2e.client.gateway.GatewayClient; -//import org.apache.shenyu.e2e.engine.annotation.ShenYuScenario; -//import org.apache.shenyu.e2e.engine.annotation.ShenYuTest; -//import org.apache.shenyu.e2e.engine.config.ShenYuEngineConfigure; -//import org.apache.shenyu.e2e.engine.scenario.specification.AfterEachSpec; -//import org.apache.shenyu.e2e.engine.scenario.specification.BeforeEachSpec; -//import org.apache.shenyu.e2e.engine.scenario.specification.CaseSpec; -//import org.apache.shenyu.e2e.model.ResourcesData; -//import org.apache.shenyu.e2e.model.response.SelectorDTO; -//import org.junit.jupiter.api.AfterAll; -//import org.junit.jupiter.api.AfterEach; -//import org.junit.jupiter.api.Assertions; -//import org.junit.jupiter.api.BeforeAll; -//import org.junit.jupiter.api.BeforeEach; -//import org.springframework.util.LinkedMultiValueMap; -//import org.springframework.util.MultiValueMap; -//import org.testcontainers.shaded.com.google.common.collect.Lists; -// -//import java.util.List; -// -//@ShenYuTest( -// mode = ShenYuEngineConfigure.Mode.DOCKER, -// services = { -// @ShenYuTest.ServiceConfigure( -// serviceName = "admin", -// port = 9095, -// baseUrl = "http://{hostname:localhost}:9095", -// parameters = { -// @ShenYuTest.Parameter(key = "username", value = "admin"), -// @ShenYuTest.Parameter(key = "password", value = "123456"), -// @ShenYuTest.Parameter(key = "dataSyn", value = "admin_websocket") -// } -// ), -// @ShenYuTest.ServiceConfigure( -// serviceName = "gateway", -// port = 9195, -// baseUrl = "http://{hostname:localhost}:9195", -// type = ShenYuEngineConfigure.ServiceType.SHENYU_GATEWAY, -// parameters = { -// @ShenYuTest.Parameter(key = "dataSyn", value = "gateway_websocket") -// } -// ) -// }, -// dockerComposeFile = "classpath:./docker-compose.mysql.yml" -//) -///** -// * Testing spring-cloud plugin. -// */ -//public class MotanPluginTest { -// private List selectorIds = Lists.newArrayList(); -// -// @BeforeAll -// static void setup(final AdminClient adminClient, final GatewayClient gatewayClient) throws Exception { -// adminClient.login(); -// WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllRules, gatewayClient::getRuleCache, adminClient); -// adminClient.syncPluginAll(); -// WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllSelectors, gatewayClient::getSelectorCache, adminClient); -// WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllMetaData, gatewayClient::getMetaDataCache, adminClient); -// WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllRules, gatewayClient::getRuleCache, adminClient); -// -// MultiValueMap formData = new LinkedMultiValueMap<>(); -// formData.add("id", "17"); -// formData.add("name", "motan"); -// formData.add("enabled", "true"); -// formData.add("role", "Proxy"); -// formData.add("sort", "310"); -// formData.add("config", "{\"registerProtocol\":\"zk\", \"registerAddress\":\"zookeeper:2181\"}"); -// adminClient.changePluginStatus("17", formData); -// adminClient.deleteAllSelectors(); -// List selectorDTOList = adminClient.listAllSelectors(); -// Assertions.assertEquals(0, selectorDTOList.size()); -// RestAssured.registerParser("text/plain", Parser.JSON); -// } -// -// @BeforeEach -// void before(final AdminClient client, final GatewayClient gateway, final BeforeEachSpec spec) { -// spec.getChecker().check(gateway); -// -// ResourcesData resources = spec.getResources(); -// for (ResourcesData.Resource res : resources.getResources()) { -// SelectorDTO dto = client.create(res.getSelector()); -// selectorIds.add(dto.getId()); -// -// res.getRules().forEach(rule -> { -// rule.setSelectorId(dto.getId()); -// client.create(rule); -// }); -// } -// -// spec.getWaiting().waitFor(gateway); -// } -// -// @ShenYuScenario(provider = MotanPluginCases.class) -// void testMotan(final GatewayClient gateway, final CaseSpec spec) { -// spec.getVerifiers().forEach(verifier -> verifier.verify(gateway.getHttpRequesterSupplier().get())); -// } -// -// @AfterEach -// void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { -// spec.getDeleter().delete(client, selectorIds); -// spec.deleteWaiting().waitFor(gateway); -// selectorIds = Lists.newArrayList(); -// } -// -// @AfterAll -// static void teardown(final AdminClient client) { -// client.deleteAllSelectors(); -// MultiValueMap formData = new LinkedMultiValueMap<>(); -// formData.add("id", "17"); -// formData.add("name", "motan"); -// formData.add("enabled", "false"); -// formData.add("role", "Proxy"); -// formData.add("sort", "310"); -// client.changePluginStatus("17", formData); -// } -//} - diff --git a/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java b/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java index 991748bd4f4d..2339b04c42b5 100644 --- a/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java +++ b/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java @@ -50,7 +50,6 @@ public enum Plugin { CONTEXT_PATH("contextPath", 14), GRPC("grpc", 15), REDIRECT("redirect", 16), - MOTAN("motan", 17), LOGGING_CONSOLE("loggingConsole", 18), JWT("jwt", 19), REQUEST("request", 20), diff --git a/shenyu-examples/pom.xml b/shenyu-examples/pom.xml index 1718fadd4d61..1c315d57fda7 100644 --- a/shenyu-examples/pom.xml +++ b/shenyu-examples/pom.xml @@ -52,7 +52,6 @@ shenyu-examples-sofa shenyu-examples-tars shenyu-examples-grpc - shenyu-examples-motan shenyu-examples-plugin shenyu-examples-websocket shenyu-examples-springmvc diff --git a/shenyu-examples/shenyu-examples-motan/pom.xml b/shenyu-examples/shenyu-examples-motan/pom.xml deleted file mode 100644 index c3ce2c21c5f6..000000000000 --- a/shenyu-examples/shenyu-examples-motan/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-examples - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-examples-motan - pom - - shenyu-examples-motan-service - shenyu-examples-motan-api - - - diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/pom.xml b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/pom.xml deleted file mode 100644 index 2eedbe6485b7..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-examples-motan - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-examples-motan-api - - - 1.2.1 - - - - - com.weibo - motan-core - ${motan.version} - - - - com.weibo - motan-transport-netty4 - ${motan.version} - - - - com.weibo - motan-springsupport - ${motan.version} - - - - com.weibo - motan-registry-zookeeper - ${motan.version} - - - - - shenyu-examples-motan-api - - - org.codehaus.mojo - build-helper-maven-plugin - 1.10 - - - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/annotations - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.7.0 - - ${java.version} - ${java.version} - ${project.build.sourceEncoding} - -proc:none - - - - process-annotations - generate-sources - - compile - - - true - - - - - - - diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanClassDemoService.java b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanClassDemoService.java deleted file mode 100644 index c7a378abbe00..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanClassDemoService.java +++ /dev/null @@ -1,58 +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.shenyu.examples.motan.service; - -import com.weibo.api.motan.transport.async.MotanAsync; - -import java.util.List; - -/** - * Motan class demo interface. - */ -@MotanAsync -public interface MotanClassDemoService { - - /** - * hello demo for Motan. - * @param name the name to hello - * @return response - */ - String hello(String name); - - /** - * timeout for Motan. - * @param seconds seconds to timeout - * @return response - */ - String testTimeOut(long seconds); - - /** - * pojo as a parameter for test generalized call. - * @param motanTest pojo - * @return the motanTest - */ - MotanTest save(MotanTest motanTest); - - /** - * List pojo as a parameter for test generalized call. - * Unfortunately, motan doesn't support this right now. - * @param motanTestList pojo list - * @return the motanTest - */ - MotanTest batchSave(List motanTestList); -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java deleted file mode 100644 index 05e70210e154..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanDemoService.java +++ /dev/null @@ -1,47 +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.shenyu.examples.motan.service; - -import com.weibo.api.motan.transport.async.MotanAsync; - -/** - * Motan demo interface. - */ -@MotanAsync -public interface MotanDemoService { - - /** - * hi demo for Motan. - * @return response - */ - String hi(); - - /** - * hello demo for Motan. - * @param name the name to hello - * @return response - */ - String hello(String name); - - /** - * timeout for Motan. - * @param seconds seconds to timeout - * @return response - */ - String testTimeOut(long seconds); -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanTest.java b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanTest.java deleted file mode 100644 index 9bd3484f7a1c..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-api/src/main/java/org/apache/shenyu/examples/motan/service/MotanTest.java +++ /dev/null @@ -1,84 +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.shenyu.examples.motan.service; - -import java.io.Serializable; -import java.util.StringJoiner; - -/** - * MotanTest. - */ -public class MotanTest implements Serializable { - - private String id; - - private String name; - - public MotanTest() { - } - - public MotanTest(final String id, final String name) { - this.id = id; - this.name = name; - } - - /** - * Get id. - * - * @return id - */ - public String getId() { - return id; - } - - /** - * Set id. - * - * @param id id - */ - public void setId(final String id) { - this.id = id; - } - - /** - * Get name. - * - * @return name - */ - public String getName() { - return name; - } - - /** - * Set name. - * - * @param name name - */ - public void setName(final String name) { - this.name = name; - } - - @Override - public String toString() { - return new StringJoiner(", ", MotanTest.class.getSimpleName() + "[", "]") - .add("id='" + id + "'") - .add("name='" + name + "'") - .toString(); - } - -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/Dockerfile b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/Dockerfile deleted file mode 100644 index 0bac119f948b..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/Dockerfile +++ /dev/null @@ -1,30 +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. - -FROM eclipse-temurin:17-centos7 - -ENV APP_NAME shenyu-examples-motan -ENV LOCAL_PATH /opt/${APP_NAME} - -RUN mkdir -p ${LOCAL_PATH} - -ADD target/${APP_NAME}.jar ${LOCAL_PATH} - -WORKDIR ${LOCAL_PATH} -EXPOSE 8081 -EXPOSE 8002 - -CMD java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED -jar ${APP_NAME}.jar diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/ingress.yml b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/ingress.yml deleted file mode 100644 index 8fbd4aeac243..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/ingress.yml +++ /dev/null @@ -1,89 +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. - -apiVersion: v1 -kind: Service -metadata: - name: motan-demo-hello - namespace: shenyu-ingress - annotations: - kubernetes.io/ingress.class: shenyu - shenyu.apache.org/plugin-motan-enabled: 'true' - shenyu.apache.org/plugin-motan-app-name: motan - shenyu.apache.org/plugin-motan-path: /demo/hello - shenyu.apache.org/plugin-motan-rpc-type: motan - shenyu.apache.org/plugin-motan-service-name: org.apache.shenyu.examples.motan.service.MotanDemoService - shenyu.apache.org/plugin-motan-method-name: hello - shenyu.apache.org/plugin-motan-params-type: java.lang.String - shenyu.apache.org/plugin-motan-rpc-expand: | - {"methodInfo":[{"methodName":"hello","params":[{"left":"java.lang.String","right":"name"}]}],"group":"motan-shenyu-rpc","timeout":2000,"rpcProtocol":"motan2"} - shenyu.apache.org/zookeeper-register-address: shenyu-zk:2181 -spec: - selector: - app: shenyu-examples-motan-service - ports: - - port: 8081 # Assuming this is the motan service port - ---- - -apiVersion: v1 -kind: Service -metadata: - name: motan-demo-test-hello - namespace: shenyu-ingress - annotations: - kubernetes.io/ingress.class: shenyu - shenyu.apache.org/plugin-motan-enabled: 'true' - shenyu.apache.org/plugin-motan-app-name: motan - shenyu.apache.org/plugin-motan-path: /demoTest/hello - shenyu.apache.org/plugin-motan-rpc-type: motan - shenyu.apache.org/plugin-motan-service-name: org.apache.shenyu.examples.motan.service.MotanDemoService - shenyu.apache.org/plugin-motan-method-name: hello - shenyu.apache.org/plugin-motan-params-type: java.lang.String - shenyu.apache.org/zookeeper-register-address: shenyu-zk:2181 - shenyu.apache.org/plugin-motan-rpc-expand: | - {"methodInfo":[{"methodName":"hello","params":[{"left":"java.lang.String","right":"name"}]}],"group":"motan-shenyu-rpc","timeout":2000,"rpcProtocol":"motan2"} -spec: - selector: - app: shenyu-examples-motan-service - ports: - - port: 8081 # Assuming this is the motan service port - ---- - -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - namespace: shenyu-ingress - labels: - shenyu.apache.org/metadata-labels-1: motan-demo-hello - shenyu.apache.org/metadata-labels-2: motan-demo-test-hello - annotations: - kubernetes.io/ingress.class: shenyu - shenyu.apache.org/plugin-motan-enabled: 'true' - shenyu.apache.org/zookeeper-register-address: shenyu-zk:2181 - name: demo-ingress -spec: - rules: - - http: - paths: - - backend: - service: - name: shenyu-examples-motan-service - port: - number: 8081 - path: /** - pathType: ImplementationSpecific diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-examples-motan.yml b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-examples-motan.yml deleted file mode 100644 index 2efb85093673..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-examples-motan.yml +++ /dev/null @@ -1,88 +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. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: shenyu-examples-motan-deployment - namespace: shenyu-ingress - labels: - app: shenyu-examples-motan - all: shenyu-examples-motan -spec: - replicas: 1 - selector: - matchLabels: - app: shenyu-examples-motan - all: shenyu-examples-motan - strategy: {} - template: - metadata: - namespace: shenyu-ingress - labels: - app: shenyu-examples-motan - all: shenyu-examples-motan - spec: - containers: - - image: shenyu-examples-motan - name: shenyu-examples-motan - livenessProbe: - exec: - command: - - /bin/sh - - "-c" - - wget -q -O - http://localhost:8081/actuator/health | grep UP || exit 1 - initialDelaySeconds: 10 - failureThreshold: 3 - timeoutSeconds: 2 - env: - - name: shenyu.register.serverLists - value: http://shenyu-admin:9095 - - name: motan.registry.protocol - value: zookeeper - - name: motan.registry.address - value: shenyu-zk:2181 - ports: - - containerPort: 8081 - imagePullPolicy: IfNotPresent - restartPolicy: Always -status: {} - ---- -apiVersion: v1 -kind: Service -metadata: - name: shenyu-examples-motan-service - namespace: shenyu-ingress - labels: - app: shenyu-examples-motan - all: shenyu-examples-motan -spec: - selector: - app: shenyu-examples-motan - all: shenyu-examples-motan - type: NodePort - ports: - - name: "8081" - port: 8081 - targetPort: 8081 - nodePort: 31193 - - name: "8082" - port: 8082 - targetPort: 8082 - nodePort: 31191 -status: - loadBalancer: {} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-zookeeper.yml b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-zookeeper.yml deleted file mode 100644 index ae25109d5d5f..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-zookeeper.yml +++ /dev/null @@ -1,81 +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. - -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: shenyu-ingress - labels: - app: shenyu-zk - all: shenyu-examples-motan - name: shenyu-zk -spec: - replicas: 1 - selector: - matchLabels: - app: shenyu-zk - all: shenyu-examples-motan - strategy: {} - template: - metadata: - namespace: shenyu-ingress - labels: - app: shenyu-zk - all: shenyu-examples-motan - spec: - containers: - - image: zookeeper:3.9 - name: shenyu-zk - resources: {} - ports: - - containerPort: 2181 - name: client - - containerPort: 2888 - name: server - - containerPort: 3888 - name: leader-election - - containerPort: 8080 - name: website - restartPolicy: Always -status: {} - ---- -apiVersion: v1 -kind: Service -metadata: - name: shenyu-zk - namespace: shenyu-ingress - labels: - app: shenyu-zk - all: shenyu-examples-motan -spec: - type: NodePort - selector: - app: shenyu-zk - all: shenyu-examples-motan - ports: - - name: "client" - port: 2181 - targetPort: 2181 - - name: "server" - port: 2888 - targetPort: 2888 - - name: "election" - port: 3888 - targetPort: 3888 - - name: "website" - port: 8080 - targetPort: 8080 diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/pom.xml b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/pom.xml deleted file mode 100644 index d826bc80a3b9..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/pom.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-examples-motan - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-examples-motan-service - - - 3.7.2 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - - - org.apache.shenyu - shenyu-examples-common - ${project.version} - - - org.springframework - spring-context - - - org.apache.shenyu - shenyu-examples-motan-api - ${project.version} - - - zookeeper - org.apache.zookeeper - - - - - zookeeper - org.apache.zookeeper - ${zookeeper.version} - - - org.apache.shenyu - shenyu-spring-boot-starter-client-motan - ${project.version} - - - - - shenyu-examples-motan - - - org.springframework.boot - spring-boot-maven-plugin - - org.apache.shenyu.examples.motan.service.TestMotanApplication - true - - - - - - - - example - - shenyu-examples-motan - shenyu-examples-motan - latest - - - false - - - - - io.fabric8 - docker-maven-plugin - ${docker-maven-plugin.version} - - - - shenyu-examples-motan - - ${project.basedir} - - - - - - - start - - build - - - - - - - - - diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-class-test-api.http b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-class-test-api.http deleted file mode 100644 index 6d8848002122..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-class-test-api.http +++ /dev/null @@ -1,49 +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. -# - - -### shengyu getway proxy hello -GET http://localhost:9195/motan/demoTest/hello -Accept: application/json -Content-Type: application/json - -{ - "name": "order" -} - -### shengyu getway proxy timeout -GET http://localhost:9195/motan/demoTest/testTimeOut -Accept: application/json -Content-Type: application/json - -{ - "timeout": "1" -} - - -### shengyu getway proxy save -POST http://localhost:9195/motan/demoTest/save -Accept: application/json -Content-Type: application/json - -{ - "motanTest": - { - "id": "999", - "name": "dinglang" - } -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-test-api.http b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-test-api.http deleted file mode 100644 index 5fc856508eec..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/http/motan-test-api.http +++ /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. -# - - -### shengyu getway proxy hello -GET http://localhost:9195/motan/demo/hello -Accept: application/json -Content-Type: application/json - -{ - "name": "order" -} - -### shengyu getway proxy timeout -GET http://localhost:9195/motan/demo/testTimeOut -Accept: application/json -Content-Type: application/json - -{ - "timeout": "1" -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/TestMotanApplication.java b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/TestMotanApplication.java deleted file mode 100644 index c1b6ecd8f0b3..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/TestMotanApplication.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.shenyu.examples.motan.service; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * Motan service starter. - */ -@SpringBootApplication -public class TestMotanApplication { - - /** - * Main Entrance. - * - * @param args startup arguments - */ - public static void main(final String[] args) { - SpringApplication.run(TestMotanApplication.class, args); - } -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java deleted file mode 100644 index 51a28d534295..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java +++ /dev/null @@ -1,69 +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.shenyu.examples.motan.service.impl; - -import org.apache.shenyu.client.motan.common.annotation.ShenyuMotanService; -import org.apache.shenyu.examples.motan.service.MotanClassDemoService; -import org.apache.shenyu.examples.motan.service.MotanTest; -import org.apache.shenyu.springboot.starter.client.motan.ShenyuMotanClientConfiguration; -import org.springframework.lang.NonNull; - -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * Motan Class demo service. - * - *

Default motan service name is "motan2", If you want to inject other services, - * please refer to {@link ShenyuMotanClientConfiguration} - */ -@ShenyuMotanService(value = "/demoTest/**", export = "motan2:8002") -public class MotanClassDemoServiceImpl implements MotanClassDemoService { - - @Override - public String hello(final String name) { - return "hello " + name; - } - - @Override - public String testTimeOut(final long seconds) { - try { - Thread.sleep(seconds * 1000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - return "hello seconds " + seconds + "s"; - } - - @Override - public MotanTest save(final MotanTest motanTest) { - return motanTest; - } - - @Override - public MotanTest batchSave(final List motanTestList) { - return new MotanTest(join(motanTestList, MotanTest::getId), "hello world shenyu motan param batchSave :" + join(motanTestList, MotanTest::getName)); - } - - private String join(final @NonNull List list, final Function mapper) { - return list.stream() - .map(mapper) - .collect(Collectors.joining("-")); - } -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java deleted file mode 100644 index 6cd3bbe63062..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java +++ /dev/null @@ -1,65 +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.shenyu.examples.motan.service.impl; - -import org.apache.shenyu.client.apidocs.annotations.ApiDoc; -import org.apache.shenyu.client.apidocs.annotations.ApiModule; -import org.apache.shenyu.client.motan.common.annotation.ShenyuMotanClient; -import org.apache.shenyu.client.motan.common.annotation.ShenyuMotanService; -import org.apache.shenyu.examples.common.aop.Log; -import org.apache.shenyu.examples.motan.service.MotanDemoService; -import org.apache.shenyu.springboot.starter.client.motan.ShenyuMotanClientConfiguration; - -/** - * Motan demo service. - * - *

Default motan service name is "motan2", If you want to inject other services, - * please refer to {@link ShenyuMotanClientConfiguration} - */ -@ShenyuMotanService(value = "/demo", export = "motan2:8002") -@ApiModule("MotanDemoService") -public class MotanDemoServiceImpl implements MotanDemoService { - - @Override - @ShenyuMotanClient(value = "/hi") - @Log - @ApiDoc(desc = "hi") - public String hi() { - return "{\"say\":\"hi\"}"; - } - - @Override - @ShenyuMotanClient(value = "/hello") - @Log - @ApiDoc(desc = "hello") - public String hello(final String name) { - return "hello " + name; - } - - @Override - @ShenyuMotanClient(value = "/timeout") - @ApiDoc(desc = "timeout") - public String testTimeOut(final long seconds) { - try { - Thread.sleep(seconds * 1000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - return "hello seconds " + seconds + "s"; - } -} diff --git a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml deleted file mode 100644 index ef6831de0df7..000000000000 --- a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml +++ /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. - -server: - port: 8081 - servlet: - context-path: / - address: 0.0.0.0 - -spring: - application: - name: motan-examples - -shenyu: - namespace: 649330b6-c2d7-4edc-be8e-8a54df9eb385 - register: - registerType: http - serverLists: http://localhost:9095 - props: - username: admin - password: 123456 - client: - motan: - props: - contextPath: /motan - ipAndPort: motan - appName: motan - port: 8081 - package-path: org.apache.shenyu.examples.motan.service - basicServiceConfig: - exportPort: 8002 - protocol: - name: motan2 -motan: - registry: - protocol: zk - address: 127.0.0.1:2181 - -logging: - level: - root: info - org.apache.shenyu: debug diff --git a/shenyu-integrated-test/pom.xml b/shenyu-integrated-test/pom.xml index 46da401efc69..d8de022b9c86 100644 --- a/shenyu-integrated-test/pom.xml +++ b/shenyu-integrated-test/pom.xml @@ -35,7 +35,6 @@ shenyu-integrated-test-common shenyu-integrated-test-apache-dubbo shenyu-integrated-test-grpc - shenyu-integrated-test-motan shenyu-integrated-test-sofa shenyu-integrated-test-websocket shenyu-integrated-test-rewrite @@ -44,7 +43,6 @@ shenyu-integrated-test-sdk-http shenyu-integrated-test-upload-plugin shenyu-integrated-test-k8s-ingress-http - shenyu-integrated-test-k8s-ingress-motan shenyu-integrated-test-k8s-ingress-apache-dubbo shenyu-integrated-test-k8s-ingress-websocket shenyu-integrated-test-k8s-ingress-grpc diff --git a/shenyu-integrated-test/shenyu-integrated-test-combination/docker-compose.yml b/shenyu-integrated-test/shenyu-integrated-test-combination/docker-compose.yml index 65c1f5e9b632..0e55c199a90c 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-combination/docker-compose.yml +++ b/shenyu-integrated-test/shenyu-integrated-test-combination/docker-compose.yml @@ -111,32 +111,6 @@ services: shenyu-integrated-test-combination: condition: service_healthy - shenyu-examples-motan: - deploy: - resources: - limits: - memory: 2048M - container_name: shenyu-examples-motan - image: shenyu-examples-motan:latest - restart: always - environment: - - motan.registry.protocol=zookeeper - - motan.registry.address=shenyu-zk:2181 - - shenyu.register.serverLists=http://shenyu-admin:9095 - healthcheck: - test: [ "CMD-SHELL", "wget -q -O - http://localhost:8081/actuator/health | grep UP || exit 1" ] - timeout: 2s - retries: 3 - start_period: 5s - ports: - - "8081:8081" - - "8002:8002" - networks: - - shenyu - depends_on: - shenyu-integrated-test-combination: - condition: service_healthy - shenyu-examples-sofa: deploy: resources: diff --git a/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml index 0222de0e5d91..e7f5633d8b8e 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml +++ b/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml @@ -124,34 +124,6 @@ - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-motan - ${project.version} - - - com.weibo - motan-core - 1.2.1 - - - com.weibo - motan-registry-zookeeper - 1.2.1 - - - com.weibo - motan-transport-netty4 - 1.2.1 - - - com.weibo - motan-springsupport - 1.2.1 - - - com.alipay.sofa diff --git a/shenyu-integrated-test/shenyu-integrated-test-combination/src/main/java/org/apache/shenyu/integrated/test/combination/controller/SharedThreadPoolController.java b/shenyu-integrated-test/shenyu-integrated-test-combination/src/main/java/org/apache/shenyu/integrated/test/combination/controller/SharedThreadPoolController.java index 6abc02e18c74..ee9aaec81f88 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-combination/src/main/java/org/apache/shenyu/integrated/test/combination/controller/SharedThreadPoolController.java +++ b/shenyu-integrated-test/shenyu-integrated-test-combination/src/main/java/org/apache/shenyu/integrated/test/combination/controller/SharedThreadPoolController.java @@ -22,7 +22,6 @@ import org.apache.shenyu.common.concurrent.ShenyuThreadPoolExecutor; import org.apache.shenyu.plugin.api.utils.SpringBeanUtils; import org.apache.shenyu.plugin.grpc.client.GrpcClientBuilder; -import org.apache.shenyu.plugin.motan.proxy.MotanProxyService; import org.apache.shenyu.plugin.sofa.cache.ApplicationConfigCache; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; @@ -72,18 +71,6 @@ public String getFromGrpc() { .orElse(""); } - /** - * get the shared thread pool from motan. - * - * @return the shared thread pool - */ - @GetMapping("/getFromMotan") - public String getFromMotan() { - return Optional.ofNullable(SpringBeanUtils.getInstance().getBean(MotanProxyService.class).getThreadPool()) - .map(Objects::toString) - .orElse(""); - } - /** * get the shared thread pool from sofa. * diff --git a/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java b/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java index 62b3d49c31f6..c0aeb9cc594a 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java +++ b/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java @@ -19,12 +19,10 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; import org.apache.shenyu.common.enums.PluginEnum; import org.apache.shenyu.common.utils.GsonUtils; import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; import org.apache.shenyu.integratedtest.common.dto.DubboTest; -import org.apache.shenyu.integratedtest.common.dto.MotanDTO; import org.apache.shenyu.integratedtest.common.helper.HttpHelper; import org.hamcrest.Matchers; import org.junit.jupiter.api.AfterAll; @@ -34,7 +32,6 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -import java.lang.reflect.Type; import java.util.Map; import static org.hamcrest.MatcherAssert.assertThat; @@ -56,9 +53,6 @@ public static void setup() throws IOException { // for grpc pluginResult = initPlugin(PluginEnum.GRPC.getName(), "{\"register\":\"zookeeper://shenyu-zk:2181\",\"threadpool\": \"shared\"}"); assertThat(pluginResult, is("success")); - // for motan - pluginResult = initPlugin(PluginEnum.MOTAN.getName(), "{\"registerProtocol\": \"zk\", \"registerAddress\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}"); - assertThat(pluginResult, is("success")); // for sofa pluginResult = initPlugin(PluginEnum.SOFA.getName(), "{\"protocol\":\"zookeeper\",\"register\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}"); assertThat(pluginResult, Matchers.is("success")); @@ -84,15 +78,6 @@ public void testGrpc() throws Exception { assertEquals("ReceivedHELLO", result.get("message")); } - @Test - public void testMotan() throws Exception { - MotanDTO request = new MotanDTO("shenyu"); - Type returnType = new TypeToken() { - }.getType(); - String response = HttpHelper.INSTANCE.postGateway("/motan/demo/hello", request, returnType); - assertEquals("hello shenyu", response); - } - @AfterAll public static void testIsOneThreadPool() throws IOException { String spring = HttpHelper.INSTANCE.getFromGateway("/shenyu/getFromSpring", String.class); @@ -100,8 +85,6 @@ public static void testIsOneThreadPool() throws IOException { assertEquals(spring, dubbo); String grpc = HttpHelper.INSTANCE.getFromGateway("/shenyu/getFromGrpc", String.class); assertEquals(spring, grpc); - String motan = HttpHelper.INSTANCE.getFromGateway("/shenyu/getFromMotan", String.class); - assertEquals(spring, motan); // TODO test sofa } } diff --git a/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/dto/MotanDTO.java b/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/dto/MotanDTO.java deleted file mode 100644 index f1662506a363..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-common/src/main/java/org/apache/shenyu/integratedtest/common/dto/MotanDTO.java +++ /dev/null @@ -1,48 +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.shenyu.integratedtest.common.dto; - -/** - * The type Motan dto. - */ -public class MotanDTO { - - private String name; - - public MotanDTO(final String name) { - this.name = name; - } - - /** - * Get the name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Set the name. - * - * @param name the name - */ - public void setName(final String name) { - this.name = name; - } -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/Dockerfile b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/Dockerfile deleted file mode 100644 index 94dbba5b2cdd..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/Dockerfile +++ /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. - -FROM eclipse-temurin:17-centos7 - -ENV APP_NAME shenyu-integrated-test-k8s-ingress-motan -ENV LOCAL_PATH /opt/${APP_NAME} - -RUN mkdir -p ${LOCAL_PATH} - -ADD target/${APP_NAME}.jar ${LOCAL_PATH} - -WORKDIR ${LOCAL_PATH} -EXPOSE 9195 - -CMD java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED -jar ${APP_NAME}.jar diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/deploy-shenyu.yaml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/deploy-shenyu.yaml deleted file mode 100644 index b592f2bee6b1..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/deploy-shenyu.yaml +++ /dev/null @@ -1,107 +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. - -apiVersion: v1 -kind: Namespace -metadata: - name: shenyu-ingress ---- -apiVersion: v1 -automountServiceAccountToken: true -kind: ServiceAccount -metadata: - name: shenyu-ingress-controller - namespace: shenyu-ingress ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: shenyu-ingress-controller - namespace: shenyu-ingress - labels: - app: shenyu-ingress-controller - all: shenyu-ingress-controller -spec: - replicas: 1 - selector: - matchLabels: - app: shenyu-ingress-controller - template: - metadata: - labels: - app: shenyu-ingress-controller - spec: - containers: - - name: shenyu-ingress-controller - image: apache/shenyu-integrated-test-k8s-ingress-motan:latest - ports: - - containerPort: 9195 - imagePullPolicy: IfNotPresent - serviceAccountName: shenyu-ingress-controller ---- -apiVersion: v1 -kind: Service -metadata: - name: shenyu-ingress-controller - namespace: shenyu-ingress -spec: - selector: - app: shenyu-ingress-controller - type: NodePort - ports: - - port: 9195 - targetPort: 9195 - nodePort: 30095 ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: shenyu-ingress-controller -rules: -- apiGroups: - - "" - resources: - - namespaces - - services - - endpoints - - secrets - - pods - verbs: - - get - - list - - watch -- apiGroups: - - networking.k8s.io - resources: - - ingresses - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: shenyu-ingress-controller - namespace: shenyu-ingress -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: shenyu-ingress-controller -subjects: -- kind: ServiceAccount - name: shenyu-ingress-controller - namespace: shenyu-ingress diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/kind-config.yaml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/kind-config.yaml deleted file mode 100644 index 0dc0313af1f9..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/kind-config.yaml +++ /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. - -kind: Cluster -apiVersion: kind.x-k8s.io/v1alpha4 -nodes: - - role: control-plane - kubeadmConfigPatches: - - | - kind: InitConfiguration - nodeRegistration: - kubeletExtraArgs: - node-labels: "ingress-ready=true" - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - - containerPort: 443 - hostPort: 443 - protocol: TCP - - containerPort: 30095 - hostPort: 30095 - protocol: TCP diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/pom.xml deleted file mode 100644 index 7deac40d95f5..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/pom.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - 4.0.0 - - org.apache.shenyu - shenyu-integrated-test - 2.7.1-SNAPSHOT - - - shenyu-integrated-test-k8s-ingress-motan - shenyu-integrated-test-k8s-ingress-motan - - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-motan - ${project.version} - - - - com.weibo - motan-core - ${motan.version} - - - - com.weibo - motan-registry-zookeeper - ${motan.version} - - - - com.weibo - motan-transport-netty4 - ${motan.version} - - - - com.weibo - motan-springsupport - ${motan.version} - - - - - org.apache.shenyu - shenyu-integrated-test-common - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-httpclient - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-global - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-uri - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-general-context - ${project.version} - - - - - org.apache.shenyu - shenyu-spring-boot-starter-k8s - ${project.version} - - - - - - - it - - shenyu-integrated-test-k8s-ingress-motan - apache/shenyu-integrated-test-k8s-ingress-motan - latest - - - shenyu-integrated-test-k8s-ingress-motan - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - - package - - repackage - - - - - org.apache.shenyu.integrated.test.k8s.ingress.motan.MotanIngressControllerIntegratedBootstrap - - true - - - - io.fabric8 - docker-maven-plugin - ${docker-maven-plugin.version} - - - - apache/shenyu-integrated-test-k8s-ingress-motan - - ${project.basedir} - - - - - - - start - - build - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - - - - - diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/build_k8s_cluster.sh b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/build_k8s_cluster.sh deleted file mode 100644 index 69a2ea2b3dfb..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/build_k8s_cluster.sh +++ /dev/null @@ -1,24 +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. -# - -kind load docker-image "shenyu-examples-motan:latest" -kind load docker-image "apache/shenyu-integrated-test-k8s-ingress-motan:latest" -kubectl apply -f ./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/deploy/deploy-shenyu.yaml -kubectl apply -f ./shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-zookeeper.yml -kubectl apply -f ./shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/shenyu-examples-motan.yml -kubectl apply -f ./shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/k8s/ingress.yml diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/healthcheck.sh b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/healthcheck.sh deleted file mode 100644 index 896e78414458..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/healthcheck.sh +++ /dev/null @@ -1,36 +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. -# - -PRGDIR=`dirname "$0"` -for service in `grep -v -E "^$|^#" ${PRGDIR}/services.list` -do - for loop in `seq 1 30` - do - status=`curl -o /dev/null -s -w %{http_code} $service` - echo -e "curl $service response $status" - - if [ $status -eq 200 ]; then - break - fi - - sleep 2 - done -done - -sleep 20 -echo -e "\n-------------------" diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/services.list b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/services.list deleted file mode 100644 index 9ed89eed99c1..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/script/services.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. - -http://localhost:31193/demoTest/hello diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanIngressControllerIntegratedBootstrap.java b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanIngressControllerIntegratedBootstrap.java deleted file mode 100644 index 35df5149e709..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanIngressControllerIntegratedBootstrap.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.shenyu.integrated.test.k8s.ingress.motan; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * The type motan integrated bootstrap. - */ -@SpringBootApplication -public class MotanIngressControllerIntegratedBootstrap { - - /** - * main method of App. - * - * @param args args - */ - public static void main(final String[] args) { - SpringApplication.run(MotanIngressControllerIntegratedBootstrap.class); - } - -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/resources/application.yml deleted file mode 100644 index 51f31397bf6a..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/main/resources/application.yml +++ /dev/null @@ -1,326 +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: 9195 - address: 0.0.0.0 - compression: - enabled: true - minResponseSize: 1MB # If the response data is greater than 1MB, enable compression. - -spring: - main: - allow-bean-definition-overriding: true - application: - name: shenyu-bootstrap - codec: - max-in-memory-size: 2MB - cloud: - discovery: - enabled: true - nacos: - discovery: - server-addr: 127.0.0.1:8848 # Spring Cloud Alibaba Dubbo use this. - enabled: false - namespace: ShenyuRegisterCenter - -# if you want use ribbon please config every server. -#springCloud-test: -# ribbon: -# NIWSServerListClassName: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList - -eureka: - client: - enabled: true - serviceUrl: - defaultZone: http://127.0.0.1:8761/eureka/ - instance: - prefer-ip-address: true - -# security: -# oauth2: -# client: -# registration: -# : -# client-id: -# client-secret: -# provider: -# : -# authorization-uri: -# token-uri: -# user-info-uri: -# jwk-set-uri: - -management: - health: - redis: - enabled: false - elasticsearch: - enabled: false - endpoint: - health: - enabled: true - show-details: always - endpoints: - web: - exposure: - include: "*" # or health,info - - -shenyu: - selectorMatchCache: - ## selector L1 cache - cache: - enabled: false - initialCapacity: 10000 # initial capacity in cache - maximumSize: 10000 # max size in cache - ruleMatchCache: - ## rule L1 cache - cache: - enabled: true - initialCapacity: 10000 # initial capacity in cache - maximumSize: 65536 # max size in cache - netty: - http: - # set to false, user can custom the netty tcp server config. - webServerFactoryEnabled: true - selectCount: 1 - workerCount: 8 - accessLog: false - serverSocketChannel: - soRcvBuf: 87380 - soBackLog: 128 - soReuseAddr: false - connectTimeoutMillis: 10000 - writeBufferHighWaterMark: 65536 - writeBufferLowWaterMark: 32768 - writeSpinCount: 16 - autoRead: false - allocType: "pooled" - messageSizeEstimator: 8 - singleEventExecutorPerGroup: true - socketChannel: - soKeepAlive: false - soReuseAddr: false - soLinger: -1 - tcpNoDelay: true - soRcvBuf: 87380 - soSndBuf: 16384 - ipTos: 0 - allowHalfClosure: false - connectTimeoutMillis: 10000 - writeBufferHighWaterMark: 65536 - writeBufferLowWaterMark: 32768 - writeSpinCount: 16 - autoRead: false - allocType: "pooled" - messageSizeEstimator: 8 - singleEventExecutorPerGroup: true - sni: - enabled: false - mod: k8s #manul - defaultK8sSecretNamespace: shenyu-ingress - defaultK8sSecretName: default-cert - # mod: manual - # certificates: - # - domain: 'localhost' - # keyCertChainFile: '/Users/zhukunshuai/Desktop/cert/example.com+1.pem' - # keyFile: '/Users/zhukunshuai/Desktop/cert/example.com+1-key.pem' - # - domain: 'example.com' - # keyCertChainFile: '/Users/zhukunshuai/Desktop/cert/example.com+1.pem' - # keyFile: '/Users/zhukunshuai/Desktop/cert/example.com+1-key.pem' - # httpclient: - # strategy: netty # webClient - # connectTimeout: 45000 - # responseTimeout: 3000 - # readerIdleTime: 3000 - # writerIdleTime: 3000 - # allIdleTime: 3000 - # readTimeout: 3000 - # writeTimeout: 3000 - # wiretap: false - # keepAlive: false - # maxInMemorySize: 1 #1mb - # pool: - # type: ELASTIC - # name: proxy - # maxConnections: 16 - # acquireTimeout: 45000 - # maxIdleTime: 3000 - # proxy: - # host: - # port: - # username: - # password: - # nonProxyHostsPattern: - # ssl: - # useInsecureTrustManager: true - # keyStoreType: PKCS12 - # keyStorePath: classpath:keystore.p12 - # keyStorePassword: 123456 - # keyStoreProvider: - # keyPassword: 123456 - # trustedX509Certificates: - # handshakeTimeout: - # closeNotifyFlushTimeout: - # closeNotifyReadTimeout: - # defaultConfigurationType: - # threadPool: - # prefix: shenyu - # selectCount: 1 - # workerCount: 8 - # daemon: true - register: - enabled: false - registerType: zookeeper #etcd #consul - serverLists: localhost:2181 #http://localhost:2379 #localhost:8848 - props: - cross: - enabled: true - allowedHeaders: - allowedMethods: "*" - allowedAnyOrigin: true # the same of Access-Control-Allow-Origin: "*" - # allowedOrigin: - # format : schema://prefix spacer domain - # Access-Control-Allow-Origin: "http://a.apache.org,http://b.apache.org" - # spacer: "." - # domain: apache.org - # prefixes: - # - a # a.apache.org - # - b # b.apache.org - # origins: - # - c.apache.org - # - d.apache.org - # - http://e.apache.org - # originRegex: ^http(|s)://(.*\.|)abc.com$ - allowedExpose: "" - maxAge: "18000" - allowCredentials: true - - switchConfig: - local: true - collapseSlashes: false - file: - enabled: true - maxSize : 10 -# sync: -# websocket: -# urls: ws://localhost:9095/websocket -# allowOrigin: ws://localhost:9195 - # apollo: - # appId: shenyu - # meta: http://localhost:8080 - # env: dev - # clusterName: test - # namespace: application - # zookeeper: - # url: localhost:2181 - # sessionTimeout: 5000 - # connectionTimeout: 2000 - # http: - # url: http://localhost:9095 - # username: - # password: - # nacos: - # url: localhost:8848 - # namespace: 1c10d748-af86-43b9-8265-75f487d20c6c - # username: - # password: - # acm: - # enabled: false - # endpoint: acm.aliyun.com - # namespace: - # accessKey: - # secretKey: - # polaris: - # url: 127.0.0.1:8093 - # namespace: - # fileGroup: - # etcd: - # url: http://localhost:2379 - # consul: - # url: http://localhost:8500 - # waitTime: 10000 - # watchDelay: 10000 - exclude: - enabled: false - paths: - - /favicon.ico - fallback: - enabled: false - paths: - - /fallback/hystrix - - /fallback/resilience4j - - /fallback/sentinel - health: - enabled: true - paths: - - /actuator - - /health_check - extPlugin: - path: - enabled: true - threads: 1 - scheduleTime: 300 - scheduleDelay: 30 - scheduler: - enabled: false - type: fixed - threads: 16 - upstreamCheck: - enabled: false - poolSize: 10 - timeout: 3000 - healthyThreshold: 1 - unhealthyThreshold: 1 - interval: 5000 - printEnabled: true - printInterval: 60000 - springCloudCache: - enabled: false - ribbon: - serverListRefreshInterval: 10000 - metrics: - enabled: false - name : prometheus - host: 127.0.0.1 - port: 8090 - jmxConfig: - props: - jvm_enabled: true - # plugins: - # rate-limiter.enabled: false - local: - enabled: false - sha512Key: "BA3253876AED6BC22D4A6FF53D8406C6AD864195ED144AB5C87621B6C233B548BAEAE6956DF346EC8C17F5EA10F35EE3CBC514797ED7DDD3145464E2A0BAB413" -# sharedPool: -# enable: true -# prefix: "shenyu-shared" -# corePoolSize: 200 -# maximumPoolSize: 2000 -# keepAliveTime: 60000 -# # 1GB -# maxWorkQueueMemory: 1073741824 -# # 256MB -# maxFreeMemory: 268435456 - -logging: - level: - root: info - org.springframework.boot: info - org.apache.ibatis: info - org.apache.shenyu.bonuspoint: info - org.apache.shenyu.lottery: info - org.apache.shenyu: info diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanPluginTest.java b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanPluginTest.java deleted file mode 100644 index a7cab3072f14..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-motan/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/motan/MotanPluginTest.java +++ /dev/null @@ -1,49 +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.shenyu.integrated.test.k8s.ingress.motan; - -import com.google.gson.reflect.TypeToken; -import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; -import org.apache.shenyu.integratedtest.common.dto.MotanDTO; -import org.apache.shenyu.integratedtest.common.helper.HttpHelper; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.lang.reflect.Type; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MotanPluginTest extends AbstractPluginDataInit { - - private static final HttpHelper HTTP_HELPER = HttpHelper.INSTANCE; - - @BeforeAll - public static void setup() { - HTTP_HELPER.setGatewayEndpoint("http://localhost:30095"); - } - - @Test - public void testHelloWorld() throws Exception { - MotanDTO request = new MotanDTO("shenyu"); - Type returnType = new TypeToken() { - }.getType(); - String response = HttpHelper.INSTANCE.postGateway("/demo/hello", request, returnType); - assertEquals("hello shenyu", response); - } - -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/Dockerfile b/shenyu-integrated-test/shenyu-integrated-test-motan/Dockerfile deleted file mode 100644 index 9647f38eddad..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/Dockerfile +++ /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. - -FROM eclipse-temurin:17-centos7 - -ENV APP_NAME shenyu-integrated-test-motan -ENV LOCAL_PATH /opt/${APP_NAME} - -RUN mkdir -p ${LOCAL_PATH} - -ADD target/${APP_NAME}.jar ${LOCAL_PATH} - -WORKDIR ${LOCAL_PATH} -EXPOSE 9195 - -CMD java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.net.util=ALL-UNNAMED -jar ${APP_NAME}.jar diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/docker-compose.yml b/shenyu-integrated-test/shenyu-integrated-test-motan/docker-compose.yml deleted file mode 100644 index f34e7532740c..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/docker-compose.yml +++ /dev/null @@ -1,97 +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. -version: "3.9" -services: - shenyu-zk: - container_name: shenyu-zk - image: zookeeper:3.9 - restart: always - networks: - - shenyu - - shenyu-admin: - image: apache/shenyu-admin:latest - container_name: shenyu-admin - restart: always - networks: - - shenyu - depends_on: - shenyu-zk: - condition: service_started - ports: - - "9095:9095" - environment: - - SPRING_PROFILES_ACTIVE=h2 - - shenyu.database.init_script=sql-script/h2/schema.sql - healthcheck: - test: [ "CMD-SHELL", "wget -q -O - http://shenyu-admin:9095/actuator/health | grep UP || exit 1" ] - timeout: 2s - retries: 30 - start_period: 5s - - shenyu-examples-motan: - deploy: - resources: - limits: - memory: 2048M - container_name: shenyu-examples-motan - image: shenyu-examples-motan:latest - restart: always - environment: - - motan.registry.protocol=zookeeper - - motan.registry.address=shenyu-zk:2181 - - shenyu.register.serverLists=http://shenyu-admin:9095 - healthcheck: - test: [ "CMD-SHELL", "wget -q -O - http://localhost:8081/actuator/health | grep UP || exit 1" ] - timeout: 2s - retries: 3 - start_period: 5s - ports: - - "8081:8081" - - "8002:8002" - networks: - - shenyu - depends_on: - shenyu-admin: - condition: service_healthy - - shenyu-integrated-test-motan: - container_name: shenyu-integrated-test-motan - image: apache/shenyu-integrated-test-motan:latest - restart: always - deploy: - resources: - limits: - memory: 2048M - environment: - - shenyu.sync.websocket.urls=ws://shenyu-admin:9095/websocket - depends_on: - shenyu-examples-motan: - condition: service_healthy - ports: - - "9195:9195" - healthcheck: - test: [ "CMD", "wget", "-q", "-O", "-", "http://shenyu-integrated-test-motan:9195/actuator/health" ] - timeout: 2s - retries: 3 - start_period: 5s - networks: - - shenyu - - -networks: - shenyu: - name: shenyu diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml deleted file mode 100644 index b8326448dde1..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - shenyu-integrated-test - org.apache.shenyu - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-integrated-test-motan - shenyu-integrated-test-motan - - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-motan - ${project.version} - - - - com.weibo - motan-core - ${motan.version} - - - - com.weibo - motan-registry-zookeeper - ${motan.version} - - - - com.weibo - motan-transport-netty4 - ${motan.version} - - - - com.weibo - motan-springsupport - ${motan.version} - - - - - org.apache.shenyu - shenyu-integrated-test-common - ${project.version} - - - - - - it - - shenyu-integrated-test-motan - apache/shenyu-integrated-test-motan - latest - - - shenyu-integrated-test-motan - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - - package - - repackage - - - - - org.apache.shenyu.integrated.test.motan.MotanIntegratedBootstrap - true - - - - io.fabric8 - docker-maven-plugin - ${docker-maven-plugin.version} - - - - apache/shenyu-integrated-test-motan - - ${project.basedir} - - - - - - - start - - build - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - - - - diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/script/healthcheck.sh b/shenyu-integrated-test/shenyu-integrated-test-motan/script/healthcheck.sh deleted file mode 100644 index 4484e89bfe20..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/script/healthcheck.sh +++ /dev/null @@ -1,36 +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. -# - -PRGDIR=`dirname "$0"` -for service in `grep -v -E "^$|^#" ${PRGDIR}/services.list` -do - for loop in `seq 1 30` - do - status=`curl -o /dev/null -s -w %{http_code} $service` - echo -e "curl $service response $status" - - if [ $status -eq 200 ]; then - break - fi - - sleep 2 - done -done - -sleep 30 -echo -e "\n-------------------" diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/script/services.list b/shenyu-integrated-test/shenyu-integrated-test-motan/script/services.list deleted file mode 100644 index 35bba1fc37e3..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/script/services.list +++ /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. - -http://localhost:9095/actuator/health -http://localhost:9195/actuator/health -http://localhost:8081/actuator/health -http://localhost:8002/actuator/health diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/java/org/apache/shenyu/integrated/test/motan/MotanIntegratedBootstrap.java b/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/java/org/apache/shenyu/integrated/test/motan/MotanIntegratedBootstrap.java deleted file mode 100644 index 94cb5a3116f7..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/java/org/apache/shenyu/integrated/test/motan/MotanIntegratedBootstrap.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.shenyu.integrated.test.motan; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * The type motan integrated bootstrap. - */ -@SpringBootApplication -public class MotanIntegratedBootstrap { - - /** - * main method of App. - * - * @param args args - */ - public static void main(final String[] args) { - SpringApplication.run(MotanIntegratedBootstrap.class); - } - -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application-local.yml b/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application-local.yml deleted file mode 100644 index 8c4167785148..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application-local.yml +++ /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. - -server: - port: 9195 - address: 0.0.0.0 - -spring: - main: - allow-bean-definition-overriding: true - application: - name: shenyu-bootstrap - -management: - health: - defaults: - enabled: false - -shenyu: - switchConfig: - local: true - cross: - enabled: true - sync: - websocket: - urls: ws://localhost:9095/websocket - allowOrigin: ws://localhost:9195 - exclude: - enabled: true - paths: - - /favicon.ico - - /actuator/health - local: - enabled: true - sha512Key: "BA3253876AED6BC22D4A6FF53D8406C6AD864195ED144AB5C87621B6C233B548BAEAE6956DF346EC8C17F5EA10F35EE3CBC514797ED7DDD3145464E2A0BAB413" - sharedPool: - enable: true - -logging: - level: - root: info - org.springframework.boot: info - org.apache.ibatis: info - org.apache.shenyu.bonuspoint: info - org.apache.shenyu.lottery: info - org.apache.shenyu: info - diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application.yml deleted file mode 100644 index 393ad24df15b..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/src/main/resources/application.yml +++ /dev/null @@ -1,18 +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. - -spring: - profiles: - active: local diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java b/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java deleted file mode 100644 index 34a8811f2e53..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java +++ /dev/null @@ -1,52 +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.shenyu.integrated.test.motan; - -import com.google.gson.reflect.TypeToken; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; -import org.apache.shenyu.integratedtest.common.dto.MotanDTO; -import org.apache.shenyu.integratedtest.common.helper.HttpHelper; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.lang.reflect.Type; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MotanPluginShareThreadPoolTest extends AbstractPluginDataInit { - - @BeforeAll - public static void setup() throws IOException { - String pluginResult = initPlugin(PluginEnum.MOTAN.getName(), "{\"registerProtocol\":\"zk\",\"registerAddress\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}"); - assertThat(pluginResult, is("success")); - } - - @Test - public void testHelloWorld() throws Exception { - MotanDTO request = new MotanDTO("shenyu"); - Type returnType = new TypeToken() { - }.getType(); - String response = HttpHelper.INSTANCE.postGateway("/motan/demo/hello", request, returnType); - assertEquals("hello shenyu", response); - } - -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java b/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java deleted file mode 100644 index 4e57ed589991..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java +++ /dev/null @@ -1,52 +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.shenyu.integrated.test.motan; - -import com.google.gson.reflect.TypeToken; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; -import org.apache.shenyu.integratedtest.common.dto.MotanDTO; -import org.apache.shenyu.integratedtest.common.helper.HttpHelper; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.lang.reflect.Type; - -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.hamcrest.MatcherAssert.assertThat; - -public class MotanPluginTest extends AbstractPluginDataInit { - - @BeforeAll - public static void setup() throws IOException { - String pluginResult = initPlugin(PluginEnum.MOTAN.getName(), "{\"registerAddress\":\"shenyu-zk:2181\",\"registerProtocol\":\"zk\"}"); - assertThat(pluginResult, is("success")); - } - - @Test - public void testHelloWorld() throws Exception { - MotanDTO request = new MotanDTO("shenyu"); - Type returnType = new TypeToken() { - }.getType(); - String response = HttpHelper.INSTANCE.postGateway("/motan/demo/hello", request, returnType); - assertEquals("hello shenyu", response); - } - -} diff --git a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/common/IngressConstants.java b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/common/IngressConstants.java index ca6f12f392f2..6a4c24e76315 100644 --- a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/common/IngressConstants.java +++ b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/common/IngressConstants.java @@ -81,33 +81,6 @@ public class IngressConstants { // The configuration key to specify parameter types for the Dubbo plugin, in string public static final String PLUGIN_DUBBO_PARAMENT_TYPE = "shenyu.apache.org/plugin-dubbo-parament-type"; - // The configuration key to specify the Tars path for the plugin, in string - public static final String PLUGIN_MOTAN_ENABLED = "shenyu.apache.org/plugin-motan-enabled"; - - // The configuration key to specify the Tars path for the plugin, in string - public static final String PLUGIN_MOTAN_CONTEXT_PATH = "shenyu.apache.org/plugin-motan-context-path"; - - // The configuration key to specify the Tars path for the plugin, in string - public static final String PLUGIN_MOTAN_APP_NAME = "shenyu.apache.org/plugin-motan-app-name"; - - // The configuration key to specify the Tars method name for the plugin, in string - public static final String PLUGIN_MOTAN_METHOD_NAME = "shenyu.apache.org/plugin-motan-method-name"; - - // The configuration key to specify the Tars path for the plugin, in string - public static final String PLUGIN_MOTAN_PATH = "shenyu.apache.org/plugin-motan-path"; - - // The configuration key to specify the Tars service name for the plugin, in string - public static final String PLUGIN_MOTAN_SREVICE_NAME = "shenyu.apache.org/plugin-motan-service-name"; - - // The configuration key to specify the Tars RPC type for the plugin, in string - public static final String PLUGIN_MOTAN_RPC_TYPE = "shenyu.apache.org/plugin-motan-rpc-type"; - - // The configuration key to specify the Tars parameter types for the plugin, in string - public static final String PLUGIN_MOTAN_PARAMS_TYPE = "shenyu.apache.org/plugin-motan-params-type"; - - // The configuration key to specify additional RPC extension for the Tars plugin, in string - public static final String PLUGIN_MOTAN_RPC_EXPAND = "shenyu.apache.org/plugin-motan-rpc-expand"; - //Determining whether to use the WebSocket plugin, in String public static final String PLUGIN_WEB_SOCKET_ENABLED = "shenyu.apache.org/plugin-web-socket-enabled"; diff --git a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java index 39f2db7e140a..a9ef809a5b21 100644 --- a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java +++ b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/IngressParser.java @@ -67,21 +67,17 @@ public IngressParser(final SharedIndexInformer serviceInformer, final public List parse(final V1Ingress ingress, final CoreV1Api coreV1Api) { List shenyuMemoryConfigList = new ArrayList<>(); boolean dubboEnabled = getBooleanAnnotation(ingress, IngressConstants.PLUGIN_DUBBO_ENABLED); - boolean motanEnabled = getBooleanAnnotation(ingress, IngressConstants.PLUGIN_MOTAN_ENABLED); boolean webSocketEnabled = getBooleanAnnotation(ingress, IngressConstants.PLUGIN_WEB_SOCKET_ENABLED); boolean brpcEnabled = getBooleanAnnotation(ingress, IngressConstants.PLUGIN_BRPC_ENABLED); boolean grpcEnabled = getBooleanAnnotation(ingress, IngressConstants.PLUGIN_GRPC_ENABLED); boolean sofaEnabled = getBooleanAnnotation(ingress, IngressConstants.PLUGIN_SOFA_ENABLED); - if (!dubboEnabled || !motanEnabled || !sofaEnabled) { + if (!dubboEnabled || !sofaEnabled) { contextPathParse(ingress, shenyuMemoryConfigList, coreV1Api); } if (dubboEnabled) { DubboIngressParser dubboIngressParser = new DubboIngressParser(serviceLister, endpointsLister); shenyuMemoryConfigList.add(dubboIngressParser.parse(ingress, coreV1Api)); - } else if (motanEnabled) { - MotanIngressParser motanIngressParser = new MotanIngressParser(serviceLister, endpointsLister); - shenyuMemoryConfigList.add(motanIngressParser.parse(ingress, coreV1Api)); } else if (webSocketEnabled) { WebSocketParser webSocketParser = new WebSocketParser(serviceLister, endpointsLister); shenyuMemoryConfigList.add(webSocketParser.parse(ingress, coreV1Api)); diff --git a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/MotanIngressParser.java b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/MotanIngressParser.java deleted file mode 100644 index 5479d7f444a5..000000000000 --- a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/MotanIngressParser.java +++ /dev/null @@ -1,304 +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.shenyu.k8s.parser; - -import io.kubernetes.client.informer.cache.Lister; -import io.kubernetes.client.openapi.ApiException; -import io.kubernetes.client.openapi.apis.CoreV1Api; -import io.kubernetes.client.openapi.models.V1Endpoints; -import io.kubernetes.client.openapi.models.V1HTTPIngressPath; -import io.kubernetes.client.openapi.models.V1Ingress; -import io.kubernetes.client.openapi.models.V1IngressBackend; -import io.kubernetes.client.openapi.models.V1IngressRule; -import io.kubernetes.client.openapi.models.V1IngressTLS; -import io.kubernetes.client.openapi.models.V1Secret; -import io.kubernetes.client.openapi.models.V1Service; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.shenyu.common.config.ssl.SslCrtAndKeyStream; -import org.apache.shenyu.common.dto.ConditionData; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.RuleData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.enums.MatchModeEnum; -import org.apache.shenyu.common.enums.OperatorEnum; -import org.apache.shenyu.common.enums.ParamTypeEnum; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.enums.SelectorTypeEnum; -import org.apache.shenyu.common.exception.ShenyuException; -import org.apache.shenyu.k8s.common.IngressConfiguration; -import org.apache.shenyu.k8s.common.IngressConstants; -import org.apache.shenyu.k8s.common.ShenyuMemoryConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -public class MotanIngressParser implements K8sResourceParser { - private static final Logger LOG = LoggerFactory.getLogger(MotanIngressParser.class); - - private final Lister serviceLister; - - private final Lister endpointsLister; - - /** - * IngressParser Constructor. - * - * @param serviceLister serviceLister - * @param endpointsLister endpointsLister - */ - public MotanIngressParser(final Lister serviceLister, final Lister endpointsLister) { - this.serviceLister = serviceLister; - this.endpointsLister = endpointsLister; - } - - /** - * Parse ingress to ShenyuMemoryConfig. - * - * @param ingress ingress resource - * @param coreV1Api coreV1Api - * @return ShenyuMemoryConfig - */ - @Override - public ShenyuMemoryConfig parse(final V1Ingress ingress, final CoreV1Api coreV1Api) { - ShenyuMemoryConfig res = new ShenyuMemoryConfig(); - - if (Objects.nonNull(ingress.getSpec())) { - // Parse the default backend - V1IngressBackend defaultBackend = ingress.getSpec().getDefaultBackend(); - List rules = ingress.getSpec().getRules(); - List tlsList = ingress.getSpec().getTls(); - - String namespace = Objects.requireNonNull(ingress.getMetadata()).getNamespace(); - - if (Objects.isNull(rules) || CollectionUtils.isEmpty(rules)) { - // if rules is null, defaultBackend become global default - if (Objects.nonNull(defaultBackend) && Objects.nonNull(defaultBackend.getService())) { - IngressConfiguration defaultRouteConfig = getDefaultRouteConfig(ingress.getMetadata().getAnnotations()); - res.setGlobalDefaultBackend(Pair.of(Pair.of(namespace + "/" + ingress.getMetadata().getName(), defaultBackend.getService().getName()), - defaultRouteConfig)); - } - } else { - // if rules is not null, defaultBackend is default in this ingress - List routeList = new ArrayList<>(rules.size()); - for (V1IngressRule ingressRule : rules) { - List routes = parseIngressRule(ingressRule, - Objects.requireNonNull(ingress.getMetadata()).getNamespace(), ingress.getMetadata().getAnnotations(), ingress.getMetadata().getLabels()); - routeList.addAll(routes); - } - res.setRouteConfigList(routeList); - } - - // Parse tls - if (Objects.nonNull(tlsList) && CollectionUtils.isNotEmpty(tlsList)) { - List sslList = new ArrayList<>(); - for (V1IngressTLS tls : tlsList) { - String secretName = tls.getSecretName(); - List hosts = tls.getHosts(); - if (Objects.nonNull(secretName) && CollectionUtils.isNotEmpty(hosts)) { - try { - V1Secret secret = coreV1Api.readNamespacedSecret(secretName, namespace, "ture"); - if (Objects.nonNull(secret.getData())) { - InputStream keyCertChainInputStream = new ByteArrayInputStream(secret.getData().get("tls.crt")); - InputStream keyInputStream = new ByteArrayInputStream(secret.getData().get("tls.key")); - hosts.forEach(host -> - sslList.add(new SslCrtAndKeyStream(host, keyCertChainInputStream, keyInputStream)) - ); - } - } catch (ApiException e) { - LOG.error("parse tls failed ", e); - } - } - } - res.setTlsConfigList(sslList); - } - } - return res; - } - - private List parseIngressRule(final V1IngressRule ingressRule, - final String namespace, - final Map annotations, - final Map labels) { - List res = new ArrayList<>(); - - ConditionData hostCondition = null; - if (Objects.nonNull(ingressRule.getHost())) { - hostCondition = new ConditionData(); - hostCondition.setParamType(ParamTypeEnum.URI.getName()); - hostCondition.setOperator(OperatorEnum.EQ.getAlias()); - hostCondition.setParamValue(ingressRule.getHost()); - } - if (Objects.nonNull(ingressRule.getHttp())) { - List paths = ingressRule.getHttp().getPaths(); - if (Objects.nonNull(paths)) { - for (V1HTTPIngressPath path : paths) { - String pathPath = path.getPath(); - if (Objects.isNull(pathPath)) { - continue; - } - - OperatorEnum operator; - if ("ImplementationSpecific".equals(path.getPathType())) { - operator = OperatorEnum.MATCH; - } else if ("Prefix".equals(path.getPathType())) { - operator = OperatorEnum.STARTS_WITH; - } else if ("Exact".equals(path.getPathType())) { - operator = OperatorEnum.EQ; - } else { - LOG.info("Invalid path type, set it with match operator"); - operator = OperatorEnum.MATCH; - } - - ConditionData pathCondition = new ConditionData(); - pathCondition.setOperator(operator.getAlias()); - pathCondition.setParamType(ParamTypeEnum.URI.getName()); - pathCondition.setParamValue(pathPath); - List conditionList = new ArrayList<>(2); - if (Objects.nonNull(hostCondition)) { - conditionList.add(hostCondition); - } - conditionList.add(pathCondition); - ConditionData ruleConditionData = new ConditionData(); - ruleConditionData.setParamType(ParamTypeEnum.URI.getName()); - ruleConditionData.setOperator(OperatorEnum.EQ.getAlias()); - ruleConditionData.setParamName(annotations.getOrDefault(IngressConstants.PLUGIN_MOTAN_PATH, pathPath)); - List ruleConditionDataList = new ArrayList<>(); - ruleConditionDataList.add(ruleConditionData); - - SelectorData selectorData = SelectorData.builder() - .pluginId(String.valueOf(PluginEnum.MOTAN.getCode())) - .pluginName(PluginEnum.MOTAN.getName()) - .name(pathPath) - .matchMode(MatchModeEnum.AND.getCode()) - .type(SelectorTypeEnum.CUSTOM_FLOW.getCode()) - .enabled(true) - .logged(false) - .continued(true) - .conditionList(conditionList).build(); - - List ruleDataList = new ArrayList<>(); - List metaDataList = new ArrayList<>(); - for (String label : labels.keySet()) { - Map metadataAnnotations = serviceLister.namespace(namespace).get(labels.get(label)).getMetadata().getAnnotations(); - List ruleConditionList = getRuleConditionList(metadataAnnotations); - RuleData ruleData = createRuleData(metadataAnnotations, ruleConditionList); - MetaData metaData = parseMetaData(metadataAnnotations); - ruleDataList.add(ruleData); - metaDataList.add(metaData); - } - - res.add(new IngressConfiguration(selectorData, ruleDataList, metaDataList)); - } - } - } - return res; - } - - private List getRuleConditionList(final Map annotations) { - final List ruleConditionList = new ArrayList<>(); - ConditionData ruleCondition = new ConditionData(); - ruleCondition.setOperator(OperatorEnum.EQ.getAlias()); - ruleCondition.setParamType(ParamTypeEnum.URI.getName()); - ruleCondition.setParamValue(annotations.get(IngressConstants.PLUGIN_MOTAN_PATH)); - ruleConditionList.add(ruleCondition); - return ruleConditionList; - } - - private RuleData createRuleData(final Map metadataAnnotations, final List ruleConditionList) { - return RuleData.builder() - .name(metadataAnnotations.get(IngressConstants.PLUGIN_MOTAN_PATH)) - .pluginName(PluginEnum.MOTAN.getName()) - .matchMode(MatchModeEnum.AND.getCode()) - .conditionDataList(ruleConditionList) - .loged(true) - .enabled(true) - .build(); - } - - private MetaData parseMetaData(final Map annotations) { - return MetaData.builder() - .appName(annotations.get(IngressConstants.PLUGIN_MOTAN_APP_NAME)) - .path(annotations.get(IngressConstants.PLUGIN_MOTAN_PATH)) - .rpcType(annotations.get(IngressConstants.PLUGIN_MOTAN_RPC_TYPE)) - .rpcExt(annotations.get(IngressConstants.PLUGIN_MOTAN_RPC_EXPAND)) - .serviceName(annotations.get(IngressConstants.PLUGIN_MOTAN_SREVICE_NAME)) - .methodName(annotations.get(IngressConstants.PLUGIN_MOTAN_METHOD_NAME)) - .parameterTypes(annotations.get(IngressConstants.PLUGIN_MOTAN_PARAMS_TYPE)) - .enabled(true) - .build(); - } - - private IngressConfiguration getDefaultRouteConfig(final Map annotations) { - final ConditionData conditionData = new ConditionData(); - conditionData.setParamName("default"); - conditionData.setParamType(ParamTypeEnum.URI.getName()); - conditionData.setOperator(OperatorEnum.PATH_PATTERN.getAlias()); - conditionData.setParamValue("/**"); - - final SelectorData selectorData = SelectorData.builder() - .name("default-selector") - .sort(Integer.MAX_VALUE) - .conditionList(Collections.singletonList(conditionData)) - .enabled(true) - .id(IngressConstants.ID) - .pluginName(PluginEnum.MOTAN.getName()) - .pluginId(String.valueOf(PluginEnum.MOTAN.getCode())) - .logged(false) - .continued(true) - .matchMode(MatchModeEnum.AND.getCode()) - .type(SelectorTypeEnum.FULL_FLOW.getCode()).build(); - - final RuleData ruleData = RuleData.builder() - .selectorId(IngressConstants.ID) - .pluginName(PluginEnum.MOTAN.getName()) - .name("default-rule") - .matchMode(MatchModeEnum.AND.getCode()) - .conditionDataList(Collections.singletonList(conditionData)) - .loged(false) - .enabled(true) - .sort(Integer.MAX_VALUE).build(); - - if (Objects.isNull(annotations.get(IngressConstants.PLUGIN_MOTAN_APP_NAME)) - || Objects.isNull(annotations.get(IngressConstants.PLUGIN_MOTAN_METHOD_NAME)) - || Objects.isNull(annotations.get(IngressConstants.PLUGIN_MOTAN_PATH)) - || Objects.isNull(annotations.get(IngressConstants.PLUGIN_MOTAN_SREVICE_NAME)) - || Objects.isNull(annotations.get(IngressConstants.PLUGIN_MOTAN_RPC_TYPE))) { - LOG.error("motan metadata is error, please check motan service. MetaData: [{}]", annotations); - throw new ShenyuException(annotations + " is is missing."); - } - MetaData metaData = MetaData.builder() - .appName(annotations.get(IngressConstants.PLUGIN_MOTAN_APP_NAME)) - .path(annotations.get(IngressConstants.PLUGIN_MOTAN_PATH)) - .rpcType(annotations.get(IngressConstants.PLUGIN_MOTAN_RPC_TYPE)) - .rpcExt(annotations.getOrDefault(IngressConstants.PLUGIN_MOTAN_RPC_EXPAND, "")) - .serviceName(annotations.get(IngressConstants.PLUGIN_MOTAN_SREVICE_NAME)) - .methodName(annotations.get(IngressConstants.PLUGIN_MOTAN_METHOD_NAME)) - .parameterTypes(annotations.getOrDefault(IngressConstants.PLUGIN_MOTAN_PARAMS_TYPE, "")) - .enabled(true) - .build(); - return new IngressConfiguration(selectorData, Arrays.asList(ruleData), Arrays.asList(metaData)); - } -} diff --git a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/IngressReconciler.java b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/IngressReconciler.java index 4ecf918325b0..8014bc71dcbf 100644 --- a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/IngressReconciler.java +++ b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/reconciler/IngressReconciler.java @@ -194,9 +194,6 @@ private void enablePluginsBasedOnAnnotations(final Map annotatio if (Objects.equals(annotations.get(IngressConstants.PLUGIN_DUBBO_ENABLED), "true")) { String zookeeperUrl = getZookeeperUrl(annotations, request); enablePlugin(shenyuCacheRepository, PluginEnum.DUBBO, zookeeperUrl); - } else if (Objects.equals(annotations.get(IngressConstants.PLUGIN_MOTAN_ENABLED), "true")) { - String zookeeperUrl = getZookeeperUrl(annotations, request); - enablePlugin(shenyuCacheRepository, PluginEnum.MOTAN, zookeeperUrl); } else if (Objects.equals(annotations.get(IngressConstants.PLUGIN_WEB_SOCKET_ENABLED), "true")) { enablePlugin(shenyuCacheRepository, PluginEnum.WEB_SOCKET, null); } else if (Objects.equals(annotations.get(IngressConstants.PLUGIN_GRPC_ENABLED), "true")) { @@ -212,9 +209,6 @@ private void doDeleteConfigByIngress(final Request request, final V1Ingress oldI if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_DUBBO_ENABLED), "true")) { selectorList = deleteSelectorByIngressName(request.getNamespace(), request.getName(), PluginEnum.DUBBO.getName(), oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_DUBBO_CONTEXT_PATH)); - } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_MOTAN_ENABLED), "true")) { - selectorList = deleteSelectorByIngressName(request.getNamespace(), request.getName(), PluginEnum.MOTAN.getName(), - oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_MOTAN_CONTEXT_PATH)); } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_WEB_SOCKET_ENABLED), "true")) { selectorList = deleteSelectorByIngressName(request.getNamespace(), request.getName(), PluginEnum.WEB_SOCKET.getName(), ""); } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_GRPC_ENABLED), "true")) { @@ -228,8 +222,6 @@ private void doDeleteConfigByIngress(final Request request, final V1Ingress oldI if (Objects.nonNull(selectorList) && !selectorList.isEmpty()) { if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_DUBBO_ENABLED), "true")) { IngressSelectorCache.getInstance().remove(request.getNamespace(), request.getName(), PluginEnum.DUBBO.getName()); - } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_MOTAN_ENABLED), "true")) { - IngressSelectorCache.getInstance().remove(request.getNamespace(), request.getName(), PluginEnum.MOTAN.getName()); } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_WEB_SOCKET_ENABLED), "true")) { IngressSelectorCache.getInstance().remove(request.getNamespace(), request.getName(), PluginEnum.WEB_SOCKET.getName()); } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_GRPC_ENABLED), "true")) { @@ -280,8 +272,6 @@ private String getPluginConfig(final PluginEnum pluginEnum, final String zookeep return "{multiSelectorHandle: 1, multiRuleHandle:0}"; case DUBBO: return "{\"register\":\"" + zookeeperUrl + "\",\"multiSelectorHandle\":\"1\",\"threadpool\":\"shared\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0}"; - case MOTAN: - return "{\"registerProtocol\":\"zk\",\"registerAddress\":\"" + zookeeperUrl + "\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}"; case WEB_SOCKET: return "{multiSelectorHandle: 1}"; case SOFA: @@ -564,15 +554,12 @@ private void processTlsConfigurations(final ShenyuMemoryConfig shenyuMemoryConfi private String getPluginName(final V1Ingress ingress) { String pluginName; String pluginDubboEnabled = ingress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_DUBBO_ENABLED); - String pluginMotanEnabled = ingress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_MOTAN_ENABLED); String pluginWebSocketEnabled = ingress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_WEB_SOCKET_ENABLED); String pluginBrpcEnabled = ingress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_BRPC_ENABLED); String pluginGrpcEnabled = ingress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_GRPC_ENABLED); String pluginSofaEnabled = ingress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_SOFA_ENABLED); if ((Boolean.TRUE.toString()).equals(pluginDubboEnabled)) { pluginName = PluginEnum.DUBBO.getName(); - } else if ((Boolean.TRUE.toString()).equals(pluginMotanEnabled)) { - pluginName = PluginEnum.MOTAN.getName(); } else if ((Boolean.TRUE.toString()).equals(pluginWebSocketEnabled)) { pluginName = PluginEnum.WEB_SOCKET.getName(); } else if ((Boolean.TRUE.toString()).equals(pluginGrpcEnabled)) { diff --git a/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/MotanReconcilerTest.java b/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/MotanReconcilerTest.java deleted file mode 100644 index feaea8d3f929..000000000000 --- a/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/MotanReconcilerTest.java +++ /dev/null @@ -1,153 +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.shenyu.k8s; - -import io.kubernetes.client.extended.controller.reconciler.Request; -import io.kubernetes.client.extended.controller.reconciler.Result; -import io.kubernetes.client.informer.SharedIndexInformer; -import io.kubernetes.client.informer.cache.Indexer; -import io.kubernetes.client.openapi.ApiClient; -import io.kubernetes.client.openapi.models.V1EndpointAddress; -import io.kubernetes.client.openapi.models.V1EndpointSubsetBuilder; -import io.kubernetes.client.openapi.models.V1Endpoints; -import io.kubernetes.client.openapi.models.V1EndpointsBuilder; -import io.kubernetes.client.openapi.models.V1HTTPIngressPathBuilder; -import io.kubernetes.client.openapi.models.V1Ingress; -import io.kubernetes.client.openapi.models.V1IngressBuilder; -import io.kubernetes.client.openapi.models.V1IngressRule; -import io.kubernetes.client.openapi.models.V1IngressRuleBuilder; -import io.kubernetes.client.openapi.models.V1Secret; -import io.kubernetes.client.openapi.models.V1Service; -import io.kubernetes.client.openapi.models.V1ServiceBuilder; -import org.apache.shenyu.common.config.ssl.ShenyuSniAsyncMapping; -import org.apache.shenyu.k8s.parser.IngressParser; -import org.apache.shenyu.k8s.reconciler.IngressReconciler; -import org.apache.shenyu.k8s.repository.ShenyuCacheRepository; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.util.HashMap; -import java.util.Map; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -/** - * Motan Ingress Reconciler Test. - */ -public final class MotanReconcilerTest { - - private SharedIndexInformer ingressInformer; - - private SharedIndexInformer secretInformer; - - private ShenyuCacheRepository shenyuCacheRepository; - - private ShenyuSniAsyncMapping shenyuSniAsyncMapping; - - private SharedIndexInformer serviceInformer; - - private SharedIndexInformer endpointsInformer; - - private IngressReconciler ingressReconciler; - - @BeforeEach - public void init() { - ingressInformer = mock(SharedIndexInformer.class); - secretInformer = mock(SharedIndexInformer.class); - shenyuCacheRepository = mock(ShenyuCacheRepository.class); - shenyuSniAsyncMapping = new ShenyuSniAsyncMapping(); - serviceInformer = mock(SharedIndexInformer.class); - endpointsInformer = mock(SharedIndexInformer.class); - - // mock ingressInformer - final Indexer ingressIndexer = mock(Indexer.class); - //mock serviceInformer - final Indexer serviceIndexer = mock(Indexer.class); - - final V1IngressRule mockedRule = new V1IngressRuleBuilder().withNewHttp().withPaths( - new V1HTTPIngressPathBuilder().withPath("/**") - .withNewBackend() - .withNewService().withName("testService").withNewPort().withNumber(8001).endPort().endService() - .endBackend().build()) - .endHttp().build(); - Map annotations = new HashMap<>(); - annotations.put("kubernetes.io/ingress.class", "shenyu"); - annotations.put("shenyu.apache.org/plugin-motan-enabled", "true"); - annotations.put("shenyu.apache.org/zookeeper-register-address", "zookeeper://zookeeperService:2181"); - Map labels = new HashMap<>(); - labels.put("shenyu.apache.org/metadata-labels-1", "motanTestHelloService"); - Map labelsAnnotations = new HashMap<>(); - labelsAnnotations.put("kubernetes.io/ingress.class", "shenyu"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-enabled", "true"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-app-name", "motan"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-path", "/demoTest/hello"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-rpc-type", "motan"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-service-name", "org.apache.shenyu.examples.motan.service.MotanDemoService"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-method-name", "hello"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-params-type", "java.lang.String"); - labelsAnnotations.put("shenyu.apache.org/plugin-motan-rpc-expand", "{\"methodInfo\":[{\"methodName\":\"hello\"," - + "\"params\":[{\"left\":\"java.lang.String\",\"right\":\"name\"}]}],\"group\":\"motan-shenyu-rpc\",\"timeout\":2000,\"rpcProtocol\":\"motan2\"}"); - V1Service motanTestHelloService = new V1ServiceBuilder().withNewMetadata().withName("motanTestHelloService").withNamespace("mockedNamespace").withAnnotations(labelsAnnotations).endMetadata() - .withNewSpec().endSpec() - .withKind("Service").build(); - - V1Ingress mockedIngress = new V1IngressBuilder().withNewMetadata().withLabels(labels).withName("mockedIngress").withNamespace("mockedNamespace").withAnnotations(annotations).endMetadata() - .withNewSpec().withRules(mockedRule).endSpec() - .withKind("Ingress").build(); - - when(ingressIndexer.getByKey("mockedNamespace/mockedIngress")).thenReturn(mockedIngress); - when(serviceIndexer.getByKey("mockedNamespace/motanTestHelloService")).thenReturn(motanTestHelloService); - when(serviceInformer.getIndexer()).thenReturn(serviceIndexer); - when(ingressInformer.getIndexer()).thenReturn(ingressIndexer); - - //mock endpointsInformer - Indexer endpointsIndexer = mock(Indexer.class); - V1Endpoints mockedEndpoints = new V1EndpointsBuilder().withKind("Endpoints") - .withNewMetadata().withNamespace("mockedNamespace").withName("testService").endMetadata() - .withSubsets(new V1EndpointSubsetBuilder().withAddresses(new V1EndpointAddress().ip("127.0.0.1")).build()) - .build(); - V1Endpoints zookeeperEndpoints = new V1EndpointsBuilder().withNewMetadata().withName("zookeeperService").withNamespace("mockedNamespace").endMetadata() - .withSubsets(new V1EndpointSubsetBuilder().withAddresses(new V1EndpointAddress().ip("127.0.0.1")).build()) - .build(); - when(endpointsIndexer.getByKey("mockedNamespace/testService")).thenReturn(mockedEndpoints); - when(endpointsIndexer.getByKey("mockedNamespace/zookeeperService")).thenReturn(zookeeperEndpoints); - when(endpointsInformer.getIndexer()).thenReturn(endpointsIndexer); - - IngressParser ingressParser = new IngressParser(serviceInformer, endpointsInformer); - ApiClient apiClient = mock(ApiClient.class); - - ingressReconciler = new IngressReconciler(ingressInformer, secretInformer, shenyuCacheRepository, - shenyuSniAsyncMapping, ingressParser, apiClient); - } - - /** - * test reconcile. - */ - @Test - public void testReconcile() { - Result result = ingressReconciler.reconcile(new Request("mockedNamespace", "mockedIngress")); - Assertions.assertEquals(new Result(false), result); - verify(shenyuCacheRepository).saveOrUpdateSelectorData(any()); - verify(shenyuCacheRepository).saveOrUpdateRuleData(any()); - verify(shenyuCacheRepository).saveOrUpdateMetaData(any()); - } -} diff --git a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnum.java b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnum.java index a52976c5a87d..f5e3f4c69eee 100644 --- a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnum.java +++ b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnum.java @@ -112,11 +112,6 @@ public enum ShenyuResultEnum { */ GRPC_CLIENT_NULL(436, "Grpc client is null, please check the context path!"), - /** - * Motan have body param shenyu result enum. - */ - MOTAN_HAVE_BODY_PARAM(437, "Motan must have body param, please enter the JSON format in the body!"), - /** * full selector type enum. */ diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtilTest.java b/shenyu-plugin/shenyu-plugin-api/src/test/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnumTest.java similarity index 70% rename from shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtilTest.java rename to shenyu-plugin/shenyu-plugin-api/src/test/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnumTest.java index 5b7e60c0b28b..84a947ae00a9 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtilTest.java +++ b/shenyu-plugin/shenyu-plugin-api/src/test/java/org/apache/shenyu/plugin/api/result/ShenyuResultEnumTest.java @@ -15,18 +15,20 @@ * limitations under the License. */ -package org.apache.shenyu.plugin.motan.util; +package org.apache.shenyu.plugin.api.result; + +import java.util.Arrays; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -/** - * The Test Case For PrxInfoUtil. - */ -public final class PrxInfoUtilTest { +import static org.junit.jupiter.api.Assertions.assertFalse; + +class ShenyuResultEnumTest { @Test - public void testStatic() throws ClassNotFoundException { - Assertions.assertEquals(PrxInfoUtil.getParamClass("int"), int.class); + void shouldNotContainRemovedRpcResultCode() { + assertFalse(Arrays.stream(ShenyuResultEnum.values()) + .map(Enum::name) + .anyMatch("MOTAN_HAVE_BODY_PARAM"::equals)); } } diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml index f4edad699840..86c1b62ff337 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml @@ -30,7 +30,6 @@ shenyu-plugin-dubbo shenyu-plugin-general-context shenyu-plugin-grpc - shenyu-plugin-motan shenyu-plugin-sofa shenyu-plugin-tars shenyu-plugin-transform diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/main/java/org/apache/shenyu/plugin/general/context/GeneralContextPlugin.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/main/java/org/apache/shenyu/plugin/general/context/GeneralContextPlugin.java index 0074cef5d11d..8c270d131bf0 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/main/java/org/apache/shenyu/plugin/general/context/GeneralContextPlugin.java +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/main/java/org/apache/shenyu/plugin/general/context/GeneralContextPlugin.java @@ -96,7 +96,7 @@ public String named() { @Override public boolean skip(final ServerWebExchange exchange) { - return skipExcept(exchange, RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.MOTAN, RpcTypeEnum.SOFA, RpcTypeEnum.TARS); + return skipExcept(exchange, RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.SOFA, RpcTypeEnum.TARS); } } diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/pom.xml b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/pom.xml deleted file mode 100644 index 16ce97fbbc25..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-plugin-rpc - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-plugin-motan - - - - com.weibo - motan-core - provided - - - com.weibo - motan-transport-netty4 - provided - - - com.weibo - motan-registry-zookeeper - provided - - - org.apache.logging.log4j - log4j-1.2-api - ${log4j-1.2-api.vetsion} - - - com.weibo - motan-springsupport - provided - - - diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/MotanPlugin.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/MotanPlugin.java deleted file mode 100644 index 43c20d66ea95..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/MotanPlugin.java +++ /dev/null @@ -1,129 +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.shenyu.plugin.motan; - -import org.apache.commons.lang3.StringUtils; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.RuleData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.apache.shenyu.plugin.api.context.ShenyuContext; -import org.apache.shenyu.plugin.api.result.ShenyuResultEnum; -import org.apache.shenyu.plugin.api.result.ShenyuResultWrap; -import org.apache.shenyu.plugin.api.utils.RequestUrlUtils; -import org.apache.shenyu.plugin.api.utils.WebFluxResultUtils; -import org.apache.shenyu.plugin.base.AbstractShenyuPlugin; -import org.apache.shenyu.plugin.motan.proxy.MotanProxyService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; - -import java.util.Objects; - -/** - * Motan plugin. - */ -public class MotanPlugin extends AbstractShenyuPlugin { - - private static final Logger LOG = LoggerFactory.getLogger(MotanPlugin.class); - - private final MotanProxyService motanProxyService; - - /** - * Instantiates a new motan plugin. - * - * @param motanProxyService the motan proxy service - */ - public MotanPlugin(final MotanProxyService motanProxyService) { - this.motanProxyService = motanProxyService; - } - - @Override - protected String getRawPath(final ServerWebExchange exchange) { - return RequestUrlUtils.getRewrittenRawPath(exchange); - } - - @Override - @SuppressWarnings("all") - protected Mono doExecute(final ServerWebExchange exchange, final ShenyuPluginChain chain, - final SelectorData selector, final RuleData rule) { - String param = exchange.getAttribute(Constants.PARAM_TRANSFORM); - ShenyuContext shenyuContext = exchange.getAttribute(Constants.CONTEXT); - Objects.requireNonNull(shenyuContext); - MetaData metaData = exchange.getAttribute(Constants.META_DATA); - if (!checkMetaData(metaData)) { - Objects.requireNonNull(metaData); - LOG.error("path is :{}, meta data have error.... {}", shenyuContext.getPath(), metaData); - exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); - Object error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.META_DATA_ERROR); - return WebFluxResultUtils.result(exchange, error); - } - if (StringUtils.isNoneBlank(metaData.getParameterTypes()) && StringUtils.isBlank(param)) { - exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); - Object error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.MOTAN_HAVE_BODY_PARAM); - return WebFluxResultUtils.result(exchange, error); - } - final Mono result = motanProxyService.genericInvoker(param, metaData, exchange, selector); - return result.then(chain.execute(exchange)); - } - - /** - * acquire plugin name. - * - * @return plugin name. - */ - @Override - public String named() { - return PluginEnum.MOTAN.getName(); - } - - /** - * plugin is execute. - * - * @param exchange the current server exchange - * @return default false. - */ - @Override - public boolean skip(final ServerWebExchange exchange) { - return skipExcept(exchange, RpcTypeEnum.MOTAN); - } - - @Override - protected Mono handleSelectorIfNull(final String pluginName, final ServerWebExchange exchange, final ShenyuPluginChain chain) { - return WebFluxResultUtils.noSelectorResult(pluginName, exchange); - } - - @Override - protected Mono handleRuleIfNull(final String pluginName, final ServerWebExchange exchange, final ShenyuPluginChain chain) { - return WebFluxResultUtils.noRuleResult(pluginName, exchange); - } - - @Override - public int getOrder() { - return PluginEnum.MOTAN.getCode(); - } - - private boolean checkMetaData(final MetaData metaData) { - return Objects.nonNull(metaData) && !StringUtils.isBlank(metaData.getMethodName()) && !StringUtils.isBlank(metaData.getServiceName()); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java deleted file mode 100644 index 59e54d0cbeca..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java +++ /dev/null @@ -1,480 +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.shenyu.plugin.motan.cache; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.Maps; -import com.weibo.api.motan.config.ProtocolConfig; -import com.weibo.api.motan.config.RefererConfig; -import com.weibo.api.motan.config.RegistryConfig; -import com.weibo.api.motan.proxy.CommonClient; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.convert.plugin.MotanRegisterConfig; -import org.apache.shenyu.common.dto.convert.selector.MotanUpstream; -import org.apache.shenyu.common.exception.ShenyuException; -import org.apache.shenyu.common.utils.DigestUtils; -import org.apache.shenyu.common.utils.GsonUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.lang.NonNull; - -import java.lang.reflect.Field; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.StringJoiner; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutionException; -import java.util.stream.Collectors; - -/** - * The cache info. - */ -public final class ApplicationConfigCache { - - private static final Logger LOG = LoggerFactory.getLogger(ApplicationConfigCache.class); - - private static final Map UPSTREAM_CACHE_MAP = Maps.newConcurrentMap(); - - private RegistryConfig registryConfig; - - private ProtocolConfig protocolConfig; - - private final LoadingCache> cache = CacheBuilder.newBuilder().maximumSize(Constants.CACHE_MAX_COUNT).removalListener(notification -> { - RefererConfig config = (RefererConfig) notification.getValue(); - if (Objects.nonNull(config)) { - try { - Field field = FieldUtils.getDeclaredField(config.getClass(), "ref", true); - field.set(config, null); - // After the configuration change, motan destroys the instance, but does not empty it. If it is not handled, - // it will get NULL when reinitializing and cause a NULL pointer problem. - } catch (NullPointerException | IllegalAccessException e) { - LOG.error("modify ref have exception", e); - } - } - }).build(new CacheLoader<>() { - @Override - @NonNull - public RefererConfig load(@NonNull final String key) { - return new RefererConfig<>(); - } - }); - - private ApplicationConfigCache() { - } - - /** - * Gets instance. - * - * @return the instance - */ - public static ApplicationConfigCache getInstance() { - return ApplicationConfigCacheInstance.INSTANCE; - } - - /** - * Init. - * - * @param motanRegisterConfig the motan register config - */ - public void init(final MotanRegisterConfig motanRegisterConfig) { - if (Objects.isNull(registryConfig)) { - registryConfig = new RegistryConfig(); - registryConfig.setId("shenyu_motan_proxy"); - registryConfig.setRegister(false); - } - registryConfig.setRegProtocol(motanRegisterConfig.getRegisterProtocol()); - registryConfig.setAddress(motanRegisterConfig.getRegisterAddress()); - if (Objects.isNull(protocolConfig)) { - protocolConfig = new ProtocolConfig(); - protocolConfig.setId("motan2"); - protocolConfig.setName("motan2"); - } - } - - /** - * Get reference config. - * - * @param the type parameter - * @param path path - * @return the reference config - */ - @SuppressWarnings("unchecked") - public RefererConfig get(final String path) { - try { - return (RefererConfig) cache.get(path); - } catch (ExecutionException e) { - throw new ShenyuException(e); - } - } - - /** - * Init ref reference config. - * - * @param metaData the meta data - * @return the reference config - */ - public RefererConfig initRef(final MetaData metaData) { - try { - RefererConfig referenceConfig = cache.get(metaData.getPath()); - if (StringUtils.isNoneBlank(referenceConfig.getServiceInterface())) { - return referenceConfig; - } - } catch (ExecutionException e) { - LOG.error("init motan ref ex:{}", e.getMessage()); - } - return build(metaData); - - } - - /** - * Init ref reference config. - * - * @param selectorId the select id - * @param metaData the meta data - * @param motanUpstream the motan upstream - * @return the reference config - */ - public RefererConfig initRef(final String selectorId, final MetaData metaData, final MotanUpstream motanUpstream) { - try { - setUpstream(selectorId, motanUpstream); - RefererConfig referenceConfig = cache.get(generateUpstreamCacheKey(selectorId, metaData.getPath(), motanUpstream)); - if (StringUtils.isNoneBlank(referenceConfig.getServiceInterface())) { - return referenceConfig; - } - } catch (ExecutionException e) { - LOG.error("init motan ref ex:{}", e.getMessage()); - } - return build(selectorId, metaData, motanUpstream); - - } - - /** - * Build reference config. - * - * @param metaData the meta data - * @return the reference config - */ - public RefererConfig build(final MetaData metaData) { - if (Objects.isNull(protocolConfig) || Objects.isNull(registryConfig)) { - return new RefererConfig<>(); - } - RefererConfig reference = new RefererConfig<>(); - reference.setInterface(CommonClient.class); - reference.setServiceInterface(metaData.getServiceName()); - // the group of motan rpc call - MotanParamExtInfo motanParamExtInfo = GsonUtils.getInstance().fromJson(metaData.getRpcExt(), MotanParamExtInfo.class); - reference.setGroup(motanParamExtInfo.getGroup()); - reference.setVersion("1.0"); - reference.setRequestTimeout(Optional.ofNullable(motanParamExtInfo.getTimeout()).orElse(1000)); - reference.setRegistry(registryConfig); - if (StringUtils.isNotEmpty(motanParamExtInfo.getRpcProtocol())) { - protocolConfig.setName(motanParamExtInfo.getRpcProtocol()); - protocolConfig.setId(motanParamExtInfo.getRpcProtocol()); - } - reference.setProtocol(protocolConfig); - CommonClient obj = reference.getRef(); - if (Objects.nonNull(obj)) { - LOG.info("init motan reference success there meteData is :{}", metaData); - cache.put(metaData.getPath(), reference); - } - return reference; - } - - /** - * Build reference config. - * - * @param selectorId the select id - * @param metaData the meta data - * @param motanUpstream the motan upstream - * @return the reference config - */ - public RefererConfig build(final String selectorId, final MetaData metaData, final MotanUpstream motanUpstream) { - if (Objects.isNull(protocolConfig) || Objects.isNull(registryConfig)) { - return new RefererConfig<>(); - } - if (Objects.isNull(motanUpstream)) { - return this.build(metaData); - } - RefererConfig reference = new RefererConfig<>(); - reference.setInterface(CommonClient.class); - reference.setServiceInterface(metaData.getServiceName()); - // the group of motan rpc call - MotanParamExtInfo motanParamExtInfo = GsonUtils.getInstance().fromJson(metaData.getRpcExt(), MotanParamExtInfo.class); - reference.setGroup(motanParamExtInfo.getGroup()); - reference.setVersion("1.0"); - reference.setRequestTimeout(Optional.ofNullable(motanParamExtInfo.getTimeout()).orElse(1000)); - RegistryConfig registryConfig = new RegistryConfig(); - registryConfig.setId("shenyu_motan_proxy"); - registryConfig.setRegister(false); - if (StringUtils.isNoneBlank(motanUpstream.getRegisterProtocol()) - && StringUtils.isNoneBlank(motanUpstream.getRegisterAddress())) { - Optional.ofNullable(motanUpstream.getRegisterProtocol()).ifPresent(registryConfig::setRegProtocol); - Optional.ofNullable(motanUpstream.getRegisterAddress()).ifPresent(registryConfig::setAddress); - } - reference.setRegistry(registryConfig); - if (StringUtils.isNotEmpty(motanParamExtInfo.getRpcProtocol())) { - protocolConfig.setName(motanParamExtInfo.getRpcProtocol()); - protocolConfig.setId(motanParamExtInfo.getRpcProtocol()); - } - reference.setProtocol(protocolConfig); - CommonClient obj = reference.getRef(); - if (Objects.nonNull(obj)) { - LOG.info("init motan reference success there meteData is :{}", metaData); - cache.put(generateUpstreamCacheKey(selectorId, metaData.getPath(), motanUpstream), reference); - } - return reference; - } - - /** - * generate motan upstream reference cache key. - * - * @param selectorId selectorId - * @param metaDataPath metaDataPath - * @param motanUpstream dubboUpstream - * @return the reference config cache key - */ - public String generateUpstreamCacheKey(final String selectorId, final String metaDataPath, final MotanUpstream motanUpstream) { - StringJoiner stringJoiner = new StringJoiner(Constants.SEPARATOR_UNDERLINE); - stringJoiner.add(selectorId); - stringJoiner.add(metaDataPath); - if (StringUtils.isNotBlank(motanUpstream.getProtocol())) { - stringJoiner.add(motanUpstream.getProtocol()); - } - // use registry hash to short reference cache key - if (StringUtils.isNotBlank(motanUpstream.getRegisterAddress())) { - String registryHash = DigestUtils.md5Hex(motanUpstream.getRegisterAddress()); - stringJoiner.add(registryHash); - } - return stringJoiner.toString(); - } - - /** - * get motanUpstream. - * - * @param path path - * @return motanUpstream - */ - public MotanUpstream getUpstream(final String path) { - return UPSTREAM_CACHE_MAP.get(path); - } - - /** - * set motanUpstream. - * - * @param path path - * @param motanUpstream motanUpstream - * @return motanUpstream - */ - public MotanUpstream setUpstream(final String path, final MotanUpstream motanUpstream) { - return UPSTREAM_CACHE_MAP.put(path, motanUpstream); - } - - /** - * Invalidate. - * - * @param path the path name - */ - public void invalidate(final String path) { - cache.invalidate(path); - } - - /** - * Invalidate all. - */ - public void invalidateAll() { - cache.invalidateAll(); - } - - /** - * Invalidate with metadataPath. - * - * @param metadataPath metadataPath - */ - public void invalidateWithMetadataPath(final String metadataPath) { - ConcurrentMap> map = cache.asMap(); - if (map.isEmpty()) { - return; - } - Set allKeys = map.keySet(); - Set needInvalidateKeys = allKeys.stream().filter(key -> key.contains(metadataPath)).collect(Collectors.toSet()); - if (needInvalidateKeys.isEmpty()) { - return; - } - needInvalidateKeys.forEach(cache::invalidate); - } - - /** - * invalidate with selectorId. - * - * @param selectorId selectorId - */ - public void invalidateWithSelectorId(final String selectorId) { - ConcurrentMap> map = cache.asMap(); - if (map.isEmpty()) { - return; - } - Set allKeys = map.keySet(); - Set needInvalidateKeys = allKeys.stream().filter(key -> key.contains(selectorId)).collect(Collectors.toSet()); - if (needInvalidateKeys.isEmpty()) { - return; - } - needInvalidateKeys.forEach(cache::invalidate); - } - - /** - * The type Application config cache instance. - */ - static final class ApplicationConfigCacheInstance { - - /** - * The Instance. - */ - static final ApplicationConfigCache INSTANCE = new ApplicationConfigCache(); - - private ApplicationConfigCacheInstance() { - - } - } - - /** - * The type Motan param ext info. - */ - static class MethodInfo { - - private String methodName; - - private List> params; - - /** - * Gets method name. - * - * @return the method name - */ - public String getMethodName() { - return methodName; - } - - /** - * Sets method name. - * - * @param methodName the method name - */ - public void setMethodName(final String methodName) { - this.methodName = methodName; - } - - /** - * Gets params. - * - * @return the params - */ - public List> getParams() { - return params; - } - - /** - * Sets params. - * - * @param params the params - */ - public void setParams(final List> params) { - this.params = params; - } - } - - /** - * The type Motan param ext info. - */ - static class MotanParamExtInfo { - - private List methodInfo; - - private String group; - - private Integer timeout; - - private String rpcProtocol; - - /** - * Gets method info. - * - * @return the method info - */ - public List getMethodInfo() { - return methodInfo; - } - - /** - * Sets method info. - * - * @param methodInfo the method info - */ - public void setMethodInfo(final List methodInfo) { - this.methodInfo = methodInfo; - } - - /** - * Gets group. - * - * @return the group - */ - public String getGroup() { - return group; - } - - /** - * Sets group. - * - * @param group the group - */ - public void setGroup(final String group) { - this.group = group; - } - - public Integer getTimeout() { - return timeout; - } - - public void setTimeout(final Integer timeout) { - this.timeout = timeout; - } - - public String getRpcProtocol() { - return rpcProtocol; - } - - /** - * Sets rpc protocol. - * - * @param rpcProtocol the rpc protocol - */ - public void setRpcProtocol(final String rpcProtocol) { - this.rpcProtocol = rpcProtocol; - } - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecorator.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecorator.java deleted file mode 100644 index 7bb812e3a7bf..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecorator.java +++ /dev/null @@ -1,43 +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.shenyu.plugin.motan.context; - -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.plugin.api.context.ShenyuContext; -import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator; - -/** - * The type motan shenyu context decorator. - */ -public class MotanShenyuContextDecorator implements ShenyuContextDecorator { - - @Override - public ShenyuContext decorator(final ShenyuContext shenyuContext, final MetaData metaData) { - shenyuContext.setModule(metaData.getAppName()); - shenyuContext.setMethod(metaData.getServiceName()); - shenyuContext.setContextPath(metaData.getContextPath()); - shenyuContext.setRpcType(RpcTypeEnum.MOTAN.getName()); - return shenyuContext; - } - - @Override - public String rpcType() { - return RpcTypeEnum.MOTAN.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanMetaDataHandler.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanMetaDataHandler.java deleted file mode 100644 index da47366aa80a..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanMetaDataHandler.java +++ /dev/null @@ -1,74 +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.shenyu.plugin.motan.handler; - -import com.google.common.collect.Maps; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.plugin.base.handler.MetaDataHandler; -import org.apache.shenyu.plugin.motan.cache.ApplicationConfigCache; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Objects; -import java.util.concurrent.ConcurrentMap; - -/** - * The motan metadata handler. - */ -public class MotanMetaDataHandler implements MetaDataHandler { - - /** - * logger. - */ - private static final Logger LOG = LoggerFactory.getLogger(MotanMetaDataHandler.class); - - private static final ConcurrentMap META_DATA = Maps.newConcurrentMap(); - - @Override - public void handle(final MetaData metaData) { - try { - MetaData exist = META_DATA.get(metaData.getPath()); - if (Objects.isNull(exist) || Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath())) - || Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath()).getRef())) { - // The first initialization - ApplicationConfigCache.getInstance().initRef(metaData); - } else { - if (!exist.getServiceName().equals(metaData.getServiceName()) || !exist.getRpcExt().equals(metaData.getRpcExt())) { - // update - ApplicationConfigCache.getInstance().invalidateWithMetadataPath(metaData.getPath()); - ApplicationConfigCache.getInstance().build(metaData); - } - } - META_DATA.put(metaData.getPath(), metaData); - } catch (Exception e) { - LOG.error("motan sync metadata is error, please check motan service. MetaData: [{}]", metaData, e); - } - } - - @Override - public void remove(final MetaData metaData) { - ApplicationConfigCache.getInstance().invalidateWithMetadataPath(metaData.getPath()); - META_DATA.remove(metaData.getPath()); - } - - @Override - public String rpcType() { - return RpcTypeEnum.MOTAN.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandler.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandler.java deleted file mode 100644 index 215d67c428b0..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandler.java +++ /dev/null @@ -1,79 +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.shenyu.plugin.motan.handler; - -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.plugin.MotanRegisterConfig; -import org.apache.shenyu.common.dto.PluginData; -import org.apache.shenyu.common.dto.convert.selector.MotanUpstream; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.plugin.base.handler.PluginDataHandler; -import org.apache.shenyu.common.utils.Singleton; -import org.apache.shenyu.plugin.motan.cache.ApplicationConfigCache; - -import java.util.Objects; - -/** - * The type motan plugin data handler. - */ -public class MotanPluginDataHandler implements PluginDataHandler { - - @Override - public void handlerPlugin(final PluginData pluginData) { - if (Objects.nonNull(pluginData) && Boolean.TRUE.equals(pluginData.getEnabled())) { - MotanRegisterConfig motanRegisterConfig = GsonUtils.getInstance().fromJson(pluginData.getConfig(), MotanRegisterConfig.class); - MotanRegisterConfig exist = Singleton.INST.get(MotanRegisterConfig.class); - if (Objects.isNull(motanRegisterConfig)) { - return; - } - if (Objects.isNull(exist) || !motanRegisterConfig.equals(exist)) { - // If it is null, initialize it - ApplicationConfigCache.getInstance().init(motanRegisterConfig); - ApplicationConfigCache.getInstance().invalidateAll(); - } - Singleton.INST.single(MotanRegisterConfig.class, motanRegisterConfig); - } - } - - @Override - public void removePlugin(final PluginData pluginData) { - ApplicationConfigCache.getInstance().invalidateAll(); - } - - @Override - public void handlerSelector(final SelectorData selectorData) { - MotanUpstream motanUpstream = GsonUtils.getInstance().fromJson(selectorData.getHandle(), MotanUpstream.class); - if (Objects.equals(motanUpstream, ApplicationConfigCache - .getInstance().getUpstream(selectorData.getId()))) { - return; - } - ApplicationConfigCache.getInstance().invalidateWithSelectorId(selectorData.getId()); - ApplicationConfigCache.getInstance().setUpstream(selectorData.getId(), motanUpstream); - } - - @Override - public void removeSelector(final SelectorData selectorData) { - ApplicationConfigCache.getInstance().invalidateWithSelectorId(selectorData.getId()); - } - - @Override - public String pluginNamed() { - return PluginEnum.MOTAN.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java deleted file mode 100644 index 8adcf600b953..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java +++ /dev/null @@ -1,197 +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.shenyu.plugin.motan.proxy; - -import com.weibo.api.motan.config.RefererConfig; -import com.weibo.api.motan.proxy.CommonClient; -import com.weibo.api.motan.rpc.Request; -import com.weibo.api.motan.rpc.ResponseFuture; -import com.weibo.api.motan.rpc.RpcContext; -import com.weibo.api.motan.util.MotanClientUtil; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.shenyu.common.concurrent.ShenyuThreadFactory; -import org.apache.shenyu.common.concurrent.ShenyuThreadPoolExecutor; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.plugin.MotanRegisterConfig; -import org.apache.shenyu.common.dto.convert.selector.MotanUpstream; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.enums.ResultEnum; -import org.apache.shenyu.common.exception.ShenyuException; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.common.utils.ParamCheckUtils; -import org.apache.shenyu.common.utils.Singleton; -import org.apache.shenyu.plugin.api.utils.BodyParamUtils; -import org.apache.shenyu.plugin.api.utils.SpringBeanUtils; -import org.apache.shenyu.plugin.motan.cache.ApplicationConfigCache; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; - -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.LinkedBlockingQueue; - - -/** - * Motan proxy service. - */ -public class MotanProxyService { - - private static final Logger LOG = LoggerFactory.getLogger(MotanProxyService.class); - - private final ThreadFactory factory = ShenyuThreadFactory.create("shenyu-motan", true); - - private ExecutorService threadPool; - - /** - * Generic invoker object. - * - * @param body the body - * @param metaData the meta data - * @param exchange the exchange - * @param selectorData the selectorData - * @return the object - * @throws ShenyuException the shenyu exception - */ - @SuppressWarnings("all") - public Mono genericInvoker(final String body, final MetaData metaData, final ServerWebExchange exchange, final SelectorData selectorData) throws ShenyuException { - Map> rpcContext = exchange.getAttribute(Constants.GENERAL_CONTEXT); - Optional.ofNullable(rpcContext).map(context -> context.get(PluginEnum.MOTAN.getName())).ifPresent(context -> { - context.forEach((k, v) -> RpcContext.getContext().setRpcAttachment(k, v)); - }); - RefererConfig reference = getConsumerConfig(selectorData, metaData); - if (Objects.isNull(reference) || StringUtils.isEmpty(reference.getServiceInterface())) { - ApplicationConfigCache.getInstance().invalidate(metaData.getPath()); - reference = ApplicationConfigCache.getInstance().initRef(metaData); - } - CommonClient commonClient = reference.getRef(); - Pair pair; - if (StringUtils.isBlank(metaData.getParameterTypes()) || ParamCheckUtils.bodyIsEmpty(body)) { - pair = new ImmutablePair<>(new String[]{}, new Object[]{}); - } else { - pair = BodyParamUtils.buildParameters(body, metaData.getParameterTypes()); - } - ResponseFuture responseFuture; - //CHECKSTYLE:OFF IllegalCatch - try { - Request request = MotanClientUtil.buildRequest(reference.getServiceInterface(), metaData.getMethodName(), metaData.getParameterTypes(), pair.getRight(), null); - responseFuture = (ResponseFuture)commonClient.asyncCall(request, Object.class); - } catch (Throwable e) { - LOG.error("Exception caught in MotanProxyService#genericInvoker.", e); - return null; - } - //CHECKSTYLE:ON IllegalCatch - initThreadPool(); - CompletableFuture future = CompletableFuture.supplyAsync(responseFuture::getValue, threadPool); - return Mono.fromFuture(future.thenApply(ret -> { - Object result = ret; - if (Objects.isNull(result)) { - result = Constants.MOTAN_RPC_RESULT_EMPTY; - } - exchange.getAttributes().put(Constants.RPC_RESULT, result); - exchange.getAttributes().put(Constants.CLIENT_RESPONSE_RESULT_TYPE, ResultEnum.SUCCESS.getName()); - return result; - })).onErrorMap(ShenyuException::new); - } - - /** - * get motan reference config. - * - * @param selectorData the selector data - * @param metaData the meta data - * @return motan reference config - */ - public RefererConfig getConsumerConfig(final SelectorData selectorData, final MetaData metaData) { - String referenceKey = metaData.getPath(); - MotanUpstream motanUpstream = GsonUtils.getInstance().fromJson(selectorData.getHandle(), MotanUpstream.class); - // if motanUpstream is empty, use default plugin config - if (Objects.isNull(motanUpstream)) { - RefererConfig reference = ApplicationConfigCache.getInstance().get(referenceKey); - if (StringUtils.isBlank(reference.getServiceInterface())) { - ApplicationConfigCache.getInstance().invalidate(referenceKey); - reference = ApplicationConfigCache.getInstance().initRef(metaData); - } - return reference; - } - referenceKey = ApplicationConfigCache.getInstance().generateUpstreamCacheKey(selectorData.getId(), metaData.getPath(), motanUpstream); - RefererConfig reference = ApplicationConfigCache.getInstance().get(referenceKey); - if (StringUtils.isBlank(reference.getServiceInterface())) { - ApplicationConfigCache.getInstance().invalidate(referenceKey); - reference = ApplicationConfigCache.getInstance().initRef(selectorData.getId(), metaData, motanUpstream); - } - return reference; - } - - private void initThreadPool() { - if (Objects.nonNull(threadPool)) { - return; - } - MotanRegisterConfig config = Singleton.INST.get(MotanRegisterConfig.class); - if (Objects.isNull(config)) { - // should not execute to here - threadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, - 60L, TimeUnit.SECONDS, - new SynchronousQueue<>(), - factory); - return; - } - final String threadpool = Optional.ofNullable(config.getThreadpool()).orElse(Constants.CACHED); - switch (threadpool) { - case Constants.SHARED: - try { - threadPool = SpringBeanUtils.getInstance().getBean(ShenyuThreadPoolExecutor.class); - return; - } catch (NoSuchBeanDefinitionException t) { - throw new ShenyuException("shared thread pool is not enable, config ${shenyu.sharedPool.enable} in your xml/yml !", t); - } - case Constants.FIXED: - case Constants.EAGER: - case Constants.LIMITED: - throw new UnsupportedOperationException(); - case Constants.CACHED: - default: - int corePoolSize = Optional.ofNullable(config.getCorethreads()).orElse(0); - int maximumPoolSize = Optional.ofNullable(config.getThreads()).orElse(Integer.MAX_VALUE); - int queueSize = Optional.ofNullable(config.getQueues()).orElse(0); - threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 60L, TimeUnit.SECONDS, - queueSize > 0 ? new LinkedBlockingQueue<>(queueSize) : new SynchronousQueue<>(), factory); - } - } - - /** - * get thread pool, just for integrated test. - * - * @return the thread pool - */ - public ExecutorService getThreadPool() { - return threadPool; - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtil.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtil.java deleted file mode 100644 index 26be85f34480..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/util/PrxInfoUtil.java +++ /dev/null @@ -1,120 +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.shenyu.plugin.motan.util; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - -/** - * Proxy info util. - */ -public final class PrxInfoUtil { - - private static final Map PRIMITIVE_TYPE; - - static { - PRIMITIVE_TYPE = new HashMap<>(); - PRIMITIVE_TYPE.put("int", new PrimitiveType(int.class, o -> { - if (o instanceof String) { - return Integer.valueOf((String) o); - } - return ((Long) o).intValue(); - })); - PRIMITIVE_TYPE.put("double", new PrimitiveType(double.class, o -> { - if (o instanceof String) { - return Double.valueOf((String) o); - } - return o; - })); - PRIMITIVE_TYPE.put("long", new PrimitiveType(long.class, o -> { - if (o instanceof String) { - return Long.valueOf((String) o); - } - return o; - })); - PRIMITIVE_TYPE.put("short", new PrimitiveType(short.class, o -> { - if (o instanceof String) { - return Short.valueOf((String) o); - } - return ((Long) o).shortValue(); - })); - PRIMITIVE_TYPE.put("byte", new PrimitiveType(byte.class, o -> { - if (o instanceof String) { - return Byte.valueOf((String) o); - } - return ((Long) o).byteValue(); - })); - PRIMITIVE_TYPE.put("boolean", new PrimitiveType(boolean.class, o -> { - if (o instanceof String) { - return Byte.valueOf((String) o); - } - return o; - })); - PRIMITIVE_TYPE.put("char", new PrimitiveType(char.class, o -> { - if (o instanceof String) { - return String.valueOf(o).charAt(0); - } - return o; - })); - PRIMITIVE_TYPE.put("float", new PrimitiveType(float.class, o -> { - if (o instanceof String) { - return Float.valueOf((String) o); - } - return ((Double) o).floatValue(); - })); - } - - private PrxInfoUtil() { - } - - /** - * Get class type by name. - * - * @param className className - * @return the type to invoke - * @throws ClassNotFoundException ClassNotFoundException - */ - public static Class getParamClass(final String className) throws ClassNotFoundException { - if (PRIMITIVE_TYPE.containsKey(className)) { - return PRIMITIVE_TYPE.get(className).getClazz(); - } else { - return Class.forName(className); - } - } - - static final class PrimitiveType { - - private final Class clazz; - - private final Function func; - - private PrimitiveType(final Class clazz, final Function func) { - this.clazz = clazz; - this.func = func; - } - - public Class getClazz() { - return clazz; - } - - public Function getFunc() { - return func; - } - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/MotanPluginTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/MotanPluginTest.java deleted file mode 100644 index 120e82b77dee..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/MotanPluginTest.java +++ /dev/null @@ -1,109 +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.shenyu.plugin.motan; - -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.RuleData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.apache.shenyu.plugin.api.context.ShenyuContext; -import org.apache.shenyu.plugin.motan.proxy.MotanProxyService; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.mock.web.server.MockServerWebExchange; -import org.springframework.web.server.ServerWebExchange; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.springframework.mock.http.server.reactive.MockServerHttpRequest; - -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -/** - * The Test Case For MotanPlugin. - */ -public final class MotanPluginTest { - - private static final String PARAM = "{\"name\":\"motan\"}"; - - private MotanPlugin motanPlugin; - - private RuleData ruleData; - - private ShenyuPluginChain chain; - - private SelectorData selectorData; - - private ServerWebExchange exchange; - - private MetaData metaData; - - private MotanProxyService motanProxyService; - - @BeforeEach - public void setUp() { - this.ruleData = mock(RuleData.class); - this.chain = mock(ShenyuPluginChain.class); - this.selectorData = mock(SelectorData.class); - this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); - this.metaData = new MetaData(); - this.metaData.setAppName("motan"); - this.metaData.setContextPath("/motan"); - this.metaData.setPath("/motan/hello"); - this.metaData.setRpcType("motan"); - this.metaData.setServiceName("org.apache.shenyu.examples.motan.service.MotanDemoService"); - this.metaData.setMethodName("hello"); - this.metaData.setParameterTypes("java.lang.String"); - this.metaData.setEnabled(true); - metaData.setRpcExt("{\"methodInfo\":[{\"methodName\":\"hello\",\"params\":[{\"left\":\"java.lang.String\",\"right\":\"name\"}]}],\"group\":\"motan-shenyu-rpc\"}"); - ShenyuContext shenyuContext = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, shenyuContext); - exchange.getAttributes().put(Constants.PARAM_TRANSFORM, PARAM); - exchange.getAttributes().put(Constants.META_DATA, metaData); - this.motanProxyService = mock(MotanProxyService.class); - when(motanProxyService.genericInvoker(PARAM, metaData, exchange, selectorData)).thenReturn(Mono.empty()); - this.motanPlugin = new MotanPlugin(motanProxyService); - } - - @Test - public void testDoExecute() { - when(chain.execute(exchange)).thenReturn(Mono.empty()); - Mono result = motanPlugin.doExecute(exchange, chain, selectorData, ruleData); - StepVerifier.create(result).expectSubscription().verifyComplete(); - } - - @Test - public void testNamed() { - Assertions.assertEquals(motanPlugin.named(), "motan"); - } - - @Test - public void testSkip() { - final boolean result = motanPlugin.skip(exchange); - Assertions.assertTrue(result); - } - - @Test - public void testGetOrder() { - Assertions.assertEquals(motanPlugin.getOrder(), 310); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCacheTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCacheTest.java deleted file mode 100644 index a24ded76d10f..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCacheTest.java +++ /dev/null @@ -1,92 +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.shenyu.plugin.motan.cache; - -import com.weibo.api.motan.config.ProtocolConfig; -import com.weibo.api.motan.config.RegistryConfig; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.shenyu.common.dto.PluginData; -import org.apache.shenyu.common.dto.convert.plugin.MotanRegisterConfig; -import org.apache.shenyu.common.utils.GsonUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - -/** - * The Test Case For ApplicationConfigCache. - */ -public final class ApplicationConfigCacheTest { - - @Test - public void testMotanParamExtInfo() { - ApplicationConfigCache.MotanParamExtInfo motanParamExtInfo = new ApplicationConfigCache.MotanParamExtInfo(); - ApplicationConfigCache.MethodInfo methodInfo = new ApplicationConfigCache.MethodInfo(); - methodInfo.setMethodName("test"); - List list = new ArrayList<>(); - list.add(methodInfo); - motanParamExtInfo.setMethodInfo(list); - motanParamExtInfo.setGroup("test"); - motanParamExtInfo.setTimeout(1000); - Assertions.assertEquals(motanParamExtInfo.getGroup(), "test"); - Assertions.assertEquals(motanParamExtInfo.getMethodInfo().get(0).getMethodName(), "test"); - Assertions.assertEquals(motanParamExtInfo.getTimeout(), 1000); - } - - @Test - public void testMethodInfo() { - List> params = new ArrayList<>(); - Pair pair = Pair.of("left", "right"); - params.add(pair); - ApplicationConfigCache.MethodInfo methodInfo = new ApplicationConfigCache.MethodInfo(); - methodInfo.setParams(params); - Assertions.assertEquals(methodInfo.getParams().get(0).getLeft(), "left"); - } - - @Test - public void testApplicationConfigCacheInstance() { - Assertions.assertEquals(ApplicationConfigCache.ApplicationConfigCacheInstance.INSTANCE.getClass(), ApplicationConfigCache.class); - } - - @Test - public void testApplicationConfigCache() throws NoSuchFieldException, IllegalAccessException { - ApplicationConfigCache applicationConfigCache = ApplicationConfigCache.getInstance(); - Assertions.assertEquals(applicationConfigCache.getInstance().getClass(), ApplicationConfigCache.class); - PluginData pluginData = new PluginData(); - pluginData.setEnabled(true); - pluginData.setConfig("{\"register\" : \"localhost:2181\"}"); - MotanRegisterConfig motanRegisterConfig = GsonUtils.getInstance().fromJson(pluginData.getConfig(), MotanRegisterConfig.class); - applicationConfigCache.init(motanRegisterConfig); - Field field1 = applicationConfigCache.getClass().getDeclaredField("registryConfig"); - field1.setAccessible(true); - RegistryConfig registryConfig = (RegistryConfig) field1.get(applicationConfigCache); - Assertions.assertEquals(registryConfig.getId(), "shenyu_motan_proxy"); - Field field2 = applicationConfigCache.getClass().getDeclaredField("protocolConfig"); - field2.setAccessible(true); - ProtocolConfig protocolConfig = (ProtocolConfig) field2.get(applicationConfigCache); - Assertions.assertEquals(protocolConfig.getId(), "motan2"); - } - - @Test - public void testGet() { - ApplicationConfigCache applicationConfigCache = ApplicationConfigCache.getInstance(); - Assertions.assertEquals(applicationConfigCache.get("/motan").toString(), ""); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecoratorTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecoratorTest.java deleted file mode 100644 index 91c9654577eb..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/context/MotanShenyuContextDecoratorTest.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.shenyu.plugin.motan.context; - -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.plugin.api.context.ShenyuContext; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -/** - * The Test Case For MotanShenyuContextDecorator. - */ -public final class MotanShenyuContextDecoratorTest { - - private MotanShenyuContextDecorator motanShenyuContextDecorator; - - private ShenyuContext shenyuContext; - - private MetaData metaData; - - @BeforeEach - public void setUp() { - this.motanShenyuContextDecorator = new MotanShenyuContextDecorator(); - this.metaData = new MetaData(); - this.shenyuContext = new ShenyuContext(); - } - - @Test - public void testDecorator() { - metaData.setAppName("app"); - metaData.setServiceName("service"); - metaData.setContextPath("localhost"); - motanShenyuContextDecorator.decorator(shenyuContext, metaData); - Assertions.assertEquals(shenyuContext.getModule(), "app"); - } - - @Test - public void testRpcType() { - Assertions.assertEquals(motanShenyuContextDecorator.rpcType(), "motan"); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.java deleted file mode 100644 index a9ca36334fdd..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.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.shenyu.plugin.motan.handler; - -import org.apache.shenyu.common.dto.PluginData; -import org.apache.shenyu.common.dto.convert.plugin.MotanRegisterConfig; -import org.apache.shenyu.common.utils.Singleton; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -/** - * The Test Case For MotanPluginDataHandler. - */ -public final class MotanPluginDataHandlerTest { - - private MotanPluginDataHandler motanPluginDataHandler; - - private PluginData pluginData; - - @BeforeEach - public void setUp() { - this.motanPluginDataHandler = new MotanPluginDataHandler(); - this.pluginData = new PluginData(); - } - - @Test - public void testHandlerPlugin() { - pluginData.setEnabled(true); - pluginData.setConfig("{\"registerAddress\" : \"127.0.0.1:2181\"}"); - motanPluginDataHandler.handlerPlugin(pluginData); - Assertions.assertEquals(Singleton.INST.get(MotanRegisterConfig.class).getRegisterAddress(), "127.0.0.1:2181"); - } - - @Test - public void testPluginNamed() { - Assertions.assertEquals(motanPluginDataHandler.pluginNamed(), "motan"); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyServiceTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyServiceTest.java deleted file mode 100644 index 196d56af6daf..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyServiceTest.java +++ /dev/null @@ -1,98 +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.shenyu.plugin.motan.proxy; - -import com.weibo.api.motan.config.RefererConfig; -import com.weibo.api.motan.proxy.CommonClient; -import com.weibo.api.motan.rpc.Request; -import com.weibo.api.motan.rpc.ResponseFuture; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.plugin.MotanRegisterConfig; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.plugin.motan.cache.ApplicationConfigCache; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.mock.http.server.reactive.MockServerHttpRequest; -import org.springframework.mock.web.server.MockServerWebExchange; -import org.springframework.web.server.ServerWebExchange; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -/** - * MotanProxyServiceTest. - */ -@ExtendWith(MockitoExtension.class) -public class MotanProxyServiceTest { - - private MetaData metaData; - - private ServerWebExchange exchange; - - @BeforeEach - public void setup() { - exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); - metaData = new MetaData(); - metaData.setId("1332017966661636096"); - metaData.setAppName("sofa"); - metaData.setPath("/motan/findAll"); - metaData.setServiceName("org.apache.shenyu.test.motan.api.service.MotanTestService"); - metaData.setMethodName("findAll"); - metaData.setRpcType(RpcTypeEnum.MOTAN.getName()); - metaData.setRpcExt("{\"loadbalance\": \"loadbalance\"}"); - } - - @AfterEach - public void after() { - ApplicationConfigCache.getInstance().invalidateAll(); - } - - @Test - @SuppressWarnings("all") - public void testGenericInvoker() { - - ApplicationConfigCache.getInstance().init(new MotanRegisterConfig()); - SelectorData selectorData = mock(SelectorData.class); - - RefererConfig reference = mock(RefererConfig.class); - CommonClient commonClient = mock(CommonClient.class); - when(reference.getRef()).thenReturn(commonClient); - when(reference.getServiceInterface()).thenReturn("org.apache.shenyu.test.motan.api.service.MotanTestService"); - - MotanProxyService motanProxyService = spy(new MotanProxyService()); - doReturn(reference).when(motanProxyService).getConsumerConfig(selectorData, metaData); - - ResponseFuture responseFuture = mock(ResponseFuture.class); - try { - when(commonClient.asyncCall(any(Request.class), eq(Object.class))).thenReturn(responseFuture); - } catch (Throwable e) { - throw new RuntimeException(e); - } - - motanProxyService.genericInvoker("", metaData, exchange, selectorData); - } - -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-transform/src/main/java/org/apache/shenyu/plugin/transform/RpcParamTransformPlugin.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-transform/src/main/java/org/apache/shenyu/plugin/transform/RpcParamTransformPlugin.java index d690704a066a..81ad86b99ba8 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-transform/src/main/java/org/apache/shenyu/plugin/transform/RpcParamTransformPlugin.java +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-transform/src/main/java/org/apache/shenyu/plugin/transform/RpcParamTransformPlugin.java @@ -107,7 +107,6 @@ public boolean skip(final ServerWebExchange exchange) { RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.TARS, - RpcTypeEnum.MOTAN, RpcTypeEnum.SOFA); } diff --git a/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/RPCMessageWriter.java b/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/RPCMessageWriter.java index 8af525397baa..2f98a835245a 100644 --- a/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/RPCMessageWriter.java +++ b/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/RPCMessageWriter.java @@ -57,7 +57,7 @@ public Mono writeWith(final ServerWebExchange exchange, final ShenyuPlugin @Override public List supportTypes() { - return Lists.newArrayList(RpcTypeEnum.DUBBO.getName(), RpcTypeEnum.SOFA.getName(), - RpcTypeEnum.GRPC.getName(), RpcTypeEnum.MOTAN.getName(), RpcTypeEnum.TARS.getName()); + return Lists.newArrayList(RpcTypeEnum.DUBBO.getName(), RpcTypeEnum.SOFA.getName(), + RpcTypeEnum.GRPC.getName(), RpcTypeEnum.TARS.getName()); } } diff --git a/shenyu-plugin/shenyu-plugin-response/src/test/java/org/apache/shenyu/plugin/response/ResponsePluginTest.java b/shenyu-plugin/shenyu-plugin-response/src/test/java/org/apache/shenyu/plugin/response/ResponsePluginTest.java index bff56e40bec7..7e74d0646d63 100644 --- a/shenyu-plugin/shenyu-plugin-response/src/test/java/org/apache/shenyu/plugin/response/ResponsePluginTest.java +++ b/shenyu-plugin/shenyu-plugin-response/src/test/java/org/apache/shenyu/plugin/response/ResponsePluginTest.java @@ -66,7 +66,6 @@ public void setup() { writerMap.put(RpcTypeEnum.DUBBO.getName(), messageWriter); writerMap.put(RpcTypeEnum.SOFA.getName(), messageWriter); writerMap.put(RpcTypeEnum.GRPC.getName(), messageWriter); - writerMap.put(RpcTypeEnum.MOTAN.getName(), messageWriter); writerMap.put(RpcTypeEnum.TARS.getName(), messageWriter); responsePlugin = new ResponsePlugin(writerMap); } @@ -85,9 +84,6 @@ public void testExecute() { ServerWebExchange grpcExchange = generateServerWebExchange(RpcTypeEnum.GRPC.getName()); StepVerifier.create(responsePlugin.execute(grpcExchange, chain)).expectSubscription().verifyComplete(); - ServerWebExchange motanExchange = generateServerWebExchange(RpcTypeEnum.MOTAN.getName()); - StepVerifier.create(responsePlugin.execute(motanExchange, chain)).expectSubscription().verifyComplete(); - ServerWebExchange tarsExchange = generateServerWebExchange(RpcTypeEnum.TARS.getName()); StepVerifier.create(responsePlugin.execute(tarsExchange, chain)).expectSubscription().verifyComplete(); } diff --git a/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/dto/ApiDocRegisterDTO.java b/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/dto/ApiDocRegisterDTO.java index 77d8d324f96b..07ce517b9f73 100644 --- a/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/dto/ApiDocRegisterDTO.java +++ b/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/dto/ApiDocRegisterDTO.java @@ -60,7 +60,7 @@ public class ApiDocRegisterDTO implements DataTypeParent { private String version; /** - * http,dubbo,sofa,tars,websocket,motan,grpc. + * http,dubbo,sofa,tars,websocket,grpc. */ private String rpcType; diff --git a/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/enums/RegisterTypeEnum.java b/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/enums/RegisterTypeEnum.java index 4af1c7c3bca2..85c41f77f490 100644 --- a/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/enums/RegisterTypeEnum.java +++ b/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/enums/RegisterTypeEnum.java @@ -42,11 +42,6 @@ public enum RegisterTypeEnum { */ TARS("tars"), - /** - * Motan rpc type enum. - */ - MOTAN("motan"), - /** * grpc. */ diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/pom.xml index d6b70f223ed1..b4e8559f0464 100644 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/pom.xml +++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/pom.xml @@ -34,7 +34,6 @@ shenyu-spring-boot-starter-client-grpc shenyu-spring-boot-starter-client-mcp shenyu-spring-boot-starter-client-common - shenyu-spring-boot-starter-client-motan shenyu-spring-boot-starter-client-spring-websocket shenyu-spring-boot-starter-client-beat diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/pom.xml deleted file mode 100644 index cc5588bd64b8..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-spring-boot-starter-client - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-spring-boot-starter-client-motan - - - - org.apache.shenyu - shenyu-client-motan - ${project.version} - - - org.apache.shenyu - shenyu-spring-boot-starter-client-common - ${project.version} - - - com.weibo - motan-springsupport - provided - - - - diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfiguration.java deleted file mode 100644 index 14ca4979d044..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfiguration.java +++ /dev/null @@ -1,178 +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.shenyu.springboot.starter.client.motan; - -import com.weibo.api.motan.common.MotanConstants; -import com.weibo.api.motan.config.springsupport.AnnotationBean; -import com.weibo.api.motan.config.springsupport.BasicServiceConfigBean; -import com.weibo.api.motan.config.springsupport.ProtocolConfigBean; -import com.weibo.api.motan.config.springsupport.RegistryConfigBean; -import com.weibo.api.motan.util.MotanSwitcherUtil; -import org.apache.shenyu.client.motan.MotanServiceEventListener; -import org.apache.shenyu.common.utils.VersionUtils; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.springboot.starter.client.common.config.ShenyuClientCommonBeanConfiguration; -import org.apache.shenyu.springboot.starter.client.motan.property.RegistryConfig; -import org.apache.shenyu.springboot.starter.client.motan.property.ShenyuMotanConfig; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.ImportAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.ApplicationListener; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Motan type client event listener. - */ -@Configuration -@ImportAutoConfiguration(ShenyuClientCommonBeanConfiguration.class) -@ConditionalOnProperty(value = "shenyu.register.enabled", matchIfMissing = true, havingValue = "true") -public class ShenyuMotanClientConfiguration implements ApplicationListener { - - static { - VersionUtils.checkDuplicate(ShenyuMotanClientConfiguration.class); - } - - /** - * Motan service event listener. - * - * @param clientConfig the client config - * @param shenyuClientRegisterRepository the shenyuClientRegisterRepository - * @return the motan service event listener - */ - @Bean - public MotanServiceEventListener motanServiceEventListener(final ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) { - return new MotanServiceEventListener(clientConfig, shenyuClientRegisterRepository); - } - - /** - * Motan registry. - * - * @return registryProperties - */ - @Bean - @ConfigurationProperties(prefix = "motan.registry") - public RegistryConfig registryProperties() { - return new RegistryConfig(); - } - - /** - * Shenyu motan properties. - * - * @return shenyuMotanProperties - */ - @Bean - @ConfigurationProperties(prefix = "shenyu.client.motan") - public ShenyuMotanConfig shenyuMotanProperties() { - return new ShenyuMotanConfig(); - } - - /** - * Define the annotation bean, set the scan package. - * - *

The packagePath seems to be better set in ShenyuMotanConfig, - * but if so, the parameters in the configuration file can not be read, - * using @Value can, probably related to the bean loading timing. - * - * @param packagePath package path - * @return annotationBean - */ - - @Bean - public AnnotationBean motanAnnotationBean(@Value("${shenyu.client.motan.package-path}")final String packagePath) { - AnnotationBean motanAnnotationBean = new AnnotationBean(); - motanAnnotationBean.setPackage(packagePath); - return motanAnnotationBean; - } - - /** - * Define a bean with name of ProtocolConfigBean. - * - *

The protocol id、name are "motan2",service export like this "motan2:8001". - * - * @param shenyuMotanConfig shenyu motan config - * @return ProtocolConfigBean - */ - @Bean("motan2") - public ProtocolConfigBean protocolConfig(final ShenyuMotanConfig shenyuMotanConfig) { - ProtocolConfigBean config = new ProtocolConfigBean(); - config.setDefault(shenyuMotanConfig.getProtocol().isDefault()); - config.setName("motan2"); - config.setMaxContentLength(shenyuMotanConfig.getProtocol().getMaxContentLength()); - return config; - } - - /** - * Define a bean with name of ProtocolConfigBean. - * - *

The protocol id、name are "motan",service export like this "motan:8001". - * @param shenyuMotanConfig shenyu motan config - * @return ProtocolConfigBean - */ - @Bean("motan") - public ProtocolConfigBean motanProtocolConfig(final ShenyuMotanConfig shenyuMotanConfig) { - ProtocolConfigBean config = new ProtocolConfigBean(); - config.setDefault(shenyuMotanConfig.getProtocol().isDefault()); - config.setName("motan"); - config.setMaxContentLength(shenyuMotanConfig.getProtocol().getMaxContentLength()); - return config; - } - - /** - * Define a bean with name registryConfig1 of RegistryConfigBean. - * - * @param registryConfig registry registryConfig - * @return registryConfig - */ - @Bean - public RegistryConfigBean registryConfig(final RegistryConfig registryConfig) { - RegistryConfigBean config = new RegistryConfigBean(); - config.setRegProtocol(registryConfig.getProtocol()); - config.setAddress(registryConfig.getAddress()); - return config; - } - - /** - * Define a bean with name baseServiceConfig of BasicServiceConfigBean. - * - * @param shenyuMotanConfig shenyu motan shenyuMotanConfig - * @return baseServiceConfig - */ - @Bean - public BasicServiceConfigBean baseServiceConfig(final ShenyuMotanConfig shenyuMotanConfig) { - BasicServiceConfigBean config = new BasicServiceConfigBean(); - config.setExport(String.format("%s:%s", shenyuMotanConfig.getProtocol().getName(), shenyuMotanConfig.getBasicServiceConfig().getExportPort())); - config.setGroup(shenyuMotanConfig.getBasicServiceConfig().getGroup()); - config.setAccessLog(shenyuMotanConfig.getBasicServiceConfig().isAccessLog()); - config.setShareChannel(shenyuMotanConfig.getBasicServiceConfig().isShareChannel()); - config.setModule(shenyuMotanConfig.getBasicServiceConfig().getModule()); - config.setApplication(shenyuMotanConfig.getBasicServiceConfig().getApplication()); - config.setRegistry(shenyuMotanConfig.getBasicServiceConfig().getRegistry()); - config.setRequestTimeout(shenyuMotanConfig.getBasicServiceConfig().getRequestTimeout()); - return config; - } - - @Override - public void onApplicationEvent(final ContextRefreshedEvent event) { - ShenyuMotanConfig shenyuMotanConfig = event.getApplicationContext().getBean(ShenyuMotanConfig.class); - MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, shenyuMotanConfig.getBasicServiceConfig().getRegistryHeartBeatSwitcher()); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/RegistryConfig.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/RegistryConfig.java deleted file mode 100644 index 095c24f7ee5d..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/RegistryConfig.java +++ /dev/null @@ -1,65 +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.shenyu.springboot.starter.client.motan.property; - -/** - * Motan Registry config. - */ -public class RegistryConfig { - - private String protocol; - - private String address; - - /** - * Get the protocol. - * - * @return the protocol - */ - public String getProtocol() { - return protocol; - } - - /** - * Set the protocol. - * - * @param protocol the protocol - */ - public void setProtocol(final String protocol) { - this.protocol = protocol; - } - - /** - * Get the address. - * - * @return the address - */ - public String getAddress() { - return address; - } - - /** - * Set the address. - * - * @param address the address - */ - public void setAddress(final String address) { - this.address = address; - } - -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/ShenyuMotanConfig.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/ShenyuMotanConfig.java deleted file mode 100644 index d4c7464ec1f0..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/java/org/apache/shenyu/springboot/starter/client/motan/property/ShenyuMotanConfig.java +++ /dev/null @@ -1,288 +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.shenyu.springboot.starter.client.motan.property; - -import org.apache.commons.lang3.StringUtils; - -/** - * Shenyu motan properties. - */ -public class ShenyuMotanConfig { - - private Protocol protocol = new Protocol(); - - private BasicServiceConfig basicServiceConfig = new BasicServiceConfig(); - - /** - * Get the protocol config. - * @return protocol config - */ - public Protocol getProtocol() { - return protocol; - } - - /** - * Set the protocol config. - * @param protocol protocol config - */ - public void setProtocol(final Protocol protocol) { - this.protocol = protocol; - } - - /** - * Get the BasicServiceConfig. - * @return basicServiceConfig - */ - public BasicServiceConfig getBasicServiceConfig() { - return basicServiceConfig; - } - - /** - * Set the basicServiceConfig. - * @param basicServiceConfig basicServiceConfig - */ - public void setBasicServiceConfig(final BasicServiceConfig basicServiceConfig) { - this.basicServiceConfig = basicServiceConfig; - } - - public static class Protocol { - - private boolean isDefault = true; - - private String name; - - private Integer maxContentLength = 1048576; - - /** - * Get is default. - * @return isDefault isDefault - */ - public boolean isDefault() { - return isDefault; - } - - /** - * Set is default. - * @param isDefault isDefault - */ - public void setDefault(final boolean isDefault) { - this.isDefault = isDefault; - } - - /** - * Get the name. - * @return name - */ - public String getName() { - if (StringUtils.isNotEmpty(name)) { - return name; - } else { - return "motan2"; - } - } - - /** - * Set the name. - * @param name name - */ - public void setName(final String name) { - this.name = name; - } - - /** - * Get the maxContentLength. - * @return maxContentLength - */ - public Integer getMaxContentLength() { - return maxContentLength; - } - - /** - * Set the maxContentLength. - * @param maxContentLength maxContentLength - */ - public void setMaxContentLength(final Integer maxContentLength) { - this.maxContentLength = maxContentLength; - } - } - - public static class BasicServiceConfig { - - private String exportPort; - - private String group = "motan-shenyu-rpc"; - - private boolean accessLog; - - private boolean shareChannel = true; - - private String module; - - private String application; - - private String registry = "registryConfig"; - - private Integer requestTimeout = 2000; - - private boolean registryHeartBeatSwitcher = true; - - /** - * Get the exportPort. - * @return exportPort - */ - public String getExportPort() { - return exportPort; - } - - /** - * Set the exportPort. - * @param exportPort exportPort - */ - public void setExportPort(final String exportPort) { - this.exportPort = exportPort; - } - - /** - * Get the group. - * @return group - */ - public String getGroup() { - return group; - } - - /** - * Set the group. - * @param group group - */ - public void setGroup(final String group) { - this.group = group; - } - - /** - * Get the accessLog. - * @return accessLog - */ - public boolean isAccessLog() { - return accessLog; - } - - /** - * Set the accessLog. - * @param accessLog accessLog - */ - public void setAccessLog(final boolean accessLog) { - this.accessLog = accessLog; - } - - /** - * Get the shareChannel. - * @return shareChannel - */ - public boolean isShareChannel() { - return shareChannel; - } - - /** - * Set the shareChannel. - * @param shareChannel shareChannel - */ - public void setShareChannel(final boolean shareChannel) { - this.shareChannel = shareChannel; - } - - /** - * Get the module. - * @return module - */ - public String getModule() { - return module; - } - - /** - * Set the module. - * @param module module - */ - public void setModule(final String module) { - this.module = module; - } - - /** - * Get the application. - * @return application - */ - public String getApplication() { - return application; - } - - /** - * Set the application. - * @param application application - */ - public void setApplication(final String application) { - this.application = application; - } - - /** - * Get the registry. - * @return registry - */ - public String getRegistry() { - return registry; - } - - /** - * Set the registry. - * @param registry registry - */ - public void setRegistry(final String registry) { - this.registry = registry; - } - - /** - * Get the requestTimeout. - * @return requestTimeout - */ - public Integer getRequestTimeout() { - return requestTimeout; - } - - /** - * Set the requestTimeout. - * @param requestTimeout requestTimeout - */ - public void setRequestTimeout(final Integer requestTimeout) { - this.requestTimeout = requestTimeout; - } - - /** - * Get the registryHeartBeatSwitcher. - * @return registryHeartBeatSwitcher - */ - public boolean getRegistryHeartBeatSwitcher() { - return registryHeartBeatSwitcher; - } - - /** - * Set the registryHeartBeatSwitcher. - * @param registryHeartBeatSwitcher registryHeartBeatSwitcher - */ - public void setRegistryHeartBeatSwitcher(final boolean registryHeartBeatSwitcher) { - this.registryHeartBeatSwitcher = registryHeartBeatSwitcher; - } - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.factories b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.factories deleted file mode 100644 index f704de27772e..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.factories +++ /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. -# - -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.shenyu.springboot.starter.client.motan.ShenyuMotanClientConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.provides b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.provides deleted file mode 100644 index 8d48c92ed70c..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring.provides +++ /dev/null @@ -1,18 +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. -# - -provides: shenyu-spring-boot-starter-client-motan diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 1f027772e527..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1,18 +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. -# - -org.apache.shenyu.springboot.starter.client.motan.ShenyuMotanClientConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/test/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/test/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfigurationTest.java deleted file mode 100644 index fd13b8a08113..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-motan/src/test/java/org/apache/shenyu/springboot/starter/client/motan/ShenyuMotanClientConfigurationTest.java +++ /dev/null @@ -1,69 +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.shenyu.springboot.starter.client.motan; - -import com.weibo.api.motan.config.springsupport.ProtocolConfigBean; -import org.apache.shenyu.client.motan.MotanServiceEventListener; -import org.apache.shenyu.register.client.http.utils.RegisterUtils; -import org.junit.jupiter.api.Test; -import org.mockito.MockedStatic; -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.context.annotation.Configuration; - -import java.util.Optional; - -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mockStatic; - -/** - * Test case for {@link ShenyuMotanClientConfiguration}. - */ -@Configuration -@EnableConfigurationProperties -public class ShenyuMotanClientConfigurationTest { - - @Test - public void testMotanServiceEventListener() { - MockedStatic registerUtilsMockedStatic = mockStatic(RegisterUtils.class); - registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.ofNullable("token")); - new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(ShenyuMotanClientConfiguration.class)) - .withBean(ShenyuMotanClientConfigurationTest.class) - .withBean(ProtocolConfigBean.class) - .withPropertyValues( - "debug=true", - "shenyu.register.registerType=http", - "shenyu.register.serverLists=http://localhost:9095", - "shenyu.register.props.username=admin", - "shenyu.register.props.password=123456", - "shenyu.client.motan.props[contextPath]=/motan", - "shenyu.client.motan.props[appName]=motan", - "shenyu.client.motan.props[host]=127.0.0.1", - "shenyu.client.motan.props[port]=8081", - "shenyu.client.motan.basicServiceConfig.exportPort=8002" - ) - .run(context -> { - MotanServiceEventListener motanServiceEventListener = context.getBean("motanServiceEventListener", MotanServiceEventListener.class); - assertNotNull(motanServiceEventListener); - }); - registerUtilsMockedStatic.close(); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml index 0673e357d00f..03f59e049636 100644 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml +++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml @@ -37,7 +37,6 @@ shenyu-spring-boot-starter-plugin-rewrite shenyu-spring-boot-starter-plugin-sentinel shenyu-spring-boot-starter-plugin-sofa - shenyu-spring-boot-starter-plugin-motan shenyu-spring-boot-starter-plugin-resilience4j shenyu-spring-boot-starter-plugin-tars shenyu-spring-boot-starter-plugin-context-path diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/pom.xml deleted file mode 100644 index 1a9b416627ca..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-spring-boot-starter-plugin-motan - - - - org.apache.shenyu - shenyu-plugin-motan - ${project.version} - - - - - com.weibo - motan-core - test - - - com.weibo - motan-transport-netty4 - test - - - com.weibo - motan-registry-zookeeper - test - - - com.weibo - motan-springsupport - test - - - diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java deleted file mode 100644 index cbac1185dcb7..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfiguration.java +++ /dev/null @@ -1,92 +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.shenyu.springboot.starter.plugin.motan; - -import org.apache.shenyu.plugin.api.ShenyuPlugin; -import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator; -import org.apache.shenyu.plugin.base.handler.MetaDataHandler; -import org.apache.shenyu.plugin.base.handler.PluginDataHandler; -import org.apache.shenyu.plugin.motan.MotanPlugin; -import org.apache.shenyu.plugin.motan.context.MotanShenyuContextDecorator; -import org.apache.shenyu.plugin.motan.handler.MotanPluginDataHandler; -import org.apache.shenyu.plugin.motan.proxy.MotanProxyService; -import org.apache.shenyu.plugin.motan.handler.MotanMetaDataHandler; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * The type motan plugin configuration. - */ -@Configuration -@ConditionalOnClass(MotanPlugin.class) -@ConditionalOnProperty(value = {"shenyu.plugins.motan.enabled"}, havingValue = "true", matchIfMissing = true) -public class MotanPluginConfiguration { - - /** - * Motan proxy service. - * - * @return the motan proxy service - */ - @Bean - public MotanProxyService motanProxyService() { - return new MotanProxyService(); - } - - /** - * Motan plugin. - * - * @param motanProxyService the motan proxy service - * @return the shenyu plugin - */ - @Bean - public ShenyuPlugin motanPlugin(final MotanProxyService motanProxyService) { - return new MotanPlugin(motanProxyService); - } - - /** - * Motan plugin data handler. - * - * @return the plugin data handler - */ - @Bean - public PluginDataHandler motanPluginDataHandler() { - return new MotanPluginDataHandler(); - } - - /** - * Motan meta data handler. - * - * @return the meta data handler - */ - @Bean - public MetaDataHandler motanMetaDataHandler() { - return new MotanMetaDataHandler(); - } - - /** - * motan shenyu context decorator. - * - * @return the shenyu context decorator - */ - @Bean - public ShenyuContextDecorator motanShenyuContextDecorator() { - return new MotanShenyuContextDecorator(); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.factories b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.factories deleted file mode 100644 index f6ae9915a6b6..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.factories +++ /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. -# - -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.shenyu.springboot.starter.plugin.motan.MotanPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.provides b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.provides deleted file mode 100644 index 77d8c47cf814..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring.provides +++ /dev/null @@ -1,18 +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. -# - -provides: shenyu-spring-boot-starter-plugin-motan diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 4201fbaf6ce0..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1,18 +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. -# - -org.apache.shenyu.springboot.starter.plugin.motan.MotanPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java deleted file mode 100644 index 4665c36ce8c0..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-motan/src/test/java/org/apache/shenyu/springboot/starter/plugin/motan/MotanPluginConfigurationTest.java +++ /dev/null @@ -1,85 +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.shenyu.springboot.starter.plugin.motan; - -import org.apache.shenyu.plugin.api.context.ShenyuContextDecorator; -import org.apache.shenyu.plugin.base.handler.MetaDataHandler; -import org.apache.shenyu.plugin.base.handler.PluginDataHandler; -import org.apache.shenyu.plugin.motan.MotanPlugin; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.context.annotation.Configuration; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * Test case for {@link MotanPluginConfiguration}. - */ -@Configuration -@EnableConfigurationProperties -public class MotanPluginConfigurationTest { - - private ApplicationContextRunner applicationContextRunner; - - @BeforeEach - public void before() { - applicationContextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(MotanPluginConfiguration.class)) - .withBean(MotanPluginConfigurationTest.class) - .withPropertyValues("debug=true"); - } - - @Test - public void testMotanPlugin() { - applicationContextRunner.run(context -> { - MotanPlugin plugin = context.getBean("motanPlugin", MotanPlugin.class); - assertNotNull(plugin); - } - ); - } - - @Test - public void testMotanPluginDataHandler() { - applicationContextRunner.run(context -> { - PluginDataHandler handler = context.getBean("motanPluginDataHandler", PluginDataHandler.class); - assertNotNull(handler); - } - ); - } - - @Test - public void testMotanMetaDataHandler() { - applicationContextRunner.run(context -> { - MetaDataHandler handler = context.getBean("motanMetaDataHandler", MetaDataHandler.class); - assertNotNull(handler); - } - ); - } - - @Test - public void testMotanShenyuContextDecorator() { - applicationContextRunner.run(context -> { - ShenyuContextDecorator subscriber = context.getBean("motanShenyuContextDecorator", ShenyuContextDecorator.class); - assertNotNull(subscriber); - } - ); - } -} From 182c0a99a21baa76120e5250f5ae29a3c5ac28b1 Mon Sep 17 00:00:00 2001 From: liuhy Date: Wed, 1 Apr 2026 19:14:23 +0800 Subject: [PATCH 2/2] test(common): drop motan schema sync check on remove-motan --- .../test/java/org/apache/shenyu/common/enums/PluginEnumTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/shenyu-common/src/test/java/org/apache/shenyu/common/enums/PluginEnumTest.java b/shenyu-common/src/test/java/org/apache/shenyu/common/enums/PluginEnumTest.java index a221bb502def..51c484f7df73 100644 --- a/shenyu-common/src/test/java/org/apache/shenyu/common/enums/PluginEnumTest.java +++ b/shenyu-common/src/test/java/org/apache/shenyu/common/enums/PluginEnumTest.java @@ -92,7 +92,6 @@ public void testGetCode() { "sofa, 310", "tars, 310", "grpc, 310", - "motan, 310", "cryptorResponse, 410", "mock, 1", "jwt, 30",