diff --git a/.asf.yaml b/.asf.yaml index ff339b1a669b..06e5a1ee7c0c 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -24,7 +24,6 @@ github: - spring-cloud-proxy - grpc-proxy - dubbo-proxy - - sofa-proxy - motan-proxy - reactor-java enabled_merge_buttons: diff --git a/.github/workflows/e2e-k8s.yml b/.github/workflows/e2e-k8s.yml index b9451ecff7c0..ada74a9be086 100644 --- a/.github/workflows/e2e-k8s.yml +++ b/.github/workflows/e2e-k8s.yml @@ -247,8 +247,6 @@ jobs: script: e2e-springcloud-sync-compose - case: shenyu-e2e-case-apache-dubbo script: e2e-apache-dubbo-sync-compose - - case: shenyu-e2e-case-sofa - script: e2e-sofa-sync-compose - case: shenyu-e2e-case-grpc script: e2e-grpc-sync-compose - case: shenyu-e2e-case-websocket diff --git a/.github/workflows/integrated-test-k8s-ingress.yml b/.github/workflows/integrated-test-k8s-ingress.yml index c6aa33c88b55..abf72b8ef992 100644 --- a/.github/workflows/integrated-test-k8s-ingress.yml +++ b/.github/workflows/integrated-test-k8s-ingress.yml @@ -31,7 +31,6 @@ jobs: - shenyu-integrated-test-k8s-ingress-motan - shenyu-integrated-test-k8s-ingress-websocket - shenyu-integrated-test-k8s-ingress-grpc - # - shenyu-integrated-test-k8s-ingress-sofa runs-on: ubuntu-latest if: github.repository == 'apache/shenyu' steps: diff --git a/.github/workflows/integrated-test.yml b/.github/workflows/integrated-test.yml index 9afc310f1c2f..336ac06daeae 100644 --- a/.github/workflows/integrated-test.yml +++ b/.github/workflows/integrated-test.yml @@ -32,7 +32,6 @@ jobs: - shenyu-integrated-test-https - shenyu-integrated-test-motan - shenyu-integrated-test-spring-cloud - - shenyu-integrated-test-sofa - shenyu-integrated-test-websocket - shenyu-integrated-test-rewrite - shenyu-integrated-test-combination diff --git a/README.md b/README.md index 8cdbd00e80bd..a0237129ed84 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, Motan, 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..46fb8e936394 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,tars,websocket,motan,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', @@ -974,7 +974,6 @@ CREATE TABLE `plugin` ( INSERT INTO `plugin` VALUES ('1', 'sign', NULL, 'Authentication', 20, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('31', 'mock', null, 'Mock', 1, 0, '2022-06-16 14:40:35', '2022-06-16 14:40:55',null); INSERT INTO `plugin` VALUES ('10', 'sentinel', NULL, 'FaultTolerance', 140, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); -INSERT INTO `plugin` VALUES ('11', 'sofa', '{\"protocol\":\"zookeeper\",\"register\":\"127.0.0.1:2181\",\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('12', 'resilience4j', NULL, 'FaultTolerance', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('13', 'tars', '{\"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 ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); @@ -1080,10 +1079,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613199978530', '4', 'mode', 'mode', INSERT INTO `plugin_handle` VALUES ('1529402613199978531', '4', 'master', 'master', 2, 3, 2, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978532', '4', 'url', 'url', 2, 3, 3, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978533', '4', 'password', 'password', 2, 3, 4, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978534', '11', 'protocol', 'protocol', 2, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978535', '11', 'register', 'register', 2, 3, 2, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1729402613199978534', '11', 'protocol', 'protocol', 2, 1, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1729402613199978535', '11', 'register', 'register', 2, 1, 2, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978536', '2', 'model', 'model', 2, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978537', '6', 'register', 'register', 2, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978538', '4', 'algorithmName', 'algorithmName', 3, 2, 1, '{\"required\":\"1\",\"defaultValue\":\"slidingWindow\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); @@ -1219,10 +1214,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613204172870', '13', 'corethreads', INSERT INTO `plugin_handle` VALUES ('1529402613204172871', '13', 'threads', 'threads', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172872', '13', 'queues', 'queues', 1, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172873', '13', 'threadpool', 'threadpool', 3, 3, 2, '{\"required\":\"0\",\"defaultValue\":\"default\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172874', '11', 'corethreads', 'corethreads', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172875', '11', 'threads', 'threads', 1, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172876', '11', 'queues', 'queues', 1, 3, 6, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172877', '11', 'threadpool', 'threadpool', 3, 3, 3, '{\"required\":\"0\",\"defaultValue\":\"default\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172878', '31', 'responseContent', 'responseContent', 2, 2, 0, '{"required":"0","rule":""}', '2022-06-16 14:47:37', '2022-06-16 14:50:39'); INSERT INTO `plugin_handle` VALUES ('1529402613204172879', '31', 'httpStatusCode', 'httpStatusCode', 1, 2, 0, '{"required":"0","defaultValue":"200","rule":""}', '2022-06-16 14:47:09', '2022-06-16 14:50:39'); INSERT INTO `plugin_handle` VALUES ('1529402613204172880', '32', 'host', 'host', 2, 3, 1, '{\"required\":\"1\",\"defaultValue\":\"localhost\"}', '2022-06-19 22:00:00', '2022-06-19 22:00:00'); @@ -1578,7 +1569,6 @@ INSERT INTO `resource` VALUES ('1386680049203195915', '1346777157943259136', 'SH INSERT INTO `resource` VALUES ('1386680049203195916', '1346777157943259136', 'SHENYU.COMMON.IMPORT', '', '', '', 2, 0, '', 1, 0, 'system:manager:importConfig', 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `resource` VALUES ('1529402639271772160', '1346775491550474240', 'sign', 'sign', '/plug/sign', 'sign', 1, 0, 'thunderbolt', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355072', '1346775491550474240', 'sentinel', 'sentinel', '/plug/sentinel', 'sentinel', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639284355073', '1346775491550474240', 'sofa', 'sofa', '/plug/sofa', 'sofa', 1, 0, 'key', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355074', '1346775491550474240', 'resilience4j', 'resilience4j', '/plug/resilience4j', 'resilience4j', 1, 0, 'redo', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355075', '1346775491550474240', 'tars', 'tars', '/plug/tars', 'tars', 1, 0, 'thunderbolt', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); 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'); @@ -1622,15 +1612,6 @@ INSERT INTO `resource` VALUES ('1529402639368241166', '1529402639284355072', 'SH INSERT INTO `resource` VALUES ('1529402639368241167', '1529402639284355072', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241168', '1529402639284355072', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241169', '1529402639284355072', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinel:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241170', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241171', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241172', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241173', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241174', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241175', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241176', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241177', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241178', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofa:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241179', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241180', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241181', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -2614,7 +2595,6 @@ CREATE TABLE `namespace_plugin_rel` ( INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822145','649330b6-c2d7-4edc-be8e-8a54df9eb385','1', NULL, 20, 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 ('1801816010882822146','649330b6-c2d7-4edc-be8e-8a54df9eb385','10', NULL, 140, 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 ('1801816010882822147','649330b6-c2d7-4edc-be8e-8a54df9eb385','11', '{\"protocol\":\"zookeeper\",\"register\":\"127.0.0.1:2181\",\"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 ('1801816010882822148','649330b6-c2d7-4edc-be8e-8a54df9eb385','12', NULL, 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 ('1801816010882822149','649330b6-c2d7-4edc-be8e-8a54df9eb385','13', '{\"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 ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '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..cc6ef20bdde9 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,tars,websocket,motan,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', @@ -945,7 +945,6 @@ CREATE TABLE `plugin` ( INSERT INTO `plugin` VALUES ('1', 'sign', NULL, 'Authentication', 20, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('31', 'mock', null, 'Mock', 1, 0, '2022-06-16 14:40:35', '2022-06-16 14:40:55',null); INSERT INTO `plugin` VALUES ('10', 'sentinel', NULL, 'FaultTolerance', 140, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); -INSERT INTO `plugin` VALUES ('11', 'sofa', '{\"protocol\":\"zookeeper\",\"register\":\"127.0.0.1:2181\",\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('12', 'resilience4j', NULL, 'FaultTolerance', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('13', 'tars', '{\"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 ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); @@ -1047,10 +1046,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613199978530', '4', 'mode', 'mode', INSERT INTO `plugin_handle` VALUES ('1529402613199978531', '4', 'master', 'master', 2, 3, 2, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978532', '4', 'url', 'url', 2, 3, 3, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978533', '4', 'password', 'password', 2, 3, 4, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978534', '11', 'protocol', 'protocol', 2, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978535', '11', 'register', 'register', 2, 3, 2, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1729402613199978534', '11', 'protocol', 'protocol', 2, 1, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1729402613199978535', '11', 'register', 'register', 2, 1, 2, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978536', '2', 'model', 'model', 2, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978537', '6', 'register', 'register', 2, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978538', '4', 'algorithmName', 'algorithmName', 3, 2, 1, '{\"required\":\"1\",\"defaultValue\":\"slidingWindow\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); @@ -1185,10 +1180,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613204172870', '13', 'corethreads', INSERT INTO `plugin_handle` VALUES ('1529402613204172871', '13', 'threads', 'threads', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172872', '13', 'queues', 'queues', 1, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172873', '13', 'threadpool', 'threadpool', 3, 3, 2, '{\"required\":\"0\",\"defaultValue\":\"default\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172874', '11', 'corethreads', 'corethreads', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172875', '11', 'threads', 'threads', 1, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172876', '11', 'queues', 'queues', 1, 3, 6, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172877', '11', 'threadpool', 'threadpool', 3, 3, 3, '{\"required\":\"0\",\"defaultValue\":\"default\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172878', '31', 'responseContent', 'responseContent', 2, 2, 0, '{"required":"0","rule":""}', '2022-06-16 14:47:37', '2022-06-16 14:50:39'); INSERT INTO `plugin_handle` VALUES ('1529402613204172879', '31', 'httpStatusCode', 'httpStatusCode', 1, 2, 0, '{"required":"0","defaultValue":"200","rule":""}', '2022-06-16 14:47:09', '2022-06-16 14:50:39'); INSERT INTO `plugin_handle` VALUES ('1529402613204172880', '32', 'host', 'host', 2, 3, 1, '{\"required\":\"1\",\"defaultValue\":\"localhost\"}', '2022-06-19 22:00:00', '2022-06-19 22:00:00'); @@ -1527,7 +1518,6 @@ INSERT INTO `resource` VALUES ('1386680049203195915', '1346777157943259136', 'SH INSERT INTO `resource` VALUES ('1386680049203195916', '1346777157943259136', 'SHENYU.COMMON.IMPORT', '', '', '', 2, 0, '', 1, 0, 'system:manager:importConfig', 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `resource` VALUES ('1529402639271772160', '1346775491550474240', 'sign', 'sign', '/plug/sign', 'sign', 1, 0, 'thunderbolt', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355072', '1346775491550474240', 'sentinel', 'sentinel', '/plug/sentinel', 'sentinel', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639284355073', '1346775491550474240', 'sofa', 'sofa', '/plug/sofa', 'sofa', 1, 0, 'key', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355074', '1346775491550474240', 'resilience4j', 'resilience4j', '/plug/resilience4j', 'resilience4j', 1, 0, 'redo', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355075', '1346775491550474240', 'tars', 'tars', '/plug/tars', 'tars', 1, 0, 'thunderbolt', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); 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'); @@ -1571,15 +1561,6 @@ INSERT INTO `resource` VALUES ('1529402639368241166', '1529402639284355072', 'SH INSERT INTO `resource` VALUES ('1529402639368241167', '1529402639284355072', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241168', '1529402639284355072', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241169', '1529402639284355072', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinel:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241170', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241171', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241172', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241173', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241174', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241175', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241176', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241177', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241178', '1529402639284355073', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofa:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241179', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241180', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241181', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -2541,7 +2522,6 @@ CREATE TABLE `namespace_plugin_rel` ( INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822145','649330b6-c2d7-4edc-be8e-8a54df9eb385','1', NULL, 20, 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 ('1801816010882822146','649330b6-c2d7-4edc-be8e-8a54df9eb385','10', NULL, 140, 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 ('1801816010882822147','649330b6-c2d7-4edc-be8e-8a54df9eb385','11', '{\"protocol\":\"zookeeper\",\"register\":\"127.0.0.1:2181\",\"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 ('1801816010882822148','649330b6-c2d7-4edc-be8e-8a54df9eb385','12', NULL, 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 ('1801816010882822149','649330b6-c2d7-4edc-be8e-8a54df9eb385','13', '{\"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 ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '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..cc3e7b8d4677 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,tars,websocket,motan,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'; @@ -947,7 +947,6 @@ COMMENT ON COLUMN "public"."plugin"."plugin_jar" IS 'plugin jar'; -- ---------------------------- INSERT INTO "public"."plugin" VALUES ('1', 'sign', NULL, 'Authentication', 20, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('10', 'sentinel', NULL, 'FaultTolerance', 140, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); -INSERT INTO "public"."plugin" VALUES ('11', 'sofa', '{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('12', 'resilience4j', NULL, 'FaultTolerance', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('13', 'tars', '{"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 ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1068,10 +1067,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136285', '4', 'mode', INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136286', '4', 'master', 'master', 2, 3, 2, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136287', '4', 'url', 'url', 2, 3, 3, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136288', '4', 'password', 'password', 2, 3, 4, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136289', '11', 'protocol', 'protocol', 2, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136290', '11', 'register', 'register', 2, 3, 2, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1729403902775136289', '11', 'protocol', 'protocol', 2, 1, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1729403902775136290', '11', 'register', 'register', 2, 1, 2, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136291', '2', 'model', 'model', 2, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136292', '6', 'register', 'register', 2, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136293', '4', 'algorithmName', 'algorithmName', 3, 2, 1, '{"required":"1","defaultValue":"slidingWindow","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); @@ -1208,10 +1203,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524913', '13', 'coret INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524914', '13', 'threads', 'threads', 1, 3, 4, '{"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 ('1529403902783524915', '13', 'queues', 'queues', 1, 3, 5, '{"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 ('1529403902783524916', '13', 'threadpool', 'threadpool', 3, 3, 2, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524917', '11', 'corethreads', 'corethreads', 1, 3, 4, '{"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 ('1529403902783524918', '11', 'threads', 'threads', 1, 3, 5, '{"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 ('1529403902783524919', '11', 'queues', 'queues', 1, 3, 6, '{"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 ('1529403902783524920', '11', 'threadpool', 'threadpool', 3, 3, 3, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1537326008606343168', '31', 'responseContent', 'responseContent', 2, 2, 0, '{"required":"0","rule":""}', '2022-06-16 14:47:37', '2022-06-16 14:50:39'); INSERT INTO "public"."plugin_handle" VALUES ('1537325892176658432', '31', 'httpStatusCode', 'httpStatusCode', 1, 2, 0, '{"required":"0","defaultValue":"200","rule":""}', '2022-06-16 14:47:09', '2022-06-16 14:50:39'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524921', '32', 'host', 'host', 2, 3, 2, '{"required":"1","defaultValue":"localhost"}', '2022-06-19 22:00:00', '2022-06-19 22:00:00'); @@ -1549,7 +1540,6 @@ INSERT INTO "public"."resource" VALUES ('1386680049203195915', '1346777157943259 INSERT INTO "public"."resource" VALUES ('1386680049203195916', '1346777157943259136', 'SHENYU.COMMON.IMPORT', '', '', '', 2, 0, '', 1, 0, 'system:manager:importConfig', 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."resource" VALUES ('1529403932772798464', '1346775491550474240', 'sign', 'sign', '/plug/sign', 'sign', 1, 0, 'pic-center', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187072', '1346775491550474240', 'sentinel', 'sentinel', '/plug/sentinel', 'sentinel', 1, 0, 'database', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932781187073', '1346775491550474240', 'sofa', 'sofa', '/plug/sofa', 'sofa', 1, 0, 'key', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187074', '1346775491550474240', 'resilience4j', 'resilience4j', '/plug/resilience4j', 'resilience4j', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187075', '1346775491550474240', 'tars', 'tars', '/plug/tars', 'tars', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); 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'); @@ -1593,15 +1583,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932877656078', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932877656079', '1529403932781187072', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656080', '1529403932781187072', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656081', '1529403932781187072', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinel:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656082', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656083', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656084', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656085', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656086', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656087', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656088', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656089', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656090', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofa:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656091', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656092', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656093', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2726,7 +2707,6 @@ COMMENT ON COLUMN "public"."namespace_plugin_rel"."date_updated" IS 'Update time INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822145','649330b6-c2d7-4edc-be8e-8a54df9eb385','1', NULL, 20, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822146','649330b6-c2d7-4edc-be8e-8a54df9eb385','10', NULL, 140, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822147','649330b6-c2d7-4edc-be8e-8a54df9eb385','11', '{"protocol":"zookeeper","register":"127.0.0.1:2181","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 ('1801816010882822148','649330b6-c2d7-4edc-be8e-8a54df9eb385','12', NULL, 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822149','649330b6-c2d7-4edc-be8e-8a54df9eb385','13', '{"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 ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '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..6cfa0ff98dc0 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,tars,websocket,motan,grpc'; comment on column API.state is '0-unpublished,1-published,2-offline'; comment on column API.ext @@ -1158,7 +1158,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, config,enabled) VALUES ('6','dubbo','Proxy', 310,'{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', '0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('9','hystrix', 'FaultTolerance', 130,'0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('10','sentinel', 'FaultTolerance', 140,'0'); -INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config, enabled) VALUES ('11','sofa', 'Proxy', 310, '{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}', '0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('12','resilience4j', 'FaultTolerance', 310,'0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config, enabled) VALUES ('13', 'tars', '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 ('14', 'contextPath', 'HttpProcess', 80,'1'); @@ -1527,18 +1526,6 @@ values ('1518229897210273823', '4', 'url', 'url', 2, 3, 3, null); insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) values ('1518229897210273824', '4', 'password', 'password', 2, 3, 4, null); -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1518229897210273825', '11', 'protocol', 'protocol', 2, 3, 1, null); - -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1518229897210273826', '11', 'register', 'register', 2, 3, 2, null); - -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1718229897210273825', '11', 'protocol', 'protocol', 2, 1, 1, null); - -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1718229897210273826', '11', 'register', 'register', 2, 1, 2, null); - insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) values ('1518229897210273827', '2', 'model', 'model', 2, 3, 1, null); @@ -1716,18 +1703,6 @@ values ('1518229897214468116', '6', 'group', 'group', 2, 1, 3, '{"required":"0", insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) values ('1518229897214468117', '6', 'loadbalance', 'loadbalance', 3, 2, 0, '{"required":"0","placeholder":"loadbalance","rule":""}'); -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1518229897214468164', '11', 'corethreads', 'corethreads', 1, 3, 4, '{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}'); - -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1518229897214468165', '11', 'threads', 'threads', 1, 3, 5, '{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}'); - -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1518229897214468166', '11', 'queues', 'queues', 1, 3, 6, '{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}'); - -insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) -values ('1518229897214468167', '11', 'threadpool', 'threadpool', 3, 3, 3, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}'); - insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, EXT_OBJ) values ('1537326008606343168', '31', 'responseContent', 'responseContent', 2, 2, 0, '{"required":"0","rule":""}'); @@ -3011,7 +2986,6 @@ COMMENT ON COLUMN namespace_plugin_rel.date_updated IS 'Update time'; INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822145','649330b6-c2d7-4edc-be8e-8a54df9eb385','1', NULL, 20, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822146','649330b6-c2d7-4edc-be8e-8a54df9eb385','10', NULL, 140, 0); -INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822147','649330b6-c2d7-4edc-be8e-8a54df9eb385','11', '{"protocol":"zookeeper","register":"127.0.0.1:2181","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 ('1801816010882822148','649330b6-c2d7-4edc-be8e-8a54df9eb385','12', NULL, 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 ('1801816010882822149','649330b6-c2d7-4edc-be8e-8a54df9eb385','13', '{"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 ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1); @@ -3815,4 +3789,4 @@ INSERT INTO permission (id, object_id, resource_id, date_created, date_updated) INSERT INTO permission (id, object_id, resource_id, date_created, date_updated) VALUES ('1953049887387303902', '1346358560427216896', '1953048313980116901', sysdate, sysdate); INSERT INTO permission (id, object_id, resource_id, date_created, date_updated) VALUES ('1953049887387303903', '1346358560427216896', '1953048313980116902', sysdate, sysdate); INSERT INTO permission (id, object_id, resource_id, date_created, date_updated) VALUES ('1953049887387303904', '1346358560427216896', '1953048313980116903', sysdate, sysdate); -INSERT INTO permission (id, object_id, resource_id, date_created, date_updated) VALUES ('1953049887387303905', '1346358560427216896', '1953048313980116904', sysdate, sysdate); \ No newline at end of file +INSERT INTO permission (id, object_id, resource_id, date_created, date_updated) VALUES ('1953049887387303905', '1346358560427216896', '1953048313980116904', sysdate, sysdate); diff --git a/db/init/pg/create-table.sql b/db/init/pg/create-table.sql index d1e0130fd33d..6387bafaf618 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,tars,websocket,motan,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'; @@ -1005,7 +1005,6 @@ COMMENT ON COLUMN "public"."plugin"."plugin_jar" IS 'plugin jar'; -- ---------------------------- INSERT INTO "public"."plugin" VALUES ('1', 'sign', NULL, 'Authentication', 20, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('10', 'sentinel', NULL, 'FaultTolerance', 140, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); -INSERT INTO "public"."plugin" VALUES ('11', 'sofa', '{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('12', 'resilience4j', NULL, 'FaultTolerance', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('13', 'tars', '{"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 ('14', 'contextPath', NULL, 'HttpProcess', 80, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1126,10 +1125,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136285', '4', 'mode', INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136286', '4', 'master', 'master', 2, 3, 2, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136287', '4', 'url', 'url', 2, 3, 3, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136288', '4', 'password', 'password', 2, 3, 4, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136289', '11', 'protocol', 'protocol', 2, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136290', '11', 'register', 'register', 2, 3, 2, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1729403902775136289', '11', 'protocol', 'protocol', 2, 1, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1729403902775136290', '11', 'register', 'register', 2, 1, 2, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136291', '2', 'model', 'model', 2, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136292', '6', 'register', 'register', 2, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902775136293', '4', 'algorithmName', 'algorithmName', 3, 2, 1, '{"required":"1","defaultValue":"slidingWindow","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); @@ -1265,10 +1260,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524913', '13', 'coret INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524914', '13', 'threads', 'threads', 1, 3, 4, '{"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 ('1529403902783524915', '13', 'queues', 'queues', 1, 3, 5, '{"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 ('1529403902783524916', '13', 'threadpool', 'threadpool', 3, 3, 2, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524917', '11', 'corethreads', 'corethreads', 1, 3, 4, '{"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 ('1529403902783524918', '11', 'threads', 'threads', 1, 3, 5, '{"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 ('1529403902783524919', '11', 'queues', 'queues', 1, 3, 6, '{"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 ('1529403902783524920', '11', 'threadpool', 'threadpool', 3, 3, 3, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1537326008606343168', '31', 'responseContent', 'responseContent', 2, 2, 0, '{"required":"0","rule":""}', '2022-06-16 14:47:37', '2022-06-16 14:50:39'); INSERT INTO "public"."plugin_handle" VALUES ('1537325892176658432', '31', 'httpStatusCode', 'httpStatusCode', 1, 2, 0, '{"required":"0","defaultValue":"200","rule":""}', '2022-06-16 14:47:09', '2022-06-16 14:50:39'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524921', '32', 'host', 'host', 2, 3, 2, '{"required":"1","defaultValue":"localhost"}', '2022-06-19 22:00:00', '2022-06-19 22:00:00'); @@ -1606,7 +1597,6 @@ INSERT INTO "public"."resource" VALUES ('1386680049203195915', '1346777157943259 INSERT INTO "public"."resource" VALUES ('1386680049203195916', '1346777157943259136', 'SHENYU.COMMON.IMPORT', '', '', '', 2, 0, '', 1, 0, 'system:manager:importConfig', 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."resource" VALUES ('1529403932772798464', '1346775491550474240', 'sign', 'sign', '/plug/sign', 'sign', 1, 0, 'pic-center', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187072', '1346775491550474240', 'sentinel', 'sentinel', '/plug/sentinel', 'sentinel', 1, 0, 'database', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932781187073', '1346775491550474240', 'sofa', 'sofa', '/plug/sofa', 'sofa', 1, 0, 'key', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187074', '1346775491550474240', 'resilience4j', 'resilience4j', '/plug/resilience4j', 'resilience4j', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187075', '1346775491550474240', 'tars', 'tars', '/plug/tars', 'tars', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); 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'); @@ -1650,15 +1640,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932877656078', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932877656079', '1529403932781187072', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656080', '1529403932781187072', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinelRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656081', '1529403932781187072', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sentinel:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656082', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656083', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656084', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656085', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656086', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656087', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656088', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656089', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofaRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656090', '1529403932781187073', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:sofa:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656091', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656092', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656093', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2843,7 +2824,6 @@ COMMENT ON COLUMN "public"."namespace_plugin_rel"."date_updated" IS 'Update time INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822145','649330b6-c2d7-4edc-be8e-8a54df9eb385','1', NULL, 20, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822146','649330b6-c2d7-4edc-be8e-8a54df9eb385','10', NULL, 140, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822147','649330b6-c2d7-4edc-be8e-8a54df9eb385','11', '{"protocol":"zookeeper","register":"127.0.0.1:2181","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 ('1801816010882822148','649330b6-c2d7-4edc-be8e-8a54df9eb385','12', NULL, 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822149','649330b6-c2d7-4edc-be8e-8a54df9eb385','13', '{"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 ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/upgrade/2.4.1-upgrade-2.4.2-mysql.sql b/db/upgrade/2.4.1-upgrade-2.4.2-mysql.sql index a337e069694b..5e15fd98975f 100644 --- a/db/upgrade/2.4.1-upgrade-2.4.2-mysql.sql +++ b/db/upgrade/2.4.1-upgrade-2.4.2-mysql.sql @@ -20,7 +20,6 @@ -- name & role UPDATE plugin SET role = 'Authentication' WHERE name = 'sign'; UPDATE plugin SET role = 'FaultTolerance' WHERE name = 'sentinel'; -UPDATE plugin SET role = 'Proxy' WHERE name = 'sofa'; UPDATE plugin SET role = 'FaultTolerance' WHERE name = 'resilience4j'; UPDATE plugin SET role = 'Proxy' WHERE name = 'tars'; UPDATE plugin SET role = 'HttpProcess', name = 'contextPath' WHERE name = 'context_path'; diff --git a/db/upgrade/2.4.1-upgrade-2.4.2-pg.sql b/db/upgrade/2.4.1-upgrade-2.4.2-pg.sql index 7f5f346fa76f..6c969f763e1a 100644 --- a/db/upgrade/2.4.1-upgrade-2.4.2-pg.sql +++ b/db/upgrade/2.4.1-upgrade-2.4.2-pg.sql @@ -20,7 +20,6 @@ -- name & role UPDATE plugin SET role = 'Authentication' WHERE name = 'sign'; UPDATE plugin SET role = 'FaultTolerance' WHERE name = 'sentinel'; -UPDATE plugin SET role = 'Proxy' WHERE name = 'sofa'; UPDATE plugin SET role = 'FaultTolerance' WHERE name = 'resilience4j'; UPDATE plugin SET role = 'Proxy' WHERE name = 'tars'; UPDATE plugin SET role = 'HttpProcess', name = 'contextPath' WHERE name = 'context_path'; diff --git a/db/upgrade/2.4.3-upgrade-2.5.0-mysql.sql b/db/upgrade/2.4.3-upgrade-2.5.0-mysql.sql index 30f078aeab9e..5d1337c35069 100644 --- a/db/upgrade/2.4.3-upgrade-2.5.0-mysql.sql +++ b/db/upgrade/2.4.3-upgrade-2.5.0-mysql.sql @@ -66,11 +66,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613204172868', '13', 'corethreads', INSERT INTO `plugin_handle` VALUES ('1529402613204172869', '13', 'threads', 'threads', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172870', '13', 'queues', 'queues', 1, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172871', '13', 'threadpool', 'threadpool', 3, 3, 2, '{\"required\":\"0\",\"defaultValue\":\"default\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); --- insert plugin_handle data for sofa -INSERT INTO `plugin_handle` VALUES ('1529402613204172872', '11', 'corethreads', 'corethreads', 1, 3, 4, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172873', '11', 'threads', 'threads', 1, 3, 5, '{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172874', '11', 'queues', 'queues', 1, 3, 6, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172875', '11', 'threadpool', 'threadpool', 3, 3, 3, '{\"required\":\"0\",\"defaultValue\":\"default\",\"placeholder\":\"threadpool\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `resource` VALUES ('1534577121923309568', '', 'SHENYU.MENU.DOCUMENT', '', '/document', '', 0, 3, 'file-text', 0, 0, '', 1, '2022-06-09 00:44:32', '2022-06-09 01:06:45'); INSERT INTO `resource` VALUES ('1534585430311051264', '1534577121923309568', 'SHENYU.MENU.DOCUMENT.APIDOC', '', '/document/apidoc', '', 1, 0, 'api', 0, 0, '', 1, '2022-06-09 01:17:32', '2022-06-09 01:17:32'); @@ -131,6 +126,5 @@ UPDATE plugin SET config='{"multiSelectorHandle":"1","multiRuleHandle":"0","thre UPDATE plugin SET config='{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}' WHERE `name` = 'tars'; -- Note: because most users have changed ZK configuration, the following SQLs are annotated to prevent erroneous execution -- UPDATE plugin SET config='{"register":"127.0.0.1:2181","threadpool":"shared"}' WHERE "name" = 'motan'; --- UPDATE plugin SET config='{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}' WHERE "name" = 'sofa'; -- UPDATE plugin SET config='{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared"}' WHERE "name" = 'dubbo'; -- if you want to execute this SQL, please replace it with your ZK configuration diff --git a/db/upgrade/2.4.3-upgrade-2.5.0-pg.sql b/db/upgrade/2.4.3-upgrade-2.5.0-pg.sql index 7d00a4688aa1..bb30af361043 100644 --- a/db/upgrade/2.4.3-upgrade-2.5.0-pg.sql +++ b/db/upgrade/2.4.3-upgrade-2.5.0-pg.sql @@ -76,11 +76,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524913', '13', 'coret INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524914', '13', 'threads', 'threads', 1, 3, 4, '{"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 ('1529403902783524915', '13', 'queues', 'queues', 1, 3, 5, '{"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 ('1529403902783524916', '13', 'threadpool', 'threadpool', 3, 3, 2, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); --- insert plugin_handle data for sofa -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524917', '11', 'corethreads', 'corethreads', 1, 3, 4, '{"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 ('1529403902783524918', '11', 'threads', 'threads', 1, 3, 5, '{"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 ('1529403902783524919', '11', 'queues', 'queues', 1, 3, 6, '{"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 ('1529403902783524920', '11', 'threadpool', 'threadpool', 3, 3, 3, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."resource" VALUES ('1534577121923309568', '', 'SHENYU.MENU.DOCUMENT', '', '/document', '', 0, 3, 'file-text', 0, 0, '', 1, '2022-06-09 00:44:32', '2022-06-09 01:06:45'); INSERT INTO "public"."resource" VALUES ('1534585430311051264', '1534577121923309568', 'SHENYU.MENU.DOCUMENT.APIDOC', '', '/document/apidoc', '', 1, 0, 'api', 0, 0, '', 1, '2022-06-09 01:17:32', '2022-06-09 01:17:32'); @@ -143,6 +138,5 @@ UPDATE plugin SET config='{"multiSelectorHandle":"1","multiRuleHandle":"0","thre UPDATE plugin SET config='{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}' WHERE "name" = 'tars'; -- Note: because most users have changed ZK configuration, the following SQLs are annotated to prevent erroneous execution -- UPDATE plugin SET config='{"register":"127.0.0.1:2181","threadpool":"shared"}' WHERE "name" = 'motan'; --- UPDATE plugin SET config='{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}' WHERE "name" = 'sofa'; -- UPDATE plugin SET config='{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared"}' WHERE "name" = 'dubbo'; -- if you want to execute this SQL, please replace it with your ZK configuration diff --git a/db/upgrade/2.5.0-upgrade-2.5.1-mysql.sql b/db/upgrade/2.5.0-upgrade-2.5.1-mysql.sql index 2cfc96e8b583..0ebed8d8dee0 100644 --- a/db/upgrade/2.5.0-upgrade-2.5.1-mysql.sql +++ b/db/upgrade/2.5.0-upgrade-2.5.1-mysql.sql @@ -313,7 +313,7 @@ CREATE TABLE IF NOT EXISTS `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,springCloud,motan,grpc', + `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,tars,websocket,springCloud,motan,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', diff --git a/db/upgrade/2.5.0-upgrade-2.5.1-oracle.sql b/db/upgrade/2.5.0-upgrade-2.5.1-oracle.sql index ce3b6e398f7e..e861bc96c6f9 100644 --- a/db/upgrade/2.5.0-upgrade-2.5.1-oracle.sql +++ b/db/upgrade/2.5.0-upgrade-2.5.1-oracle.sql @@ -407,7 +407,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,springCloud,motan,grpc'; + is 'http,dubbo,tars,websocket,springCloud,motan,grpc'; comment on column API.state is '0-unpublished,1-published,2-offline'; comment on column API.ext diff --git a/db/upgrade/2.5.0-upgrade-2.5.1-pg.sql b/db/upgrade/2.5.0-upgrade-2.5.1-pg.sql index 17efe116be3b..acc5c8e5cbf6 100644 --- a/db/upgrade/2.5.0-upgrade-2.5.1-pg.sql +++ b/db/upgrade/2.5.0-upgrade-2.5.1-pg.sql @@ -349,7 +349,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,springCloud,motan,grpc'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,tars,websocket,springCloud,motan,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'; 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..d42ca9c27dd3 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 deprecated rpc plugin data */ +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` = '11') AS `deprecated_rpc_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` = '11') AS `deprecated_rpc_rule_ids` +); +DELETE FROM `rule` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '11') AS `deprecated_rpc_selector_ids` +); +DELETE FROM `selector_condition` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '11') AS `deprecated_rpc_selector_ids` +); +DELETE FROM `selector` WHERE `plugin_id` = '11'; +DELETE FROM `meta_data` WHERE `rpc_type` = 'sofa'; +DELETE FROM `api` WHERE `rpc_type` = 'sofa'; +DELETE FROM `permission` WHERE `resource_id` IN ('1529402639284355073', '1529402639368241170', '1529402639368241171', '1529402639368241172', '1529402639368241173', '1529402639368241174', '1529402639368241175', '1529402639368241176', '1529402639368241177', '1529402639368241178'); +DELETE FROM `resource` WHERE `id` IN ('1529402639284355073', '1529402639368241170', '1529402639368241171', '1529402639368241172', '1529402639368241173', '1529402639368241174', '1529402639368241175', '1529402639368241176', '1529402639368241177', '1529402639368241178'); +DELETE FROM `namespace_plugin_rel` WHERE `plugin_id` = '11'; +DELETE FROM `plugin_handle` WHERE `plugin_id` = '11'; +DELETE FROM `plugin` WHERE `id` = '11'; +ALTER TABLE `api` MODIFY COLUMN `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,tars,websocket,springCloud,motan,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..48ccd5ca0802 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 deprecated rpc plugin data */ +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" = '11' + ) AS "deprecated_rpc_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" = '11' + ) AS "deprecated_rpc_rule_ids" +); +DELETE FROM "public"."rule" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '11') AS "deprecated_rpc_selector_ids" +); +DELETE FROM "public"."selector_condition" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '11') AS "deprecated_rpc_selector_ids" +); +DELETE FROM "public"."selector" WHERE "plugin_id" = '11'; +DELETE FROM "public"."meta_data" WHERE "rpc_type" = 'sofa'; +DELETE FROM "public"."api" WHERE "rpc_type" = 'sofa'; +DELETE FROM "public"."permission" WHERE "resource_id" IN ('1529403932781187073', '1529403932877656082', '1529403932877656083', '1529403932877656084', '1529403932877656085', '1529403932877656086', '1529403932877656087', '1529403932877656088', '1529403932877656089', '1529403932877656090'); +DELETE FROM "public"."resource" WHERE "id" IN ('1529403932781187073', '1529403932877656082', '1529403932877656083', '1529403932877656084', '1529403932877656085', '1529403932877656086', '1529403932877656087', '1529403932877656088', '1529403932877656089', '1529403932877656090'); +DELETE FROM "public"."namespace_plugin_rel" WHERE "plugin_id" = '11'; +DELETE FROM "public"."plugin_handle" WHERE "plugin_id" = '11'; +DELETE FROM "public"."plugin" WHERE "id" = '11'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,tars,websocket,springCloud,motan,grpc'; diff --git a/pom.xml b/pom.xml index 7cd7fb444f68..6d66d1c9df9a 100644 --- a/pom.xml +++ b/pom.xml @@ -125,8 +125,6 @@ 0.15.0 0.15.0 2.5.0 - 5.13.0 - 2.1.1 1.7.2 5.7.0 3.0.1 @@ -290,38 +288,6 @@ ${apache.dubbo.version} - - com.alipay.sofa - sofa-rpc-all - ${sofa.rpc.version} - - - net.jcip - jcip-annotations - - - io.grpc - grpc-core - - - grpc-api - io.grpc - - - grpc-protobuf - io.grpc - - - grpc-stub - io.grpc - - - grpc-netty-shaded - io.grpc - - - - com.lmax disruptor 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..16ef9d645352 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. + * rpc type. */ 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..4f8a9814e091 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. + * rpc type. */ 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..f9cfa2a0f0bd 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. + * rpc type. */ private String rpcType; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterSofaServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterSofaServiceImpl.java deleted file mode 100644 index 232280679f22..000000000000 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterSofaServiceImpl.java +++ /dev/null @@ -1,63 +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.dto.convert.rule.impl.SofaRuleHandle; -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; - -/** - * sofa service register. - */ -@Service -public class ShenyuClientRegisterSofaServiceImpl extends AbstractShenyuClientRegisterServiceImpl { - - @Override - public String rpcType() { - return RpcTypeEnum.SOFA.getName(); - } - - @Override - protected String selectorHandler(final MetaDataRegisterDTO metaDataDTO) { - return ""; - } - - @Override - protected String ruleHandler() { - return new SofaRuleHandle().toJson(); - } - - @Override - protected void registerMetadata(final MetaDataRegisterDTO metaDataDTO) { - MetaDataService metaDataService = getMetaDataService(); - MetaDataDO exist = metaDataService.findByServiceNameAndMethodNameAndNamespaceId(metaDataDTO.getServiceName(), metaDataDTO.getMethodName(), 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 16dd2dd278a1..b91ddaeb6404 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,tars,websocket,motan,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', @@ -566,7 +566,6 @@ INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,`enabled`) V INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,`enabled`) VALUES ('6','dubbo','Proxy', 310,'{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', '0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('9','hystrix', 'FaultTolerance', 130,'0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('10','sentinel', 'FaultTolerance', 140,'0'); -INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) VALUES ('11','sofa', 'Proxy', 310, '{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}', '0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('12','resilience4j', 'FaultTolerance', 310,'0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) VALUES ('13', 'tars', 'Proxy', 310,'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}','0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('14', 'contextPath', 'HttpProcess', 80,'1'); @@ -648,10 +647,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 ('1529402613199978531', '4', 'master', 'master', 2, 3, 2); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978532', '4', 'url', 'url', 2, 3, 3); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978533', '4', 'password', 'password', 2, 3, 4); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978534', '11', 'protocol', 'protocol', 2, 3, 1); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978535', '11', 'register', 'register', 2, 3, 2); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1729402613199978534', '11', 'protocol', 'protocol', 2, 1, 1); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1729402613199978535', '11', 'register', 'register', 2, 1, 2); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978536', '2', 'model', 'model', 2, 3, 1); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978537', '6', 'register', 'register', 2, 3, 1); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978538', '4', 'algorithmName', 'algorithmName', 3, 2, 1, '{"required":"1","defaultValue":"slidingWindow","rule":""}'); @@ -786,10 +781,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`,`ext_obj`) VALUES ('1529402613204172869', '13', 'threads', 'threads', 1, 3, 4, '{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172870', '13', 'queues', 'queues', 1, 3, 5, '{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172871', '13', 'threadpool', 'threadpool', 3, 3, 2, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172872', '11', 'corethreads', 'corethreads', 1, 3, 4, '{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172873', '11', 'threads', 'threads', 1, 3, 5, '{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172874', '11', 'queues', 'queues', 1, 3, 6, '{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172875', '11', 'threadpool', 'threadpool', 3, 3, 3, '{"required":"0","defaultValue":"default","placeholder":"threadpool","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1537326008606343168', '31', 'responseContent', 'responseContent', 2, 2, 0, '{"required":"0","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1537325892176658432', '31', 'httpStatusCode', 'httpStatusCode', 1, 2, 0, '{"required":"0","defaultValue":"200","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172876', '32', 'host', 'host', 2, 3, 1, '{"required":"1","defaultValue":"localhost"}'); @@ -1442,7 +1433,6 @@ CREATE TABLE IF NOT EXISTS `namespace_plugin_rel` ( INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822145','649330b6-c2d7-4edc-be8e-8a54df9eb385','1', NULL, 20, 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 ('1801816010882822146','649330b6-c2d7-4edc-be8e-8a54df9eb385','10', NULL, 140, 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 ('1801816010882822147','649330b6-c2d7-4edc-be8e-8a54df9eb385','11', '{"protocol":"zookeeper","register":"127.0.0.1:2181","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 ('1801816010882822148','649330b6-c2d7-4edc-be8e-8a54df9eb385','12', NULL, 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 ('1801816010882822149','649330b6-c2d7-4edc-be8e-8a54df9eb385','13', '{"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 ('1801816010882822150','649330b6-c2d7-4edc-be8e-8a54df9eb385','14', NULL, 80, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/shenyu-admin/src/main/resources/static/index.814edc73.js b/shenyu-admin/src/main/resources/static/index.814edc73.js index 416a1cf127e8..ebe2e8791f95 100644 --- a/shenyu-admin/src/main/resources/static/index.814edc73.js +++ b/shenyu-admin/src/main/resources/static/index.814edc73.js @@ -1 +1 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="lVK7")}({"+/J2":function(e,t,n){"use strict";function r(e,t){var n=o(e),r=Number(t);return n.setMilliseconds(r),n}var o=n("xA5w");e.exports=r},"+0it":function(e,t,n){"use strict";function r(){function e(e,n,r,a){var i=n&&n.prototype instanceof t?n:t,c=Object.create(i.prototype);return o(c,"_invoke",function(e,t,n){function r(e,t){for(a=e,i=t,u=0;!f&&c&&!n&&u3?(n=h===t)&&(i=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=l):r[0]<=o&&((n=e<2&&ot||t>h)&&(r[4]=e,r[5]=t,p.n=h,a=0))}if(n||e>1)return d;throw f=!0,t}var o,a,i,c=0,s=n||[],f=!1,p={p:0,n:0,v:l,a:r,f:r.bind(l,4),d:function(e,t){return o=e,a=0,i=l,p.n=t,d}};return function(n,s,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&r(s,h),a=s,i=h;(u=a<2?l:i)||!f;){o||(a?a<3?(a>1&&(p.n=-1),r(a,i)):p.n=i:p.v=i);try{if(c=2,o){if(a||(n="next"),u=o[n]){if(!(u=u.call(o,i)))throw TypeError("iterator result is not an object");if(!u.done)return u;i=u.value,a<2&&(a=0)}else 1===a&&(u=o.return)&&u.call(o),a<2&&(i=TypeError("The iterator does not provide a '"+n+"' method"),a=1);o=l}else if((u=(f=p.n<0)?i:e.call(t,p))!==d)break}catch(e){o=l,a=1,i=e}finally{c=1}}return{value:u,done:f}}}(e,r,a),!0),c}function t(){}function n(){}function a(){}function i(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,o(e,f,"GeneratorFunction")),e.prototype=Object.create(h),e}var l,u,c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",f=c.toStringTag||"@@toStringTag",d={};u=Object.getPrototypeOf;var p=[][s]?u(u([][s]())):(o(u={},s,function(){return this}),u),h=a.prototype=t.prototype=Object.create(p);return n.prototype=a,o(h,"constructor",a),o(a,"constructor",n),n.displayName="GeneratorFunction",o(a,f,"GeneratorFunction"),o(h),o(h,f,"Generator"),o(h,s,function(){return this}),o(h,"toString",function(){return"[object Generator]"}),(r=function(){return{w:e,m:i}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))})(e,t,n,r)}function a(e){return i.apply(this,arguments)}function i(){return i=(0,u.default)(r().m(function e(t){return r().w(function(e){for(;;)switch(e.n){case 0:return e.a(2,(0,c.default)("/api/".concat(t)))}},e)})),i.apply(this,arguments)}var l=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.query=a;var u=l(n("jlIA")),c=l(n("vLgD"))},"+1cx":function(e,t,n){"use strict";function r(e){return e[i]={},o(e)}function o(e){return e[i]}function a(e){delete e[i]}var i="_erd";e.exports={initState:r,getState:o,cleanState:a}},"+3wZ":function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return e}e.exports=r},"+4V2":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e,t,n){return t=(0,S.default)(t),(0,b.default)(e,a()?Reflect.construct(t,n||[],(0,S.default)(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var i=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n("sRCI");var l=i(n("vnWH"));n("7WgF");var u=i(n("jf3V"));n("crfj");var c=i(n("zwGx"));n("Qbm7");var s=i(n("aOwA"));n("HCp1");var f=i(n("GWr5"));n("rpBe");var d=i(n("hK1P"));n("baa2");var p=i(n("FC3+"));n("faxx");var h=i(n("FV1P"));n("mxhB");var v=i(n("zJZ/"));n("JYrs");var y=i(n("QoDT")),m=i(n("Q9dM")),g=i(n("wm7F")),b=i(n("F6AD")),S=i(n("fghW")),E=i(n("QwVp"));n("LHBr");var _=i(n("A+AJ"));n("qK5s");var O,C,M=i(n("N0tX")),w=r(n("GiK3")),x=n("S6G3"),T=n("KPPu"),P=n("oAV5"),N=n("lXsO"),I=M.default.TreeNode,k=_.default.Search;t.default=(O=(0,x.connect)(function(e){var t=e.dataPermission,n=e.resource,r=e.global,o=e.loading;return{dataPermission:t,resource:n,global:r,namespaces:r.namespaces,selectorPermisionLoading:o.effects["dataPermission/fetchDataPermisionSelectors"],rulePermisionLoading:o.effects["dataPermission/fetchDataPermisionRules"]}}))(C=function(e){function t(e){var n;return(0,m.default)(this,t),n=o(this,t,[e]),n.getPluginTreeData=function(){var e=n.props.dispatch,t=n.state.currentNamespaceId;e({type:"resource/fetchMenuTree"}),e({type:"global/fetchPluginsByNamespace",payload:{namespaceId:t}})},n.getPermissionSelectorList=function(e){var t=n.props,r=t.dispatch,o=t.userId,a=n.state,i=a.currentPlugin,l=a.pageSize,u=a.currentNamespaceId;r({type:"dataPermission/fetchDataPermisionSelectors",payload:{currentPage:e,pageSize:l,userId:o,pluginId:i.pluginId,namespaceId:u},callback:function(e){n.setState({selectorData:e})}})},n.getPermissionRuleList=function(e,t){var r=n.props,o=r.dispatch,a=r.userId,i=n.state,l=i.currentPlugin,u=i.ruleListMap;o({type:"dataPermission/fetchDataPermisionRules",payload:{currentPage:t,pageSize:i.pageSize,userId:a,pluginId:l.pluginId,selectorId:e},callback:function(t){t.dataList&&t.dataList.length>0&&t.dataList.forEach(function(t){t.selectorId=e}),u[e]&&u[e].currentRulePage?t.currentRulePage=u[e].currentRulePage:t.currentRulePage=1,u[e]=t,n.setState({ruleListMap:u})}})},n.onSelectPlugin=function(e,t){var r=t.node.props.dataRef;n.setState({currentPlugin:r,currentPermissionSelectorPage:1,ruleListMap:{}},function(){n.getPermissionSelectorList(1)})},n.handleCheckSelector=function(e){var t=n.props,r=t.dispatch,o=t.userId,a=n.state.currentPermissionSelectorPage;r({type:e.isChecked?"dataPermission/deletePermisionSelector":"dataPermission/addPermisionSelector",payload:{dataId:e.dataId,userId:o},callback:function(){n.getPermissionSelectorList(a),n.getPermissionRuleList(e.dataId,1)}})},n.handleCheckRule=function(e){var t=n.props,r=t.dispatch,o=t.userId,a=n.state,i=a.currentPermissionSelectorPage,l=a.ruleListMap;r({type:e.isChecked?"dataPermission/deletePermisionRule":"dataPermission/addPermisionRule",payload:{dataId:e.dataId,userId:o},callback:function(){n.getPermissionSelectorList(i);var t=l[e.selectorId].currentRulePage||1;n.getPermissionRuleList(e.selectorId,t)}})},n.handleExpandRuleTable=function(e,t){var r=n.state.selectorExpandedRowKeys;e?(r.push(t.dataId),n.setState({selectorExpandedRowKeys:r})):(r=r.filter(function(e){return e!==t.dataId}),n.setState({selectorExpandedRowKeys:r})),n.getPermissionRuleList(t.dataId,1)},n.selectorPageOnchange=function(e){n.setState({currentPermissionSelectorPage:e}),n.getPermissionSelectorList(e)},n.rulePageOnchange=function(e,t){var r=n.state.ruleListMap;r[t].currentRulePage=e,n.setState({ruleListMap:r},function(){n.getPermissionRuleList(t,e)})},n.filterPlugin=function(){var e=n.props,t=e.global.plugins,r=e.resource.menuTree,o=n.state.searchValue,a=r.filter(function(e){return"/plug"===e.url});if(a&&a.length>0){a=a[0].children;var i=[];a.forEach(function(e){if("string"!=typeof o||!o.length||e.name.toLocaleLowerCase().includes(o.toLocaleLowerCase())){var n=t.find(function(t){return t.name===e.name});if(n){var r=i.find(function(e){return e.title===n.role});r||(i.push({title:n.role,key:n.role,selectable:!1,icon:"unordered-list",sort:e.sort,children:[]}),r=i[i.length-1]),r.children.push({key:n.pluginId,title:(0,P.titleCase)(n.name),selectable:!0,sort:e.sort,icon:e.meta.icon,pluginId:n.pluginId})}}}),a=i}return a},n.onSearch=function(e){var t=e.target.value;n.setState({searchValue:t})},n.renderPluginTree=function(){var e=n.filterPlugin();return w.default.createElement(h.default,{gutter:[16,16]},w.default.createElement(y.default,{span:24},w.default.createElement(k,{placeholder:(0,T.getIntlContent)("SHENYU.PLUGIN.INPUTNAME"),onChange:n.onSearch})),e.length>0?w.default.createElement(y.default,{span:24},w.default.createElement(M.default,{defaultExpandAll:!0,style:{background:"white"},onSelect:n.onSelectPlugin,showIcon:!0},n.renderTreeNodes(e))):w.default.createElement(y.default,{span:24},w.default.createElement(v.default,null)))},n.renderTreeNodes=function(e){return e.map(function(e){return e.children&&e.children.length>0?w.default.createElement(I,{selectable:e.selectable,title:e.title,icon:w.default.createElement(p.default,{type:e.icon}),key:e.key,dataRef:e},n.renderTreeNodes(e.children)):w.default.createElement(I,{icon:w.default.createElement(p.default,{type:e.icon}),title:e.title,key:e.key,dataRef:e})})},n.renderSelectorRuleTable=function(){var e=n.state,t=e.currentPermissionSelectorPage,r=e.pageSize,o=n.state,a=o.selectorData,i=o.ruleListMap,l=o.selectorExpandedRowKeys,u=[{title:(0,T.getIntlContent)("SHENYU.SYSTEM.DATA.PERMISSION.CHECKED"),dataIndex:"isChecked",width:90,key:"isChecked",render:function(e,t){return w.default.createElement(d.default,{checked:e,onClick:n.handleCheckRule.bind(n,t)})}},{title:(0,T.getIntlContent)("SHENYU.SYSTEM.DATA.PERMISSION.RULENAME"),dataIndex:"dataName",key:"dataName"}],c=function(e){var t=i&&i[e.dataId],o=t&&t.currentRulePage;return w.default.createElement(f.default,{size:"small",bordered:!0,columns:u,dataSource:t&&t.dataList,pagination:{total:t&&t.total||0,current:o||1,pageSize:r,onChange:function(t){n.rulePageOnchange(t,e.dataId)}}})},s=[{title:(0,T.getIntlContent)("SHENYU.SYSTEM.DATA.PERMISSION.CHECKED"),dataIndex:"isChecked",width:90,key:"isChecked",render:function(e,t){return w.default.createElement(d.default,{checked:e,onClick:n.handleCheckSelector.bind(n,t)})}},{title:(0,T.getIntlContent)("SHENYU.SYSTEM.DATA.PERMISSION.SELECTORNAME"),dataIndex:"dataName",key:"dataName"}];return w.default.createElement(f.default,{style:{width:"350px"},size:"small",bordered:!0,columns:s,expandedRowRender:c,dataSource:a&&a.dataList,rowKey:"dataId",expandedRowKeys:l,onExpand:n.handleExpandRuleTable,pagination:{total:a&&a.total,current:t,pageSize:r,onChange:n.selectorPageOnchange}})},n.handleNamespacesValueChange=function(e){var t=n.state.currentPlugin,r=n.props.dispatch;n.setState({currentNamespaceId:e.key},function(){t&&(n.setState({selectorExpandedRowKeys:[]}),n.getPermissionSelectorList(1)),r({type:"global/fetchPluginsByNamespace",payload:{namespaceId:e.key}})})},n.state={currentPlugin:null,currentPermissionSelectorPage:1,selectorData:null,pageSize:12,ruleListMap:{},searchValue:"",currentNamespaceId:N.defaultNamespaceId,selectorExpandedRowKeys:[]},n}return(0,E.default)(t,e),(0,g.default)(t,[{key:"componentDidMount",value:function(){this.getPluginTreeData()}},{key:"render",value:function(){var e,t=this.props,n=t.handleCancel,r=t.namespaces,o=this.state.currentNamespaceId;return w.default.createElement(l.default,{width:800,centered:!0,title:w.default.createElement("div",{style:{height:24,display:"flex",alignItems:"center",justifyContent:"space-between"}},w.default.createElement("div",null,(0,T.getIntlContent)("SHENYU.SYSTEM.DATA.PERMISSION.CONFIG")),w.default.createElement("div",{style:{marginRight:30}},w.default.createElement(u.default,{placement:"bottomCenter",overlay:w.default.createElement(s.default,{onClick:this.handleNamespacesValueChange},r.map(function(e){var t=o===e.namespaceId;return w.default.createElement(s.default.Item,{key:e.namespaceId,disabled:t},w.default.createElement("span",null,e.name))}))},w.default.createElement(c.default,null,w.default.createElement("a",{className:"ant-dropdown-link",style:{fontWeight:"bold"},onClick:function(e){return e.preventDefault()}},"".concat((0,T.getIntlContent)("SHENYU.SYSTEM.NAMESPACE")," / ").concat(null===(e=r.find(function(e){return o===e.namespaceId}))||void 0===e?void 0:e.name," ")),w.default.createElement(p.default,{type:"down"}))))),visible:!0,cancelText:(0,T.getIntlContent)("SHENYU.COMMON.CLOSE"),onCancel:n,footer:[w.default.createElement(c.default,{key:"back",onClick:n},(0,T.getIntlContent)("SHENYU.COMMON.CLOSE"))]},w.default.createElement(h.default,{gutter:20},w.default.createElement(y.default,{span:10,style:{minWidth:280}},this.renderPluginTree()),w.default.createElement(y.default,{span:14},this.renderSelectorRuleTable())))}}])}(w.Component))||C},"+66z":function(e,t,n){"use strict";function r(e){return a.call(e)}var o=Object.prototype,a=o.toString;e.exports=r},"+6Bu":function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},"+CM9":function(e,t,n){"use strict";var r=n("Ds5P"),o=n("ot5s")(!1),a=[].indexOf,i=!!a&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(i||!n("NNrz")(a)),"Array",{indexOf:function(e){return i?a.apply(this,arguments)||0:o(this,e,arguments[1])}})},"+E39":function(e,t,n){"use strict";e.exports=!n("S82l")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},"+JsQ":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e,t,n){return t=(0,O.default)(t),(0,_.default)(e,a()?Reflect.construct(t,n||[],(0,O.default)(e).constructor):t.apply(e,n))}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var i=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n("sRCI");var l=i(n("vnWH"));n("9SSc");var u=i(n("t5Df"));n("faxx");var c=i(n("FV1P"));n("JYrs");var s=i(n("QoDT")),f=i(n("uMMT"));n("crfj");var d=i(n("zwGx"));n("LHBr");var p=i(n("A+AJ"));n("s3t2");var h=i(n("m6wg"));n("/4RJ");var v=i(n("uz+M")),y=i(n("7b0f")),m=i(n("mAPx")),g=i(n("+TWC"));n("UQ5M");var b=i(n("/qCn")),S=i(n("Q9dM")),E=i(n("wm7F")),_=i(n("F6AD")),O=i(n("fghW")),C=i(n("QwVp"));n("cwkc");var M=i(n("8/ER"));n("gZEk");var w,x,T=i(n("8rR3")),P=r(n("GiK3")),N=n("S6G3"),I=i(n("ulXC")),k=n("KPPu"),A=i(n("Jcbv")),D=i(n("VvJF")),L=i(n("k2a8")),R=i(n("FsxU")),j=n("oAV5"),U=T.default.Item,H=M.default.Option,z=(w=(0,N.connect)(function(e){return{pluginHandle:e.pluginHandle,shenyuDict:e.shenyuDict,currentNamespaceId:e.global.currentNamespaceId}}))(x=function(e){function t(e){var n;(0,S.default)(this,t),n=o(this,t,[e]),n.initRuleCondition=function(e){var t=e.ruleConditions||[{paramType:"uri",operator:"pathPattern",paramName:"/",paramValue:""}];t.forEach(function(e,r){var o=e.paramType,a="paramTypeValueEn".concat(r);"uri"===o||"host"===o||"ip"===o?(n.state[a]=!0,t[r].paramName="/"):n.state[a]=!1}),n.state.ruleConditions=t},n.initDics=function(){n.initDic("operator"),n.initDic("matchMode"),n.initDic("paramType")},n.initDic=function(e){(0,n.props.dispatch)({type:"shenyuDict/fetchByType",payload:{type:e,callBack:function(t){n.state["".concat(e,"Dics")]=t}}})},n.checkConditions=function(){var e=n.state.ruleConditions,t=!0;return e?e.forEach(function(e,n){var r=e.paramType,o=e.operator,a=e.paramName,i=e.paramValue;r&&o&&("isBlank"===o||i)||(b.default.destroy(),b.default.error("Line ".concat(n+1," condition is incomplete")),t=!1),"uri"===r||"host"===r||"ip"===r||a||(b.default.destroy(),b.default.error("Line ".concat(n+1," condition is incomplete")),t=!1)}):(b.default.destroy(),b.default.error("Incomplete condition"),t=!1),t},n.handleSubmit=function(e){e.preventDefault();var t=n.props,r=t.form,o=t.handleOk,a=t.multiRuleHandle,i=n.state,l=i.ruleConditions,u=i.pluginHandleList;r.validateFieldsAndScroll(function(e,t){var r=t.name,i=t.matchMode,c=t.loged,s=t.enabled,f=t.matchRestful,d=t.handleType,p=t.handleJSON;if(!e){if(n.checkConditions()){var h;switch(d){case"1":h=[],u.forEach(function(e,n){h[n]={},e.forEach(function(e){h[n][e.field]=t[e.field+n]})}),h=a?JSON.stringify(h):JSON.stringify(h[0]);break;case"2":h=p}if(n.handleComponentRef){var v,y=n.handleComponentRef.getData(t);h=JSON.stringify((0,g.default)({},JSON.parse(null!==(v=h)&&void 0!==v?v:"{}"),JSON.parse(y)))}o({name:r,matchMode:i,handle:h,loged:c,enabled:s,matchRestful:f,sort:Number(t.sort),ruleConditions:l})}}})},n.handleAdd=function(){var e=n.state.ruleConditions;e.push({paramType:"uri",operator:"pathPattern",paramName:"/",paramValue:""}),n.setState({ruleConditions:e},function(){var t=e.length||0,r="paramTypeValueEn".concat(t-1);n.setState((0,m.default)({},r,!0))})},n.handleDelete=function(e){var t=n.state.ruleConditions;t&&t.length>1?t.splice(e,1):(b.default.destroy(),b.default.error("At least one condition")),n.setState({ruleConditions:t})},n.handleAddHandle=function(){var e=n.state.pluginHandleList,t=e[0],r=t.map(function(e){return(0,g.default)({},e,{value:null})});e.push(r),n.setState({pluginHandleList:e})},n.handleDeleteHandle=function(e){var t=n.state.pluginHandleList;1===t.length?(b.default.destroy(),b.default.error((0,k.getIntlContent)("SHENYU.PLUGIN.HANDLE.TIP"))):(t.splice(e,1),n.setState({pluginHandleList:t}))},n.conditionChange=function(e,t,r){var o=n.state.ruleConditions;if(o[e][t]=r,"paramType"===t){var a="paramTypeValueEn".concat(e);"uri"===r||"host"===r||"ip"===r||"req_method"===r||"domain"===r?(n.setState((0,m.default)({},a,!0)),o[e].paramName="/"):n.setState((0,m.default)({},a,!1)),"post"===r&&(o[e].paramName="filedName"),"query"===r&&(o[e].paramName="paramName"),"header"===r&&(o[e].paramName="headerName"),"cookie"===r&&(o[e].paramName="cookieName"),o[e].operator="uri"===r?"pathPattern":"req_method"===r?"=":""}n.setState({ruleConditions:o})},n.handleCopyData=function(e){if(!e)return void n.setState({visible:!1});var t=n.props.form,r=e.ruleConditions,o=e.name,a=e.matchMode,i=e.loged,l=e.enabled,u=e.sort,c={name:o,matchMode:a.toString(),loged:i,enabled:l,sort:u};n.initRuleCondition({ruleConditions:r.map(function(e){e.id,e.selectorId,e.dateCreated,e.dateUpdated;return(0,y.default)(e,["id","selectorId","dateCreated","dateUpdated"])})}),t.setFieldsValue(c),n.setState({visible:!1})},n.renderOperatorOptions=function(e,t){if(e&&e instanceof Array){var n=e.map(function(e){return P.default.createElement(H,{key:e.dictValue,value:e.dictValue},e.dictName)});return"uri"!==t&&(n=n.filter(function(e){return"pathPattern"!==e.key?e:""})),"post"!==t&&"query"!==t&&"header"!==t&&"cookie"!==t&&(n=n.filter(function(e){return"isBlank"!==e.key?e:""})),"uri"!==t&&"host"!==t&&"ip"!==t&&"cookie"!==t&&"domain"!==t||(n=n.filter(function(e){return"TimeBefore"!==e.key&&"TimeAfter"!==e.key?e:""})),"req_method"===t&&(n=n.filter(function(e){return"="===e.key?e:""})),n}return""},n.getParamValueInput=function(e,t){if("TimeBefore"===e.operator||"TimeAfter"===e.operator){var r=new Date,o=r.getFullYear().toString().concat("-").concat(r.getMonth()+1).concat("-").concat(r.getDate());return P.default.createElement(p.default.Group,{compact:!0,style:{top:-2}},P.default.createElement(v.default,{style:{width:"51%"},onChange:function(r){var a=r?r.eraYear().toString().concat("-").concat(r.month()+1).concat("-").concat(r.date()):o;n.conditionChange(t,"paramValue","".concat((0,j.formatDateString)(a)," ").concat((0,j.formatTimeString)(e.paramValue)))},value:(0,j.formatDate)(e.paramValue)}),P.default.createElement(h.default,{style:{width:"49%"},onChange:function(r){var o=r?"".concat(" ").concat(r.hours()).concat(":").concat(r.minutes()).concat(":").concat(r.seconds()):"";n.conditionChange(t,"paramValue","".concat((0,j.formatDateString)(e.paramValue)," ").concat((0,j.formatTimeString)(o)))},value:(0,j.formatTime)(e.paramValue)}))}return P.default.createElement(p.default,{allowClear:!0,onChange:function(e){n.conditionChange(t,"paramValue",e.target.value)},value:e.paramValue})};var r=Object.keys(L.default);return n.state={customRulePage:r.includes(e.pluginName),visible:!1},n.initRuleCondition(e),n.initDics(),n}return(0,C.default)(t,e),(0,E.default)(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.dispatch,r=t.pluginId,o=t.handle,a=t.multiRuleHandle,i=t.form.setFieldsValue,l=t.currentNamespaceId;this.setState({pluginHandleList:[]});n({type:"pluginHandle/fetchByPluginId",payload:{pluginId:r,type:2,handle:o,isHandleArray:a,namespaceId:l,callBack:function(t,n){e.setState({pluginHandleList:t},function(){n&&i({handleType:"2",handleJSON:o})})}}})}},{key:"render",value:function(){var e,t=this,n=this.props,r=n.onCancel,o=n.form,a=n.name,i=void 0===a?"":a,h=n.matchMode,v=void 0===h?"":h,y=n.loged,m=void 0===y||y,g=n.enabled,b=void 0===g||g,S=n.matchRestful,E=void 0!==S&&S,_=n.sort,O=void 0===_?"":_,C=n.multiRuleHandle,w=n.pluginName,x=n.handle,N=this.state,L=N.ruleConditions,j=N.pluginHandleList,z=N.operatorDics,Y=N.matchModeDics,V=N.paramTypeDics,F=N.customRulePage,W=N.visible;F?e=D.default:j&&(e=A.default);var B=o.getFieldDecorator,G={labelCol:{sm:{span:4}},wrapperCol:{sm:{span:20}}},q={labelCol:{sm:{span:18}},wrapperCol:{sm:{span:4}}};return P.default.createElement(l.default,{width:1e3,centered:!0,title:(0,k.getIntlContent)("SHENYU.RULE.NAME"),visible:!0,okText:(0,k.getIntlContent)("SHENYU.COMMON.SURE"),cancelText:(0,k.getIntlContent)("SHENYU.COMMON.CALCEL"),onOk:this.handleSubmit,onCancel:r},P.default.createElement(T.default,{onSubmit:this.handleSubmit,className:"login-form"},P.default.createElement(U,(0,f.default)({label:(0,k.getIntlContent)("SHENYU.PLUGIN.SELECTOR.LIST.COLUMN.NAME")},G),B("name",{rules:[{required:!0,message:(0,k.getIntlContent)("SHENYU.COMMON.INPUTNAME")}],initialValue:i})(P.default.createElement(p.default,{allowClear:!0,placeholder:(0,k.getIntlContent)("SHENYU.PLUGIN.SELECTOR.LIST.COLUMN.NAME"),addonAfter:P.default.createElement(d.default,{size:"small",type:"link",onClick:function(){t.setState({visible:!0})}},(0,k.getIntlContent)("SHENYU.PLUGIN.SEARCH.RULE.COPY"))}))),P.default.createElement(R.default,{visible:W,onOk:this.handleCopyData,onCancel:function(){t.setState({visible:!1})}}),P.default.createElement(U,(0,f.default)({label:(0,k.getIntlContent)("SHENYU.COMMON.MATCHTYPE")},G),B("matchMode",{rules:[{required:!0,message:(0,k.getIntlContent)("SHENYU.COMMON.INPUTMATCHTYPE")}],initialValue:"".concat(v)})(P.default.createElement(M.default,null,Y&&Y.map(function(e){return P.default.createElement(H,{key:e.dictValue,value:e.dictValue},e.dictName)})))),P.default.createElement("div",{className:I.default.condition},P.default.createElement(U,(0,f.default)({label:(0,k.getIntlContent)("SHENYU.COMMON.CONDITION"),required:!0},G),L.map(function(e,n){return P.default.createElement(c.default,{key:n,gutter:8},P.default.createElement(s.default,{span:5},P.default.createElement(M.default,{onChange:function(e){t.conditionChange(n,"paramType",e)},value:e.paramType},V&&V.map(function(e){return P.default.createElement(H,{key:e.dictValue,value:e.dictValue},e.dictName)}))),P.default.createElement(s.default,{span:4,style:{display:t.state["paramTypeValueEn".concat(n)]?"none":"block"}},P.default.createElement(p.default,{allowClear:!0,onChange:function(e){t.conditionChange(n,"paramName",e.target.value)},placeholder:e.paramName})),P.default.createElement(s.default,{span:4},P.default.createElement(M.default,{onChange:function(e){t.conditionChange(n,"operator",e)},value:e.operator},t.renderOperatorOptions(z,e.paramType))),P.default.createElement(s.default,{span:7,style:{display:"isBlank"===e.operator?"none":"block"}},t.getParamValueInput(e,n)),P.default.createElement(s.default,{span:4},P.default.createElement(d.default,{type:"danger",onClick:function(){t.handleDelete(n)}},(0,k.getIntlContent)("SHENYU.COMMON.DELETE.NAME"))))})),P.default.createElement(U,(0,f.default)({label:" ",colon:!1},G),P.default.createElement(d.default,{className:I.default.addButton,onClick:this.handleAdd,type:"primary"},(0,k.getIntlContent)("SHENYU.COMMON.ADD")," ",(0,k.getIntlContent)("SHENYU.COMMON.CONDITION")))),e&&P.default.createElement(e,{onRef:function(e){t.handleComponentRef=e},pluginName:w,onAddPluginHandle:this.handleAddHandle,onDeletePluginHandle:this.handleDeleteHandle,form:o,pluginHandleList:j,handle:x,multiRuleHandle:C}),P.default.createElement(U,(0,f.default)({label:(0,k.getIntlContent)("SHENYU.SELECTOR.EXEORDER")},G),B("sort",{initialValue:O,rules:[{required:!0,message:(0,k.getIntlContent)("SHENYU.SELECTOR.INPUTNUMBER")},{pattern:/^([1-9][0-9]{0,2}|1000)$/,message:(0,k.getIntlContent)("SHENYU.SELECTOR.INPUTNUMBER")}]})(P.default.createElement(p.default,{allowClear:!0,placeholder:(0,k.getIntlContent)("SHENYU.SELECTOR.INPUTORDER")}))),P.default.createElement(U,(0,f.default)({label:" ",colon:!1},G),P.default.createElement("div",{className:I.default.layout},P.default.createElement(U,(0,f.default)({style:{margin:"0 30px"}},q,{label:(0,k.getIntlContent)("SHENYU.SELECTOR.PRINTLOG")}),B("loged",{initialValue:m,valuePropName:"checked",rules:[{required:!0}]})(P.default.createElement(u.default,null))),P.default.createElement(U,(0,f.default)({},q,{label:(0,k.getIntlContent)("SHENYU.SELECTOR.WHETHEROPEN")}),B("enabled",{initialValue:b,valuePropName:"checked",rules:[{required:!0}]})(P.default.createElement(u.default,null))),P.default.createElement(U,(0,f.default)({style:{margin:"0 30px"}},q,{label:(0,k.getIntlContent)("SHENYU.SELECTOR.MATCHRESTFUL")}),B("matchRestful",{initialValue:E,valuePropName:"checked",rules:[{required:!0}]})(P.default.createElement(u.default,null)))))))}}])}(P.Component))||x;t.default=T.default.create()(z)},"+Mt+":function(e,t,n){"use strict";var r=n("Ds5P"),o=n("7gX0"),a=n("OzIq"),i=n("7O1s"),l=n("nphH");r(r.P+r.R,"Promise",{finally:function(e){var t=i(this,o.Promise||a.Promise),n="function"==typeof e;return this.then(n?function(n){return l(t,e()).then(function(){return n})}:e,n?function(n){return l(t,e()).then(function(){throw n})}:e)}})},"+O3U":function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){var t=e.prefixCls,n=e.motion,o=e.openAnimation,a=e.openTransitionName;if(n)return n;if("object"===r(o)&&o)(0,i.default)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if("string"==typeof o)return{motionName:"".concat(t,"-open-").concat(o)};return a?{motionName:a}:null}var a=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.getMotion=o;var i=a(n("FfaA"))},"+PQg":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e){return 0===e.indexOf("my")}var a=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n("TToO"),l=r(n("/gxq")),u=r(n("3h1/")),c=r(n("0sHC")),s=n("Q3a3"),f=a(n("Pdtn")),d=a(n("1Hui")),p=r(n("v/cD")),h=a(n("Pgdp")),v=n("dCQY"),y=n("h0jU"),m=a(n("/86O")),g=n("PelO"),b=n("1Xuh"),S=a(n("hKUo")),E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,i.__extends)(t,e),t.prototype.render=function(e,t,n,r){function a(a,l){var u,c=M[a],d=M[l],p=O[c],h=new f.default(p,e,e.ecModel);if(r&&null!=r.newTitle&&r.featureName===c&&(p.title=r.newTitle),c&&!d){if(o(c))u={onclick:h.option.onclick,featureName:c};else{var m=(0,v.getFeature)(c);if(!m)return;u=new m}C[c]=u}else if(!(u=C[d]))return;u.uid=(0,y.getUID)("toolbox-feature"),u.model=h,u.ecModel=t,u.api=n;var g=u instanceof v.ToolboxFeature;return!c&&d?void(g&&u.dispose&&u.dispose(t,n)):!h.get("show")||g&&u.unusable?void(g&&u.remove&&u.remove(t,n)):(i(h,u,c),h.setIconStatus=function(e,t){var n=this.option,r=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[e]=t,r[e]&&("emphasis"===t?s.enterEmphasis:s.leaveEmphasis)(r[e])},void(u instanceof v.ToolboxFeature&&u.render&&u.render(h,t,n,r)))}function i(r,o,a){var i,u,f=r.getModel("iconStyle"),d=r.getModel(["emphasis","iconStyle"]),p=o instanceof v.ToolboxFeature&&o.getIcons?o.getIcons():r.get("icon"),y=r.get("title")||{};l.isString(p)?(i={},i[a]=p):i=p,l.isString(y)?(u={},u[a]=y):u=y;var b=r.iconPaths={};l.each(i,function(a,i){var p=c.createIcon(a,{},{x:-E/2,y:-E/2,width:E,height:E});p.setStyle(f.getItemStyle()),p.ensureState("emphasis").style=d.getItemStyle();var v=new m.default({style:{text:u[i],align:d.get("textAlign"),borderRadius:d.get("textBorderRadius"),padding:d.get("textPadding"),fill:null,font:(0,g.getFont)({fontStyle:d.get("textFontStyle"),fontFamily:d.get("textFontFamily"),fontSize:d.get("textFontSize"),fontWeight:d.get("textFontWeight")},t)},ignore:!0});p.setTextContent(v),c.setTooltipConfig({el:p,componentModel:e,itemName:i,formatterParamsExtra:{title:u[i]}}),p.__title=u[i],p.on("mouseover",function(){var t=d.getItemStyle(),r=_?null==e.get("right")&&"right"!==e.get("left")?"right":"left":null==e.get("bottom")&&"bottom"!==e.get("top")?"bottom":"top";v.setStyle({fill:d.get("textFill")||t.fill||t.stroke||S.default.color.neutral99,backgroundColor:d.get("textBackgroundColor")}),p.setTextConfig({position:d.get("textPosition")||r}),v.ignore=!e.get("showTitle"),n.enterEmphasis(this)}).on("mouseout",function(){"emphasis"!==r.get(["iconStatus",i])&&n.leaveEmphasis(this),v.hide()}),("emphasis"===r.get(["iconStatus",i])?s.enterEmphasis:s.leaveEmphasis)(p),h.add(p),p.on("click",l.bind(o.onclick,o,t,n,i)),b[i]=p})}var h=this.group;if(h.removeAll(),e.get("show")){var E=+e.get("itemSize"),_="vertical"===e.get("orient"),O=e.get("feature")||{},C=this._features||(this._features={}),M=[];l.each(O,function(e,t){M.push(t)}),new d.default(this._featureNames||[],M).add(a).update(a).remove(l.curry(a,null)).execute(),this._featureNames=M;var w=(0,b.createBoxLayoutReference)(e,n).refContainer,x=e.getBoxLayoutParams(),T=e.get("padding"),P=(0,b.getLayoutRect)(x,w,T);(0,b.box)(e.get("orient"),h,e.get("itemGap"),P.width,P.height),(0,b.positionElement)(h,x,w,T),h.add(p.makeBackground(h.getBoundingRect(),e)),_||h.eachChild(function(e){var t=e.__title,r=e.ensureState("emphasis"),o=r.textConfig||(r.textConfig={}),a=e.getTextContent(),i=a&&a.ensureState("emphasis");if(i&&!l.isFunction(i)&&t){var c=i.style||(i.style={}),s=u.getBoundingRect(t,m.default.makeFont(c)),f=e.x+h.x,d=e.y+h.y+E,p=!1;d+s.height>n.getHeight()&&(o.position="top",p=!0);var v=p?-5-s.height:E+10;f+s.width/2>n.getWidth()?(o.position=["100%",v],c.align="right"):f-s.width/2<0&&(o.position=[0,v],c.align="left")}})}},t.prototype.updateView=function(e,t,n,r){l.each(this._features,function(e){e instanceof v.ToolboxFeature&&e.updateView&&e.updateView(e.model,t,n,r)})},t.prototype.remove=function(e,t){l.each(this._features,function(n){n instanceof v.ToolboxFeature&&n.remove&&n.remove(e,t)}),this.group.removeAll()},t.prototype.dispose=function(e,t){l.each(this._features,function(n){n instanceof v.ToolboxFeature&&n.dispose&&n.dispose(e,t)})},t.type="toolbox",t}(h.default);t.default=E},"+S09":function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=t.table,o=n.props,a=o.prefixCls,i=o.scroll,u=o.showHeader,d=e.columns,p=e.fixed,h=e.tableClassName,v=e.handleBodyScrollLeft,y=e.expander,m=n.saveRef,g=n.props.useFixedHeader,b={},S=s.measureScrollbar({direction:"vertical"});if(i.y){g=!0;var E=s.measureScrollbar({direction:"horizontal",prefixCls:a});E>0&&!p&&(b.marginBottom="-".concat(E,"px"),b.paddingBottom="0px",b.minWidth="".concat(S,"px"),b.overflowX="scroll",b.overflowY=0===S?"hidden":"scroll")}return g&&u?l.createElement("div",{key:"headTable",ref:p?null:m("headTable"),className:c.default("".concat(a,"-header"),r({},"".concat(a,"-hide-scrollbar"),S>0)),style:b,onScroll:v},l.createElement(f.default,{tableClassName:h,hasHead:!0,hasBody:!1,fixed:p,columns:d,expander:y})):null}var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var l=a(n("GiK3")),u=a(n("KSGD")),c=i(n("HW6M")),s=n("D/j2"),f=i(n("+lkG"));t.default=o,o.contextTypes={table:u.any}},"+SmI":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e){"@babel/helpers - typeof";return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(){return a=Object.assign||function(e){for(var t=1;t0?{marginLeft:y[0]/-2,marginRight:y[0]/-2}:{}),y[1]>0?{marginTop:y[1]/-2,marginBottom:y[1]/-2}:{}),d),_=a({},h);return delete _.gutter,g.createElement(E.default.Provider,{value:{gutter:y}},g.createElement("div",a({},_,{className:m,style:S}),p))},e}s(t,e);var n=d(t);return c(t,[{key:"componentDidMount",value:function(){var e=this;this.token=_.default.subscribe(function(t){var n=e.props.gutter;("object"===o(n)||Array.isArray(n)&&("object"===o(n[0])||"object"===o(n[1])))&&e.setState({screens:t})})}},{key:"componentWillUnmount",value:function(){_.default.unsubscribe(this.token)}},{key:"getGutter",value:function(){var e=[0,0],t=this.props.gutter,n=this.state.screens;return(Array.isArray(t)?t:[t,0]).forEach(function(t,r){if("object"===o(t))for(var a=0;a<_.responsiveArray.length;a++){var i=_.responsiveArray[a];if(n[i]&&void 0!==t[i]){e[r]=t[i];break}}else e[r]=t||0}),e}},{key:"render",value:function(){return g.createElement(S.ConfigConsumer,null,this.renderRow)}}]),t}(g.Component)).defaultProps={gutter:0}},"+SrI":function(e,t,n){"use strict";function r(e,t){return(0,a.default)(e)||(0,i.default)(e,t)||(0,l.default)(e,t)||(0,u.default)()}var o=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var a=o(n("JQJG")),i=o(n("eh1x")),l=o(n("Zl/V")),u=o(n("nv7o"))},"+TWC":function(e,t,n){"use strict";function r(e){for(var t=1;t=1)&&(e=1),e}var n=this._upstream,r=e&&e.skip;if(this._dirty&&n){var a=this.context;a.data=a.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!r&&(i=this._plan(this.context));var l=t(this._modBy),u=this._modDataCount||0,c=t(e&&e.modBy),s=e&&e.modDataCount||0;l===c&&u===s||(i="reset");var f;(this._dirty||"reset"===i)&&(this._dirty=!1,f=this._doReset(r)),this._modBy=c,this._modDataCount=s;var d=e&&e.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var p=this._dueIndex,h=Math.min(null!=d?this._dueIndex+d:1/0,this._dueEnd);if(!r&&(f||p=n?null:e1&&a>0?t:e}};return l}()},"+ZMJ":function(e,t,n){"use strict";var r=n("lOnJ");e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},"+azG":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(){return a=Object.assign||function(e){for(var t=1;t. This check has the highest priority. The realApiKey is strongly bound to the selector configuration. To change the mapping between proxyApiKey and realApiKey, just modify the selector configuration.","APIPROXY.APIKEY.USAGE.LINE1":"Proxy API Key works at selector granularity. Add header X-API-KEY: ; this check has the highest priority.","APIPROXY.APIKEY.USAGE.LINE2":"The realApiKey is strongly bound to the selector configuration. To change the mapping between proxyApiKey and realApiKey, edit the selector configuration.","APIPROXY.APIKEY.USAGE.HINT":"How to use: Add this API Key to the X-API-KEY field in your request header.","APIPROXY.APIKEY.PROXY_ENABLED_REQUIRED":'Please set proxyEnabled to "true" in this selector\'s configuration before entering Proxy API Key Management.'}},"+jMe":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e,t){var n=t.children;e.parentNode!==t&&(n.push(e),e.parentNode=t)}var a=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.TreeNode=void 0;var i=r(n("/gxq")),l=a(n("myzl")),u=a(n("/OrY")),c=a(n("hcq/")),s=n("vXqC"),f=t.TreeNode=function(){function e(e,t){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=e||"",this.hostTree=t}return e.prototype.isRemoved=function(){return this.dataIndex<0},e.prototype.eachNode=function(e,t,n){i.isFunction(e)&&(n=t,t=e,e=null),e=e||{},i.isString(e)&&(e={order:e});var r,o=e.order||"preorder",a=this[e.attr||"children"];"preorder"===o&&(r=t.call(n,this));for(var l=0;!r&&lt&&(t=r.height)}this.height=t+1},e.prototype.getNodeById=function(e){if(this.getId()===e)return this;for(var t=0,n=this.children,r=n.length;t=0&&this.hostTree.data.setItemLayout(this.dataIndex,e,t)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(e){if(!(this.dataIndex<0)){return this.hostTree.data.getItemModel(this.dataIndex).getModel(e)}},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,e,t)},e.prototype.getVisual=function(e){return this.hostTree.data.getItemVisual(this.dataIndex,e)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var e=this.parentNode.children,t=0;t2&&void 0!==arguments[2]?arguments[2]:[],o=e.context.table,a=o.columnManager,i=o.components,l=o.props,u=l.prefixCls,c=l.childrenColumnName,s=l.rowClassName,f=l.rowRef,d=l.onRowClick,p=l.onRowDoubleClick,h=l.onRowContextMenu,v=l.onRowMouseEnter,y=l.onRowMouseLeave,m=l.onRow,g=e.props,S=g.getRowKey,E=g.fixed,_=g.expander,O=g.isAnyColumnsFixed,C=[],x=0;x15)break}}n.prevElClipPaths&&u.restore()};if(c)if(0===c.length)g=l.__endIndex;else for(var S=p.dpr,E=0;E0&&e>r[0]){for(u=0;ue);u++);l=n[r[u]]}if(r.splice(u+1,0,e),n[e]=t,!t.virtual)if(l){var c=l.dom;c.nextSibling?i.insertBefore(t.dom,c.nextSibling):i.appendChild(t.dom)}else i.firstChild?i.insertBefore(t.dom,i.firstChild):i.appendChild(t.dom);t.painter||(t.painter=this)}},e.prototype.eachLayer=function(e,t){for(var n=this._zlevelList,r=0;r0?.01:0),this._needsManuallyCompositing),s.__builtin__||u.logError("ZLevel "+c+" has been used by unkown layer "+s.id),s!==i&&(s.__used=!0,s.__startIndex!==a&&(s.__dirty=!0),s.__startIndex=a,s.incremental?s.__drawIndex=-1:s.__drawIndex=a,t(a),i=s),r.__dirty&p.REDRAW_BIT&&!r.__inHover&&(s.__dirty=!0,s.incremental&&s.__drawIndex<0&&(s.__drawIndex=a))}t(a),this.eachBuiltinLayer(function(e,t){!e.__used&&e.getElementCount()>0&&(e.__dirty=!0,e.__startIndex=e.__endIndex=e.__drawIndex=0),e.__dirty&&e.__drawIndex<0&&(e.__drawIndex=e.__startIndex)})},e.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},e.prototype._clearLayer=function(e){e.clear()},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,u.each(this._layers,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?u.merge(n[e],t,!0):n[e]=t;for(var r=0;r0})}var o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},a=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=o(n("GiK3")),l=o(n("KSGD")),u=a(n("6Fr6")),c=function(e,t){var n=t.table,o=n.components,a=n.props,l=a.prefixCls,c=a.showHeader,s=a.onHeaderRow,f=e.expander,d=e.columns,p=e.fixed;if(!c)return null;var h=r({columns:d});f.renderExpandIndentCell(h,p);var v=o.header.wrapper;return i.createElement(v,{className:"".concat(l,"-thead")},h.map(function(e,t){return i.createElement(u.default,{prefixCls:l,key:t,index:t,fixed:p,columns:d,rows:h,row:e,components:o,onHeaderRow:s})}))};c.contextTypes={table:l.any},t.default=c},"+onY":function(e,t,n){"use strict";function r(){function e(e,n,r,a){var i=n&&n.prototype instanceof t?n:t,c=Object.create(i.prototype);return o(c,"_invoke",function(e,t,n){function r(e,t){for(a=e,i=t,u=0;!f&&c&&!n&&u3?(n=h===t)&&(i=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=l):r[0]<=o&&((n=e<2&&ot||t>h)&&(r[4]=e,r[5]=t,p.n=h,a=0))}if(n||e>1)return d;throw f=!0,t}var o,a,i,c=0,s=n||[],f=!1,p={p:0,n:0,v:l,a:r,f:r.bind(l,4),d:function(e,t){return o=e,a=0,i=l,p.n=t,d}};return function(n,s,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&r(s,h),a=s,i=h;(u=a<2?l:i)||!f;){o||(a?a<3?(a>1&&(p.n=-1),r(a,i)):p.n=i:p.v=i);try{if(c=2,o){if(a||(n="next"),u=o[n]){if(!(u=u.call(o,i)))throw TypeError("iterator result is not an object");if(!u.done)return u;i=u.value,a<2&&(a=0)}else 1===a&&(u=o.return)&&u.call(o),a<2&&(i=TypeError("The iterator does not provide a '"+n+"' method"),a=1);o=l}else if((u=(f=p.n<0)?i:e.call(t,p))!==d)break}catch(e){o=l,a=1,i=e}finally{c=1}}return{value:u,done:f}}}(e,r,a),!0),c}function t(){}function n(){}function a(){}function i(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,o(e,f,"GeneratorFunction")),e.prototype=Object.create(h),e}var l,u,c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",f=c.toStringTag||"@@toStringTag",d={};u=Object.getPrototypeOf;var p=[][s]?u(u([][s]())):(o(u={},s,function(){return this}),u),h=a.prototype=t.prototype=Object.create(p);return n.prototype=a,o(h,"constructor",a),o(a,"constructor",n),n.displayName="GeneratorFunction",o(a,f,"GeneratorFunction"),o(h),o(h,f,"Generator"),o(h,s,function(){return this}),o(h,"toString",function(){return"[object Generator]"}),(r=function(){return{w:e,m:i}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))})(e,t,n,r)}var a=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(n("+TWC"));n("UQ5M");var l=a(n("/qCn")),u=n("KPPu"),c=n("H/Zg");t.default={namespace:"alert",state:{alertList:[],total:0},effects:{fetch:function(e,t){var n=e.payload,o=t.call,a=t.put;return r().m(function e(){var t;return r().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,o(c.getAlertReceivers,n);case 1:return t=e.v,e.n=2,a({type:"save",payload:t.data});case 2:return e.a(2)}},e)})()},fetchItem:function(e,t){var n=e.payload,o=e.callback,a=t.call;return r().m(function e(){var t,i;return r().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,a(c.getAlertReceiverDetail,n);case 1:t=e.v,200===t.code&&(i=t.data,o(i));case 2:return e.a(2)}},e)})()},update:function(e,t){var n=t.call;return r().m(function t(){var o,a,i;return r().w(function(t){for(;;)switch(t.n){case 0:return o=e.payload,a=e.callback,t.n=1,n(c.updateAlertReceiver,o);case 1:i=t.v,200===i.code?(l.default.success((0,u.getIntlContent)("SHENYU.COMMON.RESPONSE.UPDATE.SUCCESS")),a()):l.default.warn(i.message);case 2:return t.a(2)}},t)})()},add:function(e,t){var n=t.call;return r().m(function t(){var o,a,i;return r().w(function(t){for(;;)switch(t.n){case 0:return o=e.payload,a=e.callback,t.n=1,n(c.addAlertReceiver,o);case 1:i=t.v,200===i.code?(l.default.success((0,u.getIntlContent)("SHENYU.COMMON.RESPONSE.ADD.SUCCESS")),a()):l.default.warn(i.message);case 2:return t.a(2)}},t)})()},delete:function(e,t){var n=t.call,o=t.put;return r().m(function t(){var a,i,s,f,d;return r().w(function(t){for(;;)switch(t.n){case 0:return a=e.payload,i=e.fetchValue,s=e.callback,f=a.list,t.n=1,n(c.deleteAlertReceivers,{list:f});case 1:if(d=t.v,200!==d.code){t.n=3;break}return l.default.success((0,u.getIntlContent)("SHENYU.COMMON.RESPONSE.DELETE.SUCCESS")),s(),t.n=2,o({type:"reload",fetchValue:i});case 2:t.n=4;break;case 3:l.default.warn(d.message);case 4:return t.a(2)}},t)})()},sendTest:function(e,t){var n=t.call;return r().m(function t(){var o,a;return r().w(function(t){for(;;)switch(t.n){case 0:return o=e.payload,t.n=1,n(c.fetchAlertReport,o);case 1:a=t.v,200===a.code?l.default.success((0,u.getIntlContent)("SHENYU.SYSTEM.ALERT.SEND_SUCCESS")):l.default.warn(a.message);case 2:return t.a(2)}},t)})()},reload:function(e,t){var n=t.put;return r().m(function t(){var o,a,i,l,u;return r().w(function(t){for(;;)switch(t.n){case 0:return o=e.fetchValue,a=o.userName,i=o.currentPage,l=o.pageSize,u={userName:a,currentPage:i,pageSize:l},t.n=1,n({type:"fetch",payload:u});case 1:return t.a(2)}},t)})()}},reducers:{save:function(e,t){var n=t.payload;return(0,i.default)({},e,{alertList:n.dataList,total:n.page.totalCount})}}}},"+pdh":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e){for(var t=0;t=0&&(u[a[c].depth]=new l.default(a[c],this,t));return(0,i.default)(o,r,this,!0,n).data},t.prototype.setNodePosition=function(e,t){var n=this.option.data||this.option.nodes,r=n[e];r.localX=t[0],r.localY=t[1]},t.prototype.setCenter=function(e){this.option.center=e},t.prototype.setZoom=function(e){this.option.zoom=e},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(e,t,n){function r(e){return isNaN(e)||null==e}if("edge"===n){var o=this.getDataParams(e,n),a=o.data,i=o.value,l=a.source+" -- "+a.target;return(0,u.createTooltipMarkup)("nameValue",{name:l,value:i,noValue:r(i)})}var c=this.getGraph().getNodeByIndex(e),s=c.getLayout().value,f=this.getDataParams(e,n).data.name;return(0,u.createTooltipMarkup)("nameValue",{name:null!=f?f+"":null,value:s,noValue:r(s)})},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(t,n){var r=e.prototype.getDataParams.call(this,t,n);if(null==r.value&&"node"===n){var o=this.getGraph().getNodeByIndex(t),a=o.getLayout().value;r.value=a}return r},t.type="series.sankey",t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:"global",center:null,zoom:1,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:c.default.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:c.default.color.primary}},animationEasing:"linear",animationDuration:1e3},t}(a.default);t.default=s},"+vXH":function(e,t,n){"use strict";n("77Ug")("Float64",8,function(e){return function(t,n,r){return e(this,t,n,r)}})},"+wjW":function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}e.exports=r},"+yjc":function(e,t,n){"use strict";var r=n("UKM+");n("3i66")("isSealed",function(e){return function(t){return!r(t)||!!e&&e(t)}})},"/+sa":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n("BNYN")),a=n("wW3A"),i=n("/gxq"),l=n("N15c"),u=function(){function e(e){this._calculator=new a.ScaleCalculator,this._setting=e||{},this._extent=[1/0,-1/0];var t=(0,l.getScaleBreakHelper)();t&&(this._brkCtx=t.createScaleBreakContext(),this._brkCtx.update(this._extent))}return e.prototype.getSetting=function(e){return this._setting[e]},e.prototype._innerUnionExtent=function(e){var t=this._extent;this._innerSetExtent(e[0]t[1]?e[1]:t[1])},e.prototype.unionExtentFromData=function(e,t){this._innerUnionExtent(e.getApproximateExtent(t))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){this._innerSetExtent(e,t)},e.prototype._innerSetExtent=function(e,t){var n=this._extent;isNaN(e)||(n[0]=e),isNaN(t)||(n[1]=t),this._brkCtx&&this._brkCtx.update(n)},e.prototype.setBreaksFromOption=function(e){var t=(0,l.getScaleBreakHelper)();t&&this._innerSetBreak(t.parseAxisBreakOption(e,(0,i.bind)(this.parse,this)))},e.prototype._innerSetBreak=function(e){this._brkCtx&&(this._brkCtx.setBreaks(e),this._calculator.updateMethods(this._brkCtx),this._brkCtx.update(this._extent))},e.prototype._innerGetBreaks=function(){return this._brkCtx?this._brkCtx.breaks:[]},e.prototype.hasBreaks=function(){return!!this._brkCtx&&this._brkCtx.hasBreaks()},e.prototype._getExtentSpanWithBreaks=function(){return this._brkCtx&&this._brkCtx.hasBreaks()?this._brkCtx.getExtentSpan():this._extent[1]-this._extent[0]},e.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}();o.enableClassManagement(u);t.default=u},"/1q1":function(e,t,n){"use strict";function r(e,t,n,r,a){var l=[];if(e.required||!e.required&&r.hasOwnProperty(e.field)){if((0,o.isEmptyValue)(t)&&!e.required)return n();i.default.required(e,t,r,l,a),void 0!==t&&i.default.type(e,t,r,l,a)}n(l)}Object.defineProperty(t,"__esModule",{value:!0});var o=n("eCjd"),a=n("hGxU"),i=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=r},"/2sp":function(e,t,n){"use strict";function r(e){e.registerChartView(a.default),e.registerSeriesModel(i.default),e.registerLayout((0,l.default)("effectScatter"))}var o=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.install=r;var a=o(n("Y3kp")),i=o(n("P7Q7")),l=o(n("1Nix"))},"/4RJ":function(e,t,n){"use strict";n("vtiu"),n("1OYt"),n("LHBr"),n("s3t2"),n("iBc0")},"/7YS":function(e,t,n){"use strict";function r(){function e(e,n,r,a){var i=n&&n.prototype instanceof t?n:t,c=Object.create(i.prototype);return o(c,"_invoke",function(e,t,n){function r(e,t){for(a=e,i=t,u=0;!f&&c&&!n&&u3?(n=h===t)&&(i=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=l):r[0]<=o&&((n=e<2&&ot||t>h)&&(r[4]=e,r[5]=t,p.n=h,a=0))}if(n||e>1)return d;throw f=!0,t}var o,a,i,c=0,s=n||[],f=!1,p={p:0,n:0,v:l,a:r,f:r.bind(l,4),d:function(e,t){return o=e,a=0,i=l,p.n=t,d}};return function(n,s,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&r(s,h),a=s,i=h;(u=a<2?l:i)||!f;){o||(a?a<3?(a>1&&(p.n=-1),r(a,i)):p.n=i:p.v=i);try{if(c=2,o){if(a||(n="next"),u=o[n]){if(!(u=u.call(o,i)))throw TypeError("iterator result is not an object");if(!u.done)return u;i=u.value,a<2&&(a=0)}else 1===a&&(u=o.return)&&u.call(o),a<2&&(i=TypeError("The iterator does not provide a '"+n+"' method"),a=1);o=l}else if((u=(f=p.n<0)?i:e.call(t,p))!==d)break}catch(e){o=l,a=1,i=e}finally{c=1}}return{value:u,done:f}}}(e,r,a),!0),c}function t(){}function n(){}function a(){}function i(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,o(e,f,"GeneratorFunction")),e.prototype=Object.create(h),e}var l,u,c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",f=c.toStringTag||"@@toStringTag",d={};u=Object.getPrototypeOf;var p=[][s]?u(u([][s]())):(o(u={},s,function(){return this}),u),h=a.prototype=t.prototype=Object.create(p);return n.prototype=a,o(h,"constructor",a),o(a,"constructor",n),n.displayName="GeneratorFunction",o(a,f,"GeneratorFunction"),o(h),o(h,f,"Generator"),o(h,s,function(){return this}),o(h,"toString",function(){return"[object Generator]"}),(r=function(){return{w:e,m:i}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}(o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))})(e,t,n,r)}var a=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(n("+TWC")),l=n("ye8Q");t.default={namespace:"user",state:{list:[],currentUser:{}},effects:{fetch:function(e,t){var n=t.call,o=t.put;return r().m(function e(){var t;return r().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n(l.query);case 1:return t=e.v,e.n=2,o({type:"save",payload:t});case 2:return e.a(2)}},e)})()}},reducers:{save:function(e,t){return(0,i.default)({},e,{list:t.payload})}}}},"/86O":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}function o(e){return"string"!=typeof e||-1===e.indexOf("px")&&-1===e.indexOf("rem")&&-1===e.indexOf("em")?isNaN(+e)?C.DEFAULT_FONT_SIZE+"px":e+"px":e}function a(e,t){for(var n=0;n0,j=0;j=0&&(A=C[k],"right"===A.align);)this._placeToken(A,e,x,g,I,"right",E),T-=A.width,I-=A.width,k--;for(N+=(u-(N-m)-(S-I)-T)/2;P<=k;)A=C[P],this._placeToken(A,e,x,g,N+A.width/2,"center",E),N+=A.width,P++;g+=x}},t.prototype._placeToken=function(e,t,n,r,o,i,l){var u=t.rich[e.styleName]||{};u.text=e.text;var d=e.verticalAlign,h=r+n/2;"top"===d?h=r+e.height/2:"bottom"===d&&(h=r+n-e.height/2),!e.isLineHolder&&p(u)&&this._renderBackground(u,t,"right"===i?o-e.width:"center"===i?o-e.width/2:o,h-e.height/2,e.width,e.height);var v=!!u.backgroundColor,b=e.textPadding;b&&(o=f(o,i,b),h-=e.height/2-b[0]-e.innerHeight/2);var S=this._getOrCreateChild(m.default),E=S.createStyle();S.useStyle(E);var _=this._defaultStyle,O=!1,M=0,w=!1,x=s("fill"in u?u.fill:"fill"in t?t.fill:(O=!0,_.fill)),T=c("stroke"in u?u.stroke:"stroke"in t?t.stroke:v||l||_.autoStroke&&!O?null:(M=2,w=!0,_.stroke)),P=u.textShadowBlur>0||t.textShadowBlur>0;E.text=e.text,E.x=o,E.y=h,P&&(E.shadowBlur=u.textShadowBlur||t.textShadowBlur||0,E.shadowColor=u.textShadowColor||t.textShadowColor||"transparent",E.shadowOffsetX=u.textShadowOffsetX||t.textShadowOffsetX||0,E.shadowOffsetY=u.textShadowOffsetY||t.textShadowOffsetY||0),E.textAlign=i,E.textBaseline="middle",E.font=e.font||C.DEFAULT_FONT,E.opacity=(0,g.retrieve3)(u.opacity,t.opacity,1),a(E,u),T&&(E.lineWidth=(0,g.retrieve3)(u.lineWidth,t.lineWidth,M),E.lineDash=(0,g.retrieve2)(u.lineDash,t.lineDash),E.lineDashOffset=t.lineDashOffset||0,E.stroke=T),x&&(E.fill=x),S.setBoundingRect((0,y.tSpanCreateBoundingRect2)(E,e.contentWidth,e.contentHeight,w?0:null))},t.prototype._renderBackground=function(e,t,n,r,o,a){var i,l,u=e.backgroundColor,c=e.borderWidth,s=e.borderColor,f=u&&u.image,d=u&&!f,p=e.borderRadius,h=this;if(d||e.lineHeight||c&&s){i=this._getOrCreateChild(E.default),i.useStyle(i.createStyle()),i.style.fill=null;var v=i.shape;v.x=n,v.y=r,v.width=o,v.height=a,v.r=p,i.dirtyShape()}if(d){var y=i.style;y.fill=u||null,y.fillOpacity=(0,g.retrieve2)(e.fillOpacity,1)}else if(f){l=this._getOrCreateChild(S.default),l.onload=function(){h.dirtyStyle()};var m=l.style;m.image=u.image,m.x=n,m.y=r,m.width=o,m.height=a}if(c&&s){var y=i.style;y.lineWidth=c,y.stroke=s,y.strokeOpacity=(0,g.retrieve2)(e.strokeOpacity,1),y.lineDash=e.borderDash,y.lineDashOffset=e.borderDashOffset||0,i.strokeContainThreshold=0,i.hasFill()&&i.hasStroke()&&(y.strokeFirst=!0,y.lineWidth*=2)}var b=(i||l).style;b.shadowBlur=e.shadowBlur||0,b.shadowColor=e.shadowColor||"transparent",b.shadowOffsetX=e.shadowOffsetX||0,b.shadowOffsetY=e.shadowOffsetY||0,b.opacity=(0,g.retrieve3)(e.opacity,t.opacity,1)},t.makeFont=function(e){var t="";return i(e)&&(t=[e.fontStyle,e.fontWeight,o(e.fontSize),e.fontFamily||"sans-serif"].join(" ")),t&&(0,g.trim)(t)||e.textFont||e.font},t}(O.default),P={left:!0,right:1,center:1},N={top:1,bottom:1,middle:1},I=["fontStyle","fontWeight","fontSize","fontFamily"];t.default=T},"/Aqo":function(e,t,n){"use strict";function r(e,t){if("function"==typeof WeakMap)var n=new WeakMap,o=new WeakMap;return(r=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,i={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return i;if(r=t?o:n){if(r.has(e))return r.get(e);r.set(e,i)}for(var l in e)"default"!==l&&{}.hasOwnProperty.call(e,l)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,l))&&(a.get||a.set)?r(i,l,a):i[l]=e[l]);return i})(e,t)}var o=n("ouCL");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=n("TToO"),i=r(n("/gxq")),l=o(n("avYi")),u=o(n("8b51")),c=function(e){function t(t){var n=e.call(this)||this;return n.isGroup=!0,n._children=[],n.attr(t),n}return(0,a.__extends)(t,e),t.prototype.childrenRef=function(){return this._children},t.prototype.children=function(){return this._children.slice()},t.prototype.childAt=function(e){return this._children[e]},t.prototype.childOfName=function(e){for(var t=this._children,n=0;n=0&&(n.splice(r,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=i.indexOf(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,r=n[t];if(e&&e!==this&&e.parent!==this&&e!==r){n[t]=e,r.parent=null;var o=this.__zr;o&&r.removeSelfFromZr(o),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,r=i.indexOf(n,e);return r<0?this:(n.splice(r,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh(),this)},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;n0)for(var c=0;cMath.abs(s),d=r([c,s],f?0:1,t),p=(f?u:s)/d.length,h=0;ha,l=r([o,a],i?0:1,t),u=i?"width":"height",c=i?"height":"width",s=i?"x":"y",f=i?"y":"x",d=e[u]/l.length,p=0;p1?null:new S.default(y*c+e,y*s+t)}function u(e,t,n){var r=new S.default;S.default.sub(r,n,t),r.normalize();var o=new S.default;return S.default.sub(o,e,t),o.dot(r)}function c(e,t){var n=e[e.length-1];n&&n[0]===t[0]&&n[1]===t[1]||e.push(t)}function s(e,t,n){for(var r=e.length,o=[],a=0;ai?(c.x=f.x=l+a/2,c.y=u,f.y=u+i):(c.y=f.y=u+i/2,c.x=l,f.x=l+a),s(t,c,f)}function d(e,t,n,r){if(1===n)r.push(t);else{var o=Math.floor(n/2),a=e(t);d(e,a[0],o,r),d(e,a[1],n-o,r)}return r}function p(e,t){for(var n=[],r=0;r-1?o([n]):n}},"/OLF":function(e,t,n){"use strict";function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;nt}return!1}function _(e,t,n,r,o,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a}function O(e){return e[1].toUpperCase()}function C(e,t,n,r){var o=pa.hasOwnProperty(t)?pa[t]:null;(null!==o?0===o.type:!r&&(2=n.length))throw Error(r(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:P(n)}}function B(e,t){var n=P(t.value),r=P(t.defaultValue);null!=n&&(n=""+n,n!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function G(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function q(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function K(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?q(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}function Q(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function X(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}function J(e){if(ja[e])return ja[e];if(!Ra[e])return e;var t,n=Ra[e];for(t in n)if(n.hasOwnProperty(t)&&t in Ua)return ja[e]=n[t];return e}function Z(e){var t=qa.get(e);return void 0===t&&(t=new Map,qa.set(e,t)),t}function $(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{t=e,0!=(1026&t.effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function ee(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function te(e){if($(e)!==e)throw Error(r(188))}function ne(e){var t=e.alternate;if(!t){if(null===(t=$(e)))throw Error(r(188));return t!==e?null:e}for(var n=e,o=t;;){var a=n.return;if(null===a)break;var i=a.alternate;if(null===i){if(null!==(o=a.return)){n=o;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return te(a),e;if(i===o)return te(a),t;i=i.sibling}throw Error(r(188))}if(n.return!==o.return)n=a,o=i;else{for(var l=!1,u=a.child;u;){if(u===n){l=!0,n=a,o=i;break}if(u===o){l=!0,o=a,n=i;break}u=u.sibling}if(!l){for(u=i.child;u;){if(u===n){l=!0,n=i,o=a;break}if(u===o){l=!0,o=i,n=a;break}u=u.sibling}if(!l)throw Error(r(189))}}if(n.alternate!==o)throw Error(r(190))}if(3!==n.tag)throw Error(r(188));return n.stateNode.current===n?e:t}function re(e){if(!(e=ne(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function oe(e,t){if(null==t)throw Error(r(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function ae(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}function ie(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;rQa.length&&Qa.push(e)}function fe(e,t,n,r){if(Qa.length){var o=Qa.pop();return o.topLevelType=e,o.eventSystemFlags=r,o.nativeEvent=t,o.targetInst=n,o}return{topLevelType:e,eventSystemFlags:r,nativeEvent:t,targetInst:n,ancestors:[]}}function de(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r=n;if(3===r.tag)r=r.stateNode.containerInfo;else{for(;r.return;)r=r.return;r=3!==r.tag?null:r.stateNode.containerInfo}if(!r)break;t=n.tag,5!==t&&6!==t||e.ancestors.push(n),n=Ke(r)}while(n);for(n=0;n=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=He(n)}}function Ye(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Ye(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function Ve(){for(var e=window,t=Ue();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;e=t.contentWindow,t=Ue(e.document)}return t}function Fe(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function We(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Be(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}function Ge(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function qe(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if(n===bi||n===_i||n===Ei){if(0===t)return e;t--}else n===Si&&t++}e=e.previousSibling}return null}function Ke(e){var t=e[Ti];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ni]||n[Ti]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=qe(e);null!==e;){if(n=e[Ti])return n;e=qe(e)}return t}e=n,n=e.parentNode}return null}function Qe(e){return e=e[Ti]||e[Ni],!e||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function Xe(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(r(33))}function Je(e){return e[Pi]||null}function Ze(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function $e(e,t){var n=e.stateNode;if(!n)return null;var o=qo(n);if(!o)return null;n=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!("button"===e||"input"===e||"select"===e||"textarea"===e)),e=!o;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(r(231,t,typeof n));return n}function et(e,t,n){(t=$e(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=oe(n._dispatchListeners,t),n._dispatchInstances=oe(n._dispatchInstances,e))}function tt(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=Ze(t);for(t=n.length;0this.eventPool.length&&this.eventPool.push(e)}function ft(e){e.eventPool=[],e.getPooled=ct,e.release=st}function dt(e,t){switch(e){case"keyup":return-1!==Ri.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function pt(e){return e=e.detail,"object"==typeof e&&"data"in e?e.data:null}function ht(e,t){switch(e){case"compositionend":return pt(t);case"keypress":return 32!==t.which?null:(Fi=!0,Yi);case"textInput":return e=t.data,e===Yi&&Fi?null:e;default:return null}}function vt(e,t){if(Wi)return"compositionend"===e||!ji&&dt(e,t)?(e=at(),Ai=ki=Ii=null,Wi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1Dl||(e.current=Al[Dl],Al[Dl]=null,Dl--)}function Dt(e,t){Dl++,Al[Dl]=e.current,e.current=t}function Lt(e,t){var n=e.type.contextTypes;if(!n)return Ll;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,a={};for(o in n)a[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Rt(e){return null!==(e=e.childContextTypes)&&void 0!==e}function jt(){At(jl),At(Rl)}function Ut(e,t,n){if(Rl.current!==Ll)throw Error(r(168));Dt(Rl,t),Dt(jl,n)}function Ht(e,t,n){var o=e.stateNode;if(e=t.childContextTypes,"function"!=typeof o.getChildContext)return n;o=o.getChildContext();for(var a in o)if(!(a in e))throw Error(r(108,x(t)||"Unknown",a));return zo({},n,{},o)}function zt(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ll,Ul=Rl.current,Dt(Rl,e),Dt(jl,jl.current),!0}function Yt(e,t,n){var o=e.stateNode;if(!o)throw Error(r(169));n?(e=Ht(e,t,Ul),o.__reactInternalMemoizedMergedChildContext=e,At(jl),At(Rl),Dt(Rl,e)):At(jl),Dt(jl,n)}function Vt(){switch(Wl()){case Bl:return 99;case Gl:return 98;case ql:return 97;case Kl:return 96;case Ql:return 95;default:throw Error(r(332))}}function Ft(e){switch(e){case 99:return Bl;case 98:return Gl;case 97:return ql;case 96:return Kl;case 95:return Ql;default:throw Error(r(332))}}function Wt(e,t){return e=Ft(e),Hl(e,t)}function Bt(e,t,n){return e=Ft(e),zl(e,t,n)}function Gt(e){return null===$l?($l=[e],eu=zl(Bl,Kt)):$l.push(e),Xl}function qt(){if(null!==eu){var e=eu;eu=null,Yl(e)}Kt()}function Kt(){if(!tu&&null!==$l){tu=!0;var e=0;try{var t=$l;Wt(99,function(){for(;e=t&&(Lu=!0),e.firstContext=null)}function tn(e,t){if(lu!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(lu=e,t=1073741823),t={context:e,observedBits:t,next:null},null===iu){if(null===au)throw Error(r(308));iu=t,au.dependencies={expirationTime:0,firstContext:t,responders:null}}else iu=iu.next=t;return e._currentValue}function nn(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function rn(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function on(e,t){return e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null},e.next=e}function an(e,t){if(null!==(e=e.updateQueue)){e=e.shared;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function ln(e,t){var n=e.alternate;null!==n&&rn(n,e),e=e.updateQueue,n=e.baseQueue,null===n?(e.baseQueue=t.next=t,t.next=t):(t.next=n.next,n.next=t)}function un(e,t,n,r){var o=e.updateQueue;uu=!1;var a=o.baseQueue,i=o.shared.pending;if(null!==i){if(null!==a){var l=a.next;a.next=i.next,i.next=l}a=i,o.shared.pending=null,l=e.alternate,null!==l&&null!==(l=l.updateQueue)&&(l.baseQueue=i)}if(null!==a){l=a.next;var u=o.baseState,c=0,s=null,f=null,d=null;if(null!==l)for(var p=l;;){if((i=p.expirationTime)c&&(c=i)}else{null!==d&&(d=d.next={expirationTime:1073741823,suspenseConfig:p.suspenseConfig,tag:p.tag,payload:p.payload,callback:p.callback,next:null}),Jr(i,p.suspenseConfig);e:{var v=e,y=p;switch(i=t,h=n,y.tag){case 1:if("function"==typeof(v=y.payload)){u=v.call(h,u,i);break e}u=v;break e;case 3:v.effectTag=-4097&v.effectTag|64;case 0:if(v=y.payload,null===(i="function"==typeof v?v.call(h,u,i):v)||void 0===i)break e;u=zo({},u,i);break e;case 2:uu=!0}}null!==p.callback&&(e.effectTag|=32,i=o.effects,null===i?o.effects=[p]:i.push(p))}if(null===(p=p.next)||p===l){if(null===(i=o.shared.pending))break;p=a.next=i.next,i.next=l,o.baseQueue=a=i,o.shared.pending=null}}null===d?s=u:d.next=f,o.baseState=s,o.baseQueue=d,Zr(c),e.expirationTime=c,e.memoizedState=u}}function cn(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;tv?(y=f,f=null):y=f.sibling;var m=p(r,f,l[v],u);if(null===m){null===f&&(f=y);break}e&&f&&null===m.alternate&&t(r,f),a=i(m,a,v),null===s?c=m:s.sibling=m,s=m,f=y}if(v===l.length)return n(r,f),c;if(null===f){for(;vy?(m=v,v=null):m=v.sibling;var b=p(a,v,g.value,c);if(null===b){null===v&&(v=m);break}e&&v&&null===b.alternate&&t(a,v),l=i(b,l,y),null===f?s=b:f.sibling=b,f=b,v=m}if(g.done)return n(a,v),s;if(null===v){for(;!g.done;y++,g=u.next())null!==(g=d(a,g.value,c))&&(l=i(g,l,y),null===f?s=g:f.sibling=g,f=g);return s}for(v=o(a,v);!g.done;y++,g=u.next())null!==(g=h(v,a,y,g.value,c))&&(e&&null!==g.alternate&&v.delete(null===g.key?y:g.key),l=i(g,l,y),null===f?s=g:f.sibling=g,f=g);return e&&v.forEach(function(e){return t(a,e)}),s}return function(e,o,i,u){var c="object"==typeof i&&null!==i&&i.type===Ea&&null===i.key;c&&(i=i.props.children);var s="object"==typeof i&&null!==i;if(s)switch(i.$$typeof){case ba:e:{for(s=i.key,c=o;null!==c;){if(c.key===s){switch(c.tag){case 7:if(i.type===Ea){n(e,c.sibling),o=a(c,i.props.children),o.return=e,e=o;break e}break;default:if(c.elementType===i.type){n(e,c.sibling),o=a(c,i.props),o.ref=vn(e,c,i),o.return=e,e=o;break e}}n(e,c);break}t(e,c),c=c.sibling}i.type===Ea?(o=Eo(i.props.children,e.mode,u,i.key),o.return=e,e=o):(u=So(i.type,i.key,i.props,null,e.mode,u),u.ref=vn(e,o,i),u.return=e,e=u)}return l(e);case Sa:e:{for(c=i.key;null!==o;){if(o.key===c){if(4===o.tag&&o.stateNode.containerInfo===i.containerInfo&&o.stateNode.implementation===i.implementation){n(e,o.sibling),o=a(o,i.children||[]),o.return=e,e=o;break e}n(e,o);break}t(e,o),o=o.sibling}o=Oo(i,e.mode,u),o.return=e,e=o}return l(e)}if("string"==typeof i||"number"==typeof i)return i=""+i,null!==o&&6===o.tag?(n(e,o.sibling),o=a(o,i),o.return=e,e=o):(n(e,o),o=_o(i,e.mode,u),o.return=e,e=o),l(e);if(du(i))return v(e,o,i,u);if(M(i))return y(e,o,i,u);if(s&&yn(e,i),void 0===i&&!c)switch(e.tag){case 1:case 0:throw e=e.type,Error(r(152,e.displayName||e.name||"Component"))}return n(e,o)}}function gn(e){if(e===vu)throw Error(r(174));return e}function bn(e,t){switch(Dt(gu,t),Dt(mu,e),Dt(yu,vu),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:K(null,"");break;default:e=8===e?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=K(t,e)}At(yu),Dt(yu,t)}function Sn(){At(yu),At(mu),At(gu)}function En(e){gn(gu.current);var t=gn(yu.current),n=K(t,e.type);t!==n&&(Dt(mu,e),Dt(yu,n))}function _n(e){mu.current===e&&(At(yu),At(mu))}function On(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||n.data===Ei||n.data===_i))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function Cn(e,t){return{responder:e,props:t}}function Mn(){throw Error(r(321))}function wn(e,t){if(null===t)return!1;for(var n=0;ni))throw Error(r(301));i+=1,Mu=Cu=null,t.updateQueue=null,Su.current=Nu,e=n(o,a)}while(t.expirationTime===_u)}if(Su.current=xu,t=null!==Cu&&null!==Cu.next,_u=0,Mu=Cu=Ou=null,wu=!1,t)throw Error(r(300));return e}function Tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Mu?Ou.memoizedState=Mu=e:Mu=Mu.next=e,Mu}function Pn(){if(null===Cu){var e=Ou.alternate;e=null!==e?e.memoizedState:null}else e=Cu.next;var t=null===Mu?Ou.memoizedState:Mu.next;if(null!==t)Mu=t,Cu=e;else{if(null===e)throw Error(r(310));Cu=e,e={memoizedState:Cu.memoizedState,baseState:Cu.baseState,baseQueue:Cu.baseQueue,queue:Cu.queue,next:null},null===Mu?Ou.memoizedState=Mu=e:Mu=Mu.next=e}return Mu}function Nn(e,t){return"function"==typeof t?t(e):t}function In(e){var t=Pn(),n=t.queue;if(null===n)throw Error(r(311));n.lastRenderedReducer=e;var o=Cu,a=o.baseQueue,i=n.pending;if(null!==i){if(null!==a){var l=a.next;a.next=i.next,i.next=l}o.baseQueue=a=i,n.pending=null}if(null!==a){a=a.next,o=o.baseState;var u=l=i=null,c=a;do{var s=c.expirationTime;if(s<_u){var f={expirationTime:c.expirationTime,suspenseConfig:c.suspenseConfig,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===u?(l=u=f,i=o):u=u.next=f,s>Ou.expirationTime&&(Ou.expirationTime=s,Zr(s))}else null!==u&&(u=u.next={expirationTime:1073741823,suspenseConfig:c.suspenseConfig,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),Jr(s,c.suspenseConfig),o=c.eagerReducer===e?c.eagerState:e(o,c.action);c=c.next}while(null!==c&&c!==a);null===u?i=o:u.next=l,ul(o,t.memoizedState)||(Lu=!0),t.memoizedState=o,t.baseState=i,t.baseQueue=u,n.lastRenderedState=o}return[t.memoizedState,n.dispatch]}function kn(e){var t=Pn(),n=t.queue;if(null===n)throw Error(r(311));n.lastRenderedReducer=e;var o=n.dispatch,a=n.pending,i=t.memoizedState;if(null!==a){n.pending=null;var l=a=a.next;do{i=e(i,l.action),l=l.next}while(l!==a);ul(i,t.memoizedState)||(Lu=!0),t.memoizedState=i,null===t.baseQueue&&(t.baseState=i),n.lastRenderedState=i}return[i,o]}function An(e){var t=Tn();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=t.queue={pending:null,dispatch:null,lastRenderedReducer:Nn,lastRenderedState:e},e=e.dispatch=Kn.bind(null,Ou,e),[t.memoizedState,e]}function Dn(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ou.updateQueue,null===t?(t={lastEffect:null},Ou.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,null===n?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Ln(){return Pn().memoizedState}function Rn(e,t,n,r){var o=Tn();Ou.effectTag|=e,o.memoizedState=Dn(1|t,n,void 0,void 0===r?null:r)}function jn(e,t,n,r){var o=Pn();r=void 0===r?null:r;var a=void 0;if(null!==Cu){var i=Cu.memoizedState;if(a=i.destroy,null!==r&&wn(r,i.deps))return void Dn(t,n,a,r)}Ou.effectTag|=e,o.memoizedState=Dn(1|t,n,a,r)}function Un(e,t){return Rn(516,4,e,t)}function Hn(e,t){return jn(516,4,e,t)}function zn(e,t){return jn(4,2,e,t)}function Yn(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Vn(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,jn(4,2,Yn.bind(null,t,e),n)}function Fn(){}function Wn(e,t){return Tn().memoizedState=[e,void 0===t?null:t],e}function Bn(e,t){var n=Pn();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&wn(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Gn(e,t){var n=Pn();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&wn(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function qn(e,t,n){var r=Vt();Wt(98>r?98:r,function(){e(!0)}),Wt(97<\/script>",e=e.removeChild(e.firstChild)):"string"==typeof o.is?e=l.createElement(a,{is:o.is}):(e=l.createElement(a),"select"===a&&(l=e,o.multiple?l.multiple=!0:o.size&&(l.size=o.size))):e=l.createElementNS(e,a),e[Ti]=t,e[Pi]=o,Pl(e,t,!1,!1),t.stateNode=e,l=Le(a,o),a){case"iframe":case"object":case"embed":we("load",e),u=o;break;case"video":case"audio":for(u=0;uo.tailExpiration&&1t)&&bc.set(e,t))}}function zr(e,t){e.expirationTimee?n:e,2>=e&&t!==e?0:e}function Vr(e){if(0!==e.lastExpiredTime)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=Gt(Wr.bind(null,e));else{var t=Yr(e),n=e.callbackNode;if(0===t)null!==n&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var r=jr();if(1073741823===t?r=99:1===t||2===t?r=95:(r=10*(1073741821-t)-10*(1073741821-r),r=0>=r?99:250>=r?98:5250>=r?97:95),null!==n){var o=e.callbackPriority;if(e.callbackExpirationTime===t&&o>=r)return;n!==Xl&&Yl(n)}e.callbackExpirationTime=t,e.callbackPriority=r,t=1073741823===t?Gt(Wr.bind(null,e)):Bt(r,Fr.bind(null,e),{timeout:10*(1073741821-t)-ru()}),e.callbackNode=t}}}function Fr(e,t){if(_c=0,t)return t=jr(),To(e,t),Vr(e),null;var n=Yr(e);if(0!==n){if(t=e.callbackNode,($u&(Bu|Gu))!==Fu)throw Error(r(327));if(lo(),e===ec&&n===nc||Kr(e,n),null!==tc){var o=$u;$u|=Bu;for(var a=Xr();;)try{eo();break}catch(t){Qr(e,t)}if(Jt(),$u=o,Yu.current=a,rc===Ku)throw t=oc,Kr(e,n),wo(e,n),Vr(e),t;if(null===tc)switch(a=e.finishedWork=e.current.alternate,e.finishedExpirationTime=n,o=rc,ec=null,o){case qu:case Ku:throw Error(r(345));case Qu:To(e,2=n){e.lastPingedTime=n,Kr(e,n);break}}if(0!==(i=Yr(e))&&i!==n)break;if(0!==o&&o!==n){e.lastPingedTime=o;break}e.timeoutHandle=Mi(oo.bind(null,e),a);break}oo(e);break;case Ju:if(wo(e,n),o=e.lastSuspendedTime,n===o&&(e.nextKnownPendingLevel=ro(a)),cc&&(0===(a=e.lastPingedTime)||a>=n)){e.lastPingedTime=n,Kr(e,n);break}if(0!==(a=Yr(e))&&a!==n)break;if(0!==o&&o!==n){e.lastPingedTime=o;break}if(1073741823!==ic?o=10*(1073741821-ic)-ru():1073741823===ac?o=0:(o=10*(1073741821-ac)-5e3,a=ru(),n=10*(1073741821-n)-a,o=a-o,0>o&&(o=0),o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*zu(o/1960))-o,n=o?o=0:(a=0|l.busyDelayMs,i=ru()-(10*(1073741821-i)-(0|l.timeoutMs||5e3)),o=i<=a?0:a+o-i),10 component higher in the tree to provide a loading indicator or placeholder to display."+T(i))}rc!==Zu&&(rc=Qu),l=gr(l,i),f=a;do{switch(f.tag){case 3:u=l,f.effectTag|=4096,f.expirationTime=t;ln(f,Lr(f,u,t));break e;case 1:u=l;var S=f.type,E=f.stateNode;if(0==(64&f.effectTag)&&("function"==typeof S.getDerivedStateFromError||null!==E&&"function"==typeof E.componentDidCatch&&(null===vc||!vc.has(E)))){f.effectTag|=4096,f.expirationTime=t;ln(f,Rr(f,u,t));break e}}f=f.return}while(null!==f)}tc=no(tc)}catch(e){t=e;continue}break}}function Xr(){var e=Yu.current;return Yu.current=xu,null===e?xu:e}function Jr(e,t){euc&&(uc=e)}function $r(){for(;null!==tc;)tc=to(tc)}function eo(){for(;null!==tc&&!Jl();)tc=to(tc)}function to(e){var t=ju(e.alternate,e,nc);return e.memoizedProps=e.pendingProps,null===t&&(t=no(e)),Vu.current=null,t}function no(e){tc=e;do{var t=tc.alternate;if(e=tc.return,0==(2048&tc.effectTag)){if(t=yr(t,tc,nc),1===nc||1!==tc.childExpirationTime){for(var n=0,r=tc.child;null!==r;){var o=r.expirationTime,a=r.childExpirationTime;o>n&&(n=o),a>n&&(n=a),r=r.sibling}tc.childExpirationTime=n}if(null!==t)return t;null!==e&&0==(2048&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=tc.firstEffect),null!==tc.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=tc.firstEffect),e.lastEffect=tc.lastEffect),1e?t:e}function oo(e){var t=Vt();return Wt(99,ao.bind(null,e,t)),null}function ao(e,t){do{lo()}while(null!==mc);if(($u&(Bu|Gu))!==Fu)throw Error(r(327));var n=e.finishedWork,o=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var a=ro(n);if(e.firstPendingTime=a,o<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:o<=e.firstSuspendedTime&&(e.firstSuspendedTime=o-1),o<=e.lastPingedTime&&(e.lastPingedTime=0),o<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===ec&&(tc=ec=null,nc=0),1u&&(s=u,u=l,l=s),s=ze(S,l),f=ze(S,u),s&&f&&(1!==_.rangeCount||_.anchorNode!==s.node||_.anchorOffset!==s.offset||_.focusNode!==f.node||_.focusOffset!==f.offset)&&(E=E.createRange(),E.setStart(s.node,s.offset),_.removeAllRanges(),l>u?(_.addRange(E),_.extend(f.node,f.offset)):(E.setEnd(f.node,f.offset),_.addRange(E)))))),E=[];for(_=S;_=_.parentNode;)1===_.nodeType&&E.push({element:_,left:_.scrollLeft,top:_.scrollTop});for("function"==typeof S.focus&&S.focus(),S=0;S=t&&e<=t}function wo(e,t){var n=e.firstSuspendedTime,r=e.lastSuspendedTime;nt||0===n)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function xo(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var n=e.firstSuspendedTime;0!==n&&(t>=n?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function To(e,t){var n=e.lastExpiredTime;(0===n||n>t)&&(e.lastExpiredTime=t)}function Po(e,t,n,o){var a=t.current,i=jr(),l=cu.suspense;i=Ur(i,a,l);e:if(n){n=n._reactInternalFiber;t:{if($(n)!==n||1!==n.tag)throw Error(r(170));var u=n;do{switch(u.tag){case 3:u=u.stateNode.context;break t;case 1:if(Rt(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break t}}u=u.return}while(null!==u);throw Error(r(171))}if(1===n.tag){var c=n.type;if(Rt(c)){n=Ht(n,c,u);break e}}n=u}else n=Ll;return null===t.context?t.context=n:t.pendingContext=n,t=on(i,l),t.payload={element:e},o=void 0===o?null:o,null!==o&&(t.callback=o),an(a,t),Hr(a,i),i}function No(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function Io(e,t){null!==(e=e.memoizedState)&&null!==e.dehydrated&&e.retryTime - - - com.alipay.sofa - sofa-rpc-all - - - net.jcip - jcip-annotations - - - io.grpc - grpc-core - - - commons-io - commons-io - - - okio - com.squareup.okio - - - sofa-common-tools - com.alipay.sofa.common - - - - - com.alipay.sofa.common - sofa-common-tools - ${sofa-common-tools.version} - - - guava - com.google.guava - - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-sofa - ${project.version} - - - com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery @@ -418,9 +373,7 @@ - + com.weibo motan-core diff --git a/shenyu-client/pom.xml b/shenyu-client/pom.xml index 99c44202b153..08f25614faca 100644 --- a/shenyu-client/pom.xml +++ b/shenyu-client/pom.xml @@ -31,7 +31,6 @@ shenyu-client-http shenyu-client-mcp shenyu-client-dubbo - shenyu-client-sofa shenyu-client-tars shenyu-client-grpc shenyu-client-motan diff --git a/shenyu-client/shenyu-client-sofa/pom.xml b/shenyu-client/shenyu-client-sofa/pom.xml deleted file mode 100644 index e58b8a6b3499..000000000000 --- a/shenyu-client/shenyu-client-sofa/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-client - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-client-sofa - - - 4.3.0 - 4.3.0 - - - - - org.apache.shenyu - shenyu-client-core - ${project.version} - - - grpc-netty - io.grpc - - - - - com.alipay.sofa - runtime-sofa-boot-starter - ${runtime-sofa-boot-starter.version} - provided - - - sofa-common-tools - com.alipay.sofa.common - - - - - - com.alipay.sofa - sofa-rpc-all - provided - - - com.alipay.sofa.common - sofa-common-tools - ${sofa-common-tools.version} - - - org.springframework - spring-beans - provided - - - org.springframework - spring-context - provided - - - org.springframework - spring-core - provided - - - diff --git a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceEventListener.java b/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceEventListener.java deleted file mode 100644 index 167c580da687..000000000000 --- a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/SofaServiceEventListener.java +++ /dev/null @@ -1,226 +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.sofa; - -import com.alipay.sofa.runtime.service.component.Service; -import com.alipay.sofa.runtime.spring.factory.ServiceFactoryBean; -import org.apache.commons.lang3.StringUtils; -import org.apache.shenyu.client.core.client.AbstractContextRefreshedEventListener; -import org.apache.shenyu.client.core.constant.ShenyuClientConstants; -import org.apache.shenyu.client.sofa.common.annotation.ShenyuSofaClient; -import org.apache.shenyu.client.sofa.common.dto.SofaRpcExt; -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.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.aop.support.AopUtils; -import org.springframework.context.ApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.lang.NonNull; -import org.springframework.util.ReflectionUtils; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * The Sofa Service Event Listener. - */ -public class SofaServiceEventListener extends AbstractContextRefreshedEventListener { - - private static final Logger LOG = LoggerFactory.getLogger(SofaServiceEventListener.class); - - public SofaServiceEventListener(final ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) { - super(clientConfig, shenyuClientRegisterRepository); - } - - @Override - protected Map getBeans(final ApplicationContext context) { - return context.getBeansOfType(ServiceFactoryBean.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.SOFA.getName()) - .eventType(EventType.REGISTER) - .host(super.getHost()) - .port(Integer.parseInt(getPort())) - .namespaceId(namespaceId) - .build(); - } - - @Override - protected String getClientName() { - return RpcTypeEnum.SOFA.getName(); - } - - @Override - protected String buildApiSuperPath(final Class clazz, - final ShenyuSofaClient beanShenyuClient) { - if (Objects.nonNull(beanShenyuClient) && !StringUtils.isBlank(beanShenyuClient.path())) { - return beanShenyuClient.path(); - } - return ""; - } - - @Override - protected Class getAnnotationType() { - return ShenyuSofaClient.class; - } - - @Override - protected String buildApiPath(final Method method, - final String superPath, - @NonNull final ShenyuSofaClient shenyuSofaClient) { - final String contextPath = this.getContextPath(); - return superPath.contains("*") ? pathJoin(contextPath, superPath.replace("*", ""), method.getName()) - : pathJoin(contextPath, superPath, shenyuSofaClient.path()); - } - - @Override - protected MetaDataRegisterDTO buildMetaDataDTO(final ServiceFactoryBean serviceBean, - @NonNull final ShenyuSofaClient shenyuSofaClient, - final String superPath, - final Class clazz, - final Method method, - final String namespaceId) { - String appName = this.getAppName(); - String contextPath = this.getContextPath(); - String path = pathJoin(contextPath, superPath, shenyuSofaClient.path()); - String serviceName = serviceBean.getInterfaceClass().getName(); - String desc = shenyuSofaClient.desc(); - String configRuleName = shenyuSofaClient.ruleName(); - String ruleName = StringUtils.isEmpty(configRuleName) ? path : configRuleName; - String methodName = method.getName(); - String parameterTypes = Arrays.stream(method.getParameters()) - .map(parameter -> { - StringBuilder result = new StringBuilder(parameter.getType().getName()); - final Type type = parameter.getParameterizedType(); - if (type instanceof ParameterizedType) { - final Type[] actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments(); - for (Type actualTypeArgument : actualTypeArguments) { - result.append("#").append(actualTypeArgument.getTypeName()); - } - } - return result.toString(); - }).collect(Collectors.joining(",")); - return MetaDataRegisterDTO.builder() - .appName(appName) - .serviceName(serviceName) - .methodName(methodName) - .contextPath(contextPath) - .host(super.getHost()) - .port(Integer.parseInt(getPort())) - .path(path) - .ruleName(ruleName) - .pathDesc(desc) - .parameterTypes(parameterTypes) - .rpcType(RpcTypeEnum.SOFA.getName()) - .rpcExt(buildRpcExt(shenyuSofaClient)) - .enabled(shenyuSofaClient.enabled()) - .namespaceId(namespaceId) - .build(); - } - - @Override - public void onApplicationEvent(final ContextRefreshedEvent contextRefreshedEvent) { - Map serviceBean = contextRefreshedEvent.getApplicationContext().getBeansOfType(ServiceFactoryBean.class); - for (Map.Entry entry : serviceBean.entrySet()) { - handler(entry.getValue()); - } - } - - @Override - protected Sextet buildApiDocSextet(final Method method, final Annotation annotation, - final Map beans) { - ShenyuSofaClient shenyuSofaClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuSofaClient.class); - if (Objects.isNull(shenyuSofaClient)) { - return null; - } - String produce = ShenyuClientConstants.MEDIA_TYPE_ALL_VALUE; - String consume = ShenyuClientConstants.MEDIA_TYPE_ALL_VALUE; - String[] values = new String[]{shenyuSofaClient.value()}; - ApiHttpMethodEnum[] apiHttpMethodEnums = new ApiHttpMethodEnum[]{ApiHttpMethodEnum.NOT_HTTP}; - String version = "v0.01"; - return Sextet.with(values, consume, produce, apiHttpMethodEnums, RpcTypeEnum.SOFA, version); - } - - private void handler(final ServiceFactoryBean serviceBean) { - Class clazz; - Object targetProxy; - try { - targetProxy = ((Service) Objects.requireNonNull(serviceBean.getObject())).getTarget(); - clazz = targetProxy.getClass(); - } catch (Exception e) { - LOG.error("failed to get sofa target class", e); - return; - } - if (AopUtils.isAopProxy(targetProxy)) { - clazz = AopUtils.getTargetClass(targetProxy); - } - final ShenyuSofaClient beanSofaClient = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuSofaClient.class); - final String superPath = buildApiSuperPath(clazz, beanSofaClient); - List namespaceIds = super.getNamespace(); - if (superPath.contains("*") && Objects.nonNull(beanSofaClient)) { - Method[] declaredMethods = ReflectionUtils.getDeclaredMethods(clazz); - for (String namespaceId : namespaceIds) { - for (Method declaredMethod : declaredMethods) { - getPublisher().publishEvent(buildMetaDataDTO(serviceBean, beanSofaClient, superPath, clazz, declaredMethod, namespaceId)); - } - } - return; - } - Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz); - for (String namespaceId : namespaceIds) { - for (Method method : methods) { - ShenyuSofaClient methodSofaClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuSofaClient.class); - if (Objects.nonNull(methodSofaClient)) { - getPublisher().publishEvent(buildMetaDataDTO(serviceBean, methodSofaClient, superPath, clazz, method, namespaceId)); - } - } - } - } - - private String buildRpcExt(final ShenyuSofaClient shenyuSofaClient) { - SofaRpcExt build = SofaRpcExt.builder() - .loadbalance(shenyuSofaClient.loadBalance()) - .retries(shenyuSofaClient.retries()) - .timeout(shenyuSofaClient.timeout()) - .build(); - return GsonUtils.getInstance().toJson(build); - } -} diff --git a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/common/annotation/ShenyuSofaClient.java b/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/common/annotation/ShenyuSofaClient.java deleted file mode 100644 index 5e1354e80fea..000000000000 --- a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/common/annotation/ShenyuSofaClient.java +++ /dev/null @@ -1,93 +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.sofa.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 ShenyuSofaClient { - - /** - * 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; - - /** - * LoadBalance string. - * - * @return the boolean - */ - String loadBalance() default "hash"; - - /** - * Timeout long. - * - * @return the timeout - */ - int timeout() default -1; - - /** - * Retries int. - * - * @return the retries - */ - int retries() default 3; -} diff --git a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/common/dto/SofaRpcExt.java b/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/common/dto/SofaRpcExt.java deleted file mode 100644 index 89b05f9904cd..000000000000 --- a/shenyu-client/shenyu-client-sofa/src/main/java/org/apache/shenyu/client/sofa/common/dto/SofaRpcExt.java +++ /dev/null @@ -1,184 +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.sofa.common.dto; - -/** - * The type Sofa rpc ext. - */ -public class SofaRpcExt { - - private String loadbalance; - - private Integer retries; - - private Integer timeout; - - /** - * constructor without params. - */ - public SofaRpcExt() { - } - - /** - * constructor with all params. - * - * @param loadbalance loadbalance - * @param retries retries - * @param timeout timeout - */ - public SofaRpcExt(final String loadbalance, final Integer retries, final Integer timeout) { - this.loadbalance = loadbalance; - this.retries = retries; - this.timeout = timeout; - } - - /** - * get loadbalance. - * - * @return loadbalance - */ - public String getLoadbalance() { - return loadbalance; - } - - /** - * set loadbalance. - * - * @param loadbalance loadbalance - */ - public void setLoadbalance(final String loadbalance) { - this.loadbalance = loadbalance; - } - - /** - * get retries. - * - * @return retries - */ - public Integer getRetries() { - return retries; - } - - /** - * set retries. - * - * @param retries retries - */ - public void setRetries(final Integer retries) { - this.retries = retries; - } - - /** - * get timeout. - * - * @return timeout - */ - public Integer getTimeout() { - return timeout; - } - - /** - * set timeout. - * - * @param timeout timeout - */ - public void setTimeout(final Integer timeout) { - this.timeout = timeout; - } - - @Override - public String toString() { - return "SofaRpcExt{" - + "loadbalance='" + loadbalance + '\'' - + ", retries=" + retries - + ", timeout=" + timeout - + '}'; - } - - /** - * get the Builder of SofaRpcExt. - * @return Builder - */ - public static Builder builder() { - return new Builder(); - } - - /** - * the Builder of SofaRpcExt. - */ - public static final class Builder { - - private String loadbalance; - - private Integer retries; - - private Integer timeout; - - /** - * constructor without params. - */ - private Builder() { - } - - /** - * set loadbalance. - * - * @param loadbalance loadbalance - * @return Builder - */ - public Builder loadbalance(final String loadbalance) { - this.loadbalance = loadbalance; - return this; - } - - /** - * set retries. - * - * @param retries retries - * @return Builder - */ - public Builder retries(final Integer retries) { - this.retries = retries; - return this; - } - - /** - * set timeout. - * - * @param timeout timeout - * @return Builder - */ - public Builder timeout(final Integer timeout) { - this.timeout = timeout; - return this; - } - - /** - * build SofaRpcExt. - * - * @return SofaRpcExt - */ - public SofaRpcExt build() { - SofaRpcExt sofaRpcExt = new SofaRpcExt(); - sofaRpcExt.setLoadbalance(loadbalance); - sofaRpcExt.setRetries(retries); - sofaRpcExt.setTimeout(timeout); - return sofaRpcExt; - } - } -} diff --git a/shenyu-client/shenyu-client-sofa/src/test/java/org/apache/shenyu/client/sofa/SofaServiceEventListenerTest.java b/shenyu-client/shenyu-client-sofa/src/test/java/org/apache/shenyu/client/sofa/SofaServiceEventListenerTest.java deleted file mode 100644 index a38615c987d7..000000000000 --- a/shenyu-client/shenyu-client-sofa/src/test/java/org/apache/shenyu/client/sofa/SofaServiceEventListenerTest.java +++ /dev/null @@ -1,259 +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.sofa; - -import com.alipay.sofa.runtime.spring.factory.ServiceFactoryBean; -import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepositoryFactory; -import org.apache.shenyu.client.sofa.common.annotation.ShenyuSofaClient; -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.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.springframework.context.ApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import static org.mockito.BDDMockito.given; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -/** - * Test for {@link SofaServiceEventListener}. - */ -@ExtendWith(MockitoExtension.class) -public class SofaServiceEventListenerTest { - - private static final String CONTEXT_PATH = "/sofa"; - - 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 String LOAD_BALANCE = "loadBalance"; - - private static final int RETRY_TIME = 0; - - private static final int TIME_OUT = 0; - - private static final boolean ENABLED = true; - - @InjectMocks - private SofaServiceEventListener sofaServiceEventListener = buildSofaServiceEventListener(); - - @Mock - private ApplicationContext applicationContext; - - @Mock - private ShenyuSofaClient shenyuSofaClient; - - @Mock - private Method method; - - @Mock - private ServiceFactoryBean serviceFactoryBean; - - @Mock - private ContextRefreshedEvent contextRefreshedEvent; - - @Test - public void testGetBeans() { - sofaServiceEventListener.getBeans(applicationContext); - - verify(applicationContext, times(1)).getBeansOfType(ServiceFactoryBean.class); - } - - @Test - public void testBuildURIRegisterDTO() { - URIRegisterDTO expectedURIRegisterDTO = URIRegisterDTO.builder() - .contextPath(CONTEXT_PATH) - .appName(APP_NAME) - .rpcType(RpcTypeEnum.SOFA.getName()) - .eventType(EventType.REGISTER) - .host(HOST) - .port(Integer.parseInt(PORT)) - .namespaceId(Constants.SYS_DEFAULT_NAMESPACE_ID) - .build(); - Map beans = new HashMap<>(); - URIRegisterDTO realURIRegisterDTO = sofaServiceEventListener.buildURIRegisterDTO(applicationContext, beans, Constants.SYS_DEFAULT_NAMESPACE_ID); - - assertEquals(expectedURIRegisterDTO, realURIRegisterDTO); - } - - @Test - public void testBuildApiSuperPathWhenBeanShenyuClientIsNull() { - Class clazz = Class.class; - String realSuperPath = sofaServiceEventListener.buildApiSuperPath(clazz, null); - - verify(shenyuSofaClient, times(0)).path(); - assertEquals("", realSuperPath); - } - - @Test - public void testBuildApiSuperPathWhenBeanShenyuClientPathIsEmpty() { - Class clazz = Class.class; - given(shenyuSofaClient.path()).willReturn(""); - String realSuperPath = sofaServiceEventListener.buildApiSuperPath(clazz, shenyuSofaClient); - - verify(shenyuSofaClient, times(1)).path(); - assertEquals("", realSuperPath); - } - - @Test - public void testBuildApiSuperPath() { - Class clazz = Class.class; - given(shenyuSofaClient.path()).willReturn(PATH); - String realSuperPath = sofaServiceEventListener.buildApiSuperPath(clazz, shenyuSofaClient); - - verify(shenyuSofaClient, times(2)).path(); - assertEquals(PATH, realSuperPath); - } - - @Test - public void testGetAnnotationType() { - Class clazz = sofaServiceEventListener.getAnnotationType(); - - assertEquals(ShenyuSofaClient.class, clazz); - } - - @Test - public void testBuildApiPathSuperPathContainsStar() { - given(method.getName()).willReturn(METHOD_NAME); - String realApiPath = sofaServiceEventListener.buildApiPath(method, SUPER_PATH_CONTAINS_STAR, shenyuSofaClient); - String expectedApiPath = "/sofa/demo/buildURIRegisterDTO"; - - assertEquals(expectedApiPath, realApiPath); - } - - @Test - public void testBuildApiPathSuperPathNotContainsStar() { - given(shenyuSofaClient.path()).willReturn(PATH); - String realApiPath = sofaServiceEventListener.buildApiPath(method, SUPER_PATH_NOT_CONTAINS_STAR, shenyuSofaClient); - String expectedApiPath = "/sofa/findByIdsAndName/path"; - - assertEquals(expectedApiPath, realApiPath); - } - - @Test - public void testBuildMetaDataDTO() throws NoSuchMethodException { - Method method = SofaServiceEventListener - .class - .getDeclaredMethod(METHOD_NAME, ApplicationContext.class, Map.class, String.class); - given(shenyuSofaClient.path()).willReturn(PATH); - given(shenyuSofaClient.desc()).willReturn(DESC); - given(shenyuSofaClient.ruleName()).willReturn(CONFIG_RULE_NAME); - given(shenyuSofaClient.loadBalance()).willReturn(LOAD_BALANCE); - given(shenyuSofaClient.retries()).willReturn(RETRY_TIME); - given(shenyuSofaClient.timeout()).willReturn(TIME_OUT); - given(shenyuSofaClient.enabled()).willReturn(ENABLED); - // The willReturn method cannot have the class type as an input parameter. - // Have raised the question in the Mockito community, will get back to this after getting answer - doReturn(Comparable.class).when(serviceFactoryBean).getInterfaceClass(); - - String expectedParameterTypes = "org.springframework.context.ApplicationContext,java.util.Map#java.lang.String#" - + "com.alipay.sofa.runtime.spring.factory.ServiceFactoryBean,java.lang.String"; - String expectedPath = "/sofa/findByIdsAndName/path"; - String expectedRpcExt = "{\"loadbalance\":\"loadBalance\",\"retries\":0,\"timeout\":0}"; - - MetaDataRegisterDTO realMetaDataRegisterDTO = sofaServiceEventListener - .buildMetaDataDTO( - serviceFactoryBean, - shenyuSofaClient, - SUPER_PATH_NOT_CONTAINS_STAR, - SofaServiceEventListener.class, - method, Constants.SYS_DEFAULT_NAMESPACE_ID); - MetaDataRegisterDTO expectedMetaDataRegisterDTO = MetaDataRegisterDTO - .builder() - .appName(APP_NAME) - .serviceName(SERVICE_NAME) - .methodName(METHOD_NAME) - .contextPath(CONTEXT_PATH) - .host(HOST) - .port(Integer.parseInt(PORT)) - .path(expectedPath) - .ruleName(CONFIG_RULE_NAME) - .pathDesc(DESC) - .parameterTypes(expectedParameterTypes) - .rpcType(RpcTypeEnum.SOFA.getName()) - .rpcExt(expectedRpcExt) - .enabled(ENABLED) - .namespaceId(Constants.SYS_DEFAULT_NAMESPACE_ID) - .build(); - - assertEquals(expectedMetaDataRegisterDTO, realMetaDataRegisterDTO); - } - - private SofaServiceEventListener buildSofaServiceEventListener() { - 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); - - ShenyuClientConfig clientConfig = new ShenyuClientConfig(); - Map client = new HashMap<>(); - client.put(RpcTypeEnum.SOFA.getName(), config); - clientConfig.setClient(client); - - ShenyuRegisterCenterConfig mockRegisterCenter = new ShenyuRegisterCenterConfig(); - mockRegisterCenter.setServerLists("http://localhost:58080"); - mockRegisterCenter.setRegisterType("http"); - mockRegisterCenter.setProps(properties); - - return new SofaServiceEventListener(clientConfig, ShenyuClientRegisterRepositoryFactory.newInstance(mockRegisterCenter)); - } - -} 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..0d457ece29b6 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 @@ -92,11 +92,6 @@ public interface Constants { */ String DUBBO_RPC_RESULT_EMPTY = "dubbo has not return value!"; - /** - * The constant SOFA_RPC_RESULT_EMPTY. - */ - String SOFA_RPC_RESULT_EMPTY = "sofa has not return value!"; - /** * The constant RPC_RESULT. */ @@ -588,11 +583,6 @@ public interface Constants { */ String DUBBO_DEFAULT_APPLICATION_NAME = "shenyu_proxy"; - /** - * sofa default application name. - */ - String SOFA_DEFAULT_APPLICATION_NAME = "sofa"; - /** * dubbo group. */ diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/SofaRegisterConfig.java b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/SofaRegisterConfig.java deleted file mode 100644 index 38916eafb9aa..000000000000 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/SofaRegisterConfig.java +++ /dev/null @@ -1,216 +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 sofa register config. - */ -public class SofaRegisterConfig implements Serializable { - - private static final long serialVersionUID = -3770114790533455035L; - - private String register; - - private String group; - - private String protocol; - - private String threadpool; - - private Integer corethreads; - - private Integer threads; - - private Integer queues; - - /** - * get register. - * - * @return register - */ - public String getRegister() { - return register; - } - - /** - * set register. - * - * @param register register - */ - public void setRegister(final String register) { - this.register = register; - } - - /** - * get group. - * - * @return group - */ - public String getGroup() { - return group; - } - - /** - * set group. - * - * @param group group - */ - public void setGroup(final String group) { - this.group = group; - } - - /** - * get protocol. - * - * @return protocol - */ - public String getProtocol() { - return protocol; - } - - /** - * set protocol. - * - * @param protocol protocol - */ - public void setProtocol(final String protocol) { - this.protocol = protocol; - } - - /** - * 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 - */ - 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; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (Objects.isNull(o) || getClass() != o.getClass()) { - return false; - } - SofaRegisterConfig that = (SofaRegisterConfig) o; - return Objects.equals(register, that.register) && Objects.equals(group, that.group) - && Objects.equals(protocol, that.protocol) && 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(register, group, protocol, threadpool, corethreads, threads, queues); - } - - @Override - public String toString() { - return "SofaRegisterConfig{" - + "register='" - + register - + '\'' - + ", group='" - + group - + '\'' - + ", protocol='" - + protocol - + '\'' - + ", threadpool='" - + threadpool - + '\'' - + ", corethreads='" - + corethreads - + '\'' - + ", threads='" - + threads - + '\'' - + ", queues='" - + queues - + '\'' - + '}'; - } -} diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/rule/impl/SofaRuleHandle.java b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/rule/impl/SofaRuleHandle.java deleted file mode 100644 index 577eb137d139..000000000000 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/rule/impl/SofaRuleHandle.java +++ /dev/null @@ -1,131 +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.rule.impl; - -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.convert.rule.RuleHandle; -import org.apache.shenyu.common.enums.LoadBalanceEnum; - -import java.util.Objects; - -/** - * The type Sofa rule handle. - */ - -public class SofaRuleHandle implements RuleHandle { - - /** - * retries. - */ - private Integer retries = 0; - - /** - * the loadBalance. - * {@linkplain LoadBalanceEnum} - */ - private String loadBalance = LoadBalanceEnum.RANDOM.getName(); - - /** - * timeout is required. - */ - private long timeout = Constants.TIME_OUT; - - /** - * get retries. - * - * @return retries - */ - public Integer getRetries() { - return retries; - } - - /** - * set retries. - * - * @param retries retries - */ - public void setRetries(final Integer retries) { - this.retries = retries; - } - - /** - * get loadBalance. - * - * @return loadBalance - */ - public String getLoadBalance() { - return loadBalance; - } - - /** - * set loadBalance. - * - * @param loadBalance loadBalance - */ - public void setLoadBalance(final String loadBalance) { - this.loadBalance = loadBalance; - } - - /** - * get timeout. - * - * @return timeout - */ - public long getTimeout() { - return timeout; - } - - /** - * set timeout. - * - * @param timeout timeout - */ - public void setTimeout(final long timeout) { - this.timeout = timeout; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (Objects.isNull(o) || getClass() != o.getClass()) { - return false; - } - SofaRuleHandle that = (SofaRuleHandle) o; - return timeout == that.timeout && Objects.equals(retries, that.retries) && Objects.equals(loadBalance, that.loadBalance); - } - - @Override - public int hashCode() { - return Objects.hash(retries, loadBalance, timeout); - } - - @Override - public String toString() { - return "SofaRuleHandle{" - + "retries=" - + retries - + ", loadBalance='" - + loadBalance - + '\'' - + ", timeout=" - + timeout - + '}'; - } -} diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/SofaUpstream.java b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/SofaUpstream.java deleted file mode 100644 index cf1f343dd20b..000000000000 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/SofaUpstream.java +++ /dev/null @@ -1,347 +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; - -/** - * The type Sofa selector upstream. - */ -public final class SofaUpstream extends CommonUpstream { - - /** - * registry url is required. - */ - private String register; - - /** - * sofa application name is required. - */ - private String appName; - - /** - * port. - */ - private int port; - - /** - * weight. - */ - private int weight; - - /** - * warmup. - */ - private int warmup; - - /** - * builder constructor. - * - * @param builder builder - */ - private SofaUpstream(final Builder builder) { - boolean statusValue = builder.statusValue; - if (!builder.statusSet) { - statusValue = defaultStatus(); - } - setUpstreamHost(builder.upstreamHost); - setProtocol(builder.protocol); - setUpstreamUrl(builder.upstreamUrl); - this.weight = builder.weight; - setStatus(statusValue); - setTimestamp(builder.timestamp); - this.warmup = builder.warmup; - } - - /** - * class builder. - * - * @return Builder - */ - public static Builder builder() { - return new Builder(); - } - - /** - * get registry. - * - * @return registry - */ - public String getRegister() { - return register; - } - - /** - * set registry. - * - * @param registry registry - */ - public void setRegister(final String registry) { - this.register = register; - } - - /** - * get appName. - * - * @return appName - */ - public String getAppName() { - return appName; - } - - /** - * set appName. - * - * @param appName appName - */ - public void setAppName(final String appName) { - this.appName = appName; - } - - /** - * get port. - * - * @return port - */ - public int getPort() { - return port; - } - - /** - * set port. - * - * @param port port - */ - public void setPort(final int port) { - this.port = port; - } - - /** - * Gets the value of weight. - * - * @return the value of weight - */ - public int getWeight() { - return weight; - } - - /** - * Sets the weight. - * - * @param weight weight - */ - public void setWeight(final int weight) { - this.weight = weight; - } - - /** - * Gets the value of warmup. - * - * @return the value of warmup - */ - public int getWarmup() { - return warmup; - } - - /** - * Sets the warmup. - * - * @param warmup warmup - */ - public void setWarmup(final int warmup) { - this.warmup = warmup; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof SofaUpstream)) { - return false; - } - SofaUpstream that = (SofaUpstream) o; - return port == that.port - && Objects.equals(register, that.register) - && Objects.equals(appName, that.appName) - && Objects.equals(this.getProtocol(), that.getProtocol()) - && Objects.equals(this.getUpstreamUrl(), that.getUpstreamUrl()) - && Objects.equals(this.isGray(), that.isGray()); - } - - @Override - public int hashCode() { - return Objects.hash(register, appName, port, this.isGray()); - } - - @Override - public String toString() { - return "SofaUpstream{" - + "registry='" + register - + "', appName='" + appName - + "', protocol='" + this.getProtocol() - + "', port=" + port - + ", upstreamUrl='" + this.getUpstreamUrl() - + "', gray=" + this.isGray() - + ", weight=" + weight - + ", warmup=" + warmup - + ", status=" + isStatus() - + ", timestamp=" + getTimestamp() - + "'}"; - } - - /** - * class builder. - */ - public static final class Builder { - - /** - * upstreamHost. - */ - private String upstreamHost; - - /** - * protocol. - */ - private String protocol; - - /** - * upstreamUrl. - */ - private String upstreamUrl; - - /** - * weight. - */ - private int weight; - - /** - * status. - */ - private boolean statusSet; - - /** - * status. - */ - private boolean statusValue; - - /** - * timestamp. - */ - private long timestamp; - - /** - * warmup. - */ - private int warmup; - - /** - * no args constructor. - */ - private Builder() { - } - - /** - * build new Object. - * - * @return DivideUpstream - */ - public SofaUpstream build() { - return new SofaUpstream(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 weight. - * - * @param weight weight - * @return this - */ - public Builder weight(final int weight) { - this.weight = weight; - 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 warmup. - * - * @param warmup warmup - * @return this - */ - public Builder warmup(final int warmup) { - this.warmup = warmup; - 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 b184a0a235d2..91ad32243384 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 @@ -247,11 +247,6 @@ public enum PluginEnum { */ DUBBO(310, 0, "dubbo"), - /** - * Sofa plugin enum. - */ - SOFA(310, 0, "sofa"), - /** * Tars 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..9b59dfa72892 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 @@ -38,11 +38,6 @@ public enum RpcTypeEnum { */ DUBBO("dubbo", true), - /** - * Sofa rpc type enum. - */ - SOFA("sofa", true), - /** * Tars rpc type enum. */ @@ -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.TARS, RpcTypeEnum.MOTAN); } /** 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..61de359d4613 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 @@ -42,8 +42,6 @@ public static String rpcTypeAdapter(final String rpcType) { return PluginEnum.DUBBO.getName(); case TARS: return PluginEnum.TARS.getName(); - case SOFA: - return PluginEnum.SOFA.getName(); case WEB_SOCKET: return PluginEnum.WEB_SOCKET.getName(); case MOTAN: diff --git a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/SofaRegisterConfigTest.java b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/SofaRegisterConfigTest.java deleted file mode 100644 index 584125fbeb46..000000000000 --- a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/SofaRegisterConfigTest.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.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 SofaRegisterConfig. - */ -public class SofaRegisterConfigTest { - - @Test - public void testGetterSetter() { - SofaRegisterConfig config = new SofaRegisterConfig(); - config.setRegister("reg"); - config.setGroup("group"); - config.setProtocol("protocol"); - - assertThat(config.getRegister(), is("reg")); - assertThat(config.getGroup(), is("group")); - assertThat(config.getProtocol(), is("protocol")); - } - - @Test - public void testEqualsAndHashCode() { - SofaRegisterConfig config1 = new SofaRegisterConfig(); - SofaRegisterConfig config2 = new SofaRegisterConfig(); - - assertThat(ImmutableSet.of(config1, config2), hasSize(1)); - } - -} diff --git a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/rule/impl/SofaRuleHandleTest.java b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/rule/impl/SofaRuleHandleTest.java deleted file mode 100644 index 70d06f71a27b..000000000000 --- a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/rule/impl/SofaRuleHandleTest.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.common.dto.convert.rule.impl; - -import com.google.common.collect.ImmutableSet; -import org.apache.shenyu.common.enums.LoadBalanceEnum; -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 SofaRuleHandle. - */ -public class SofaRuleHandleTest { - - @Test - public void testGetterSetter() { - SofaRuleHandle handle = new SofaRuleHandle(); - - handle.setRetries(10); - handle.setLoadBalance(LoadBalanceEnum.HASH.getName()); - handle.setTimeout(200L); - - assertThat(handle.getTimeout(), is(200L)); - assertThat(handle.getRetries(), is(10)); - assertThat(handle.getLoadBalance(), is(LoadBalanceEnum.HASH.getName())); - } - - @Test - public void testEqualsAndHashCode() { - SofaRuleHandle handle1 = new SofaRuleHandle(); - SofaRuleHandle handle2 = new SofaRuleHandle(); - - assertThat(ImmutableSet.of(handle1, handle2), hasSize(1)); - } - -} 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..4f6b56ce0a24 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 @@ -89,7 +89,6 @@ public void testGetCode() { "websocket, 200", "modifyResponse, 220", "dubbo, 310", - "sofa, 310", "tars, 310", "grpc, 310", "motan, 310", 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..94822711b01b 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 @@ -35,7 +35,6 @@ public void testGetName() { 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()); assertEquals("websocket", RpcTypeEnum.WEB_SOCKET.getName()); @@ -47,7 +46,6 @@ public void testSupport() { 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()); } @@ -83,7 +81,6 @@ public void testAcquireSupportMetadatas() { List rpcTypeEnumList = RpcTypeEnum.acquireSupportMetadatas(); assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.DUBBO)); assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.GRPC)); - assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.SOFA)); assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.TARS)); } @@ -91,4 +88,5 @@ public void testAcquireSupportMetadatas() { public void testGetRpcTypeEnumByNameInvalid() { assertThrows(ShenyuException.class, () -> RpcTypeEnum.acquireByName("InvalidName")); } + } diff --git a/shenyu-dist/shenyu-admin-dist/src/main/release-docs/LICENSE b/shenyu-dist/shenyu-admin-dist/src/main/release-docs/LICENSE index 105113ffd215..e122ccca2373 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/release-docs/LICENSE +++ b/shenyu-dist/shenyu-admin-dist/src/main/release-docs/LICENSE @@ -255,7 +255,7 @@ The text of each license is the standard Apache 2.0 license. gson 2.9.0: https://github.com/google/gson, Apache 2.0 gson-fire 1.8.5: https://mvnrepository.com/artifact/io.gsonfire/gson-fire, Apache 2.0 guava 31.1-jre: https://github.com/google/guava, Apache 2.0 - hessian 4.0.38: http://github.com/alipay/sofa-hessian, Apache 2.0 + hessian 4.0.38: https://mvnrepository.com/artifact/com.caucho/hessian, Apache 2.0 hibernate-validator 8.0.1.Final: https://github.com/hibernate/hibernate-validator, Apache 2.0 HikariCP 5.1.0: https://github.com/brettwooldridge/HikariCP, Apache 2.0 httpasyncclient 4.1.5: https://github.com/apache/httpasyncclient/tree/4.1.2, Apache 2.0 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..ff4006b51d1b 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, Motan, 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..ded892def33a 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE @@ -232,7 +232,6 @@ The text of each license is the standard Apache 2.0 license. bouncy-castle-bc 3.2.3-pkg: https://mvnrepository.com/artifact/org.apache.pulsar/bouncy-castle-bc, Apache 2.0 audience-annotations 0.12.0: https://yetus.apache.org/audience-annotations, Apache 2.0 auto-value-annotations 1.9: https://github.com/google/auto/tree/master/value, Apache 2.0 - bolt 1.6.10: https://github.com/alipay/sofa-bolt, Apache 2.0 btf 1.2: https://github.com/fge/btf, LGPL and Apache 2.0 byte-buddy 1.12.6: https://bytebuddy.net/byte-buddy, Apache 2.0 byte-buddy-agent 1.11.22: https://bytebuddy.net/byte-buddy, Apache 2.0 @@ -302,9 +301,7 @@ The text of each license is the standard Apache 2.0 license. gson 2.9.0: https://github.com/google/gson, Apache 2.0 guava 31.1-jre: https://github.com/google/guava, Apache 2.0 guava 32.0.0-jre: https://github.com/google/guava, Apache 2.0 - hessian 3.3.7: http://github.com/alipay/sofa-hessian, Apache 2.0 - hessian 3.5.3: http://github.com/alipay/sofa-hessian, Apache 2.0 - hessian 4.0.38: http://github.com/alipay/sofa-hessian, Apache 2.0 + hessian 4.0.38: https://mvnrepository.com/artifact/com.caucho/hessian, Apache 2.0 httpasyncclient 4.1.5: https://github.com/apache/httpcomponents-client , Apache 2.0 hibernate-validator 6.0.18.Final: https://github.com/hibernate/hibernate-validator, Apache 2.0 httpclient 4.5.13: http://hc.apache.org/httpcomponents-client, Apache 2.0 @@ -362,7 +359,6 @@ The text of each license is the standard Apache 2.0 license. log4j-api 2.23.1: https://logging.apache.org/log4j/2.x/log4j-api, Apache 2.0 log4j 1.2-api-2.23.1: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api, Apache 2.0 log4j-to-slf4j 2.23.1: https://logging.apache.org/log4j/2.x/log4j-to-slf4j, Apache 2.0 - lookout-api 1.4.1: https://github.com/sofastack/sofa-lookout/lookout-api, Apache 2.0 lz4 1.3.0: https://github.com/jpountz/lz4-java, Apache 2.0 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 @@ -472,8 +468,6 @@ The text of each license is the standard Apache 2.0 license. simpleclient 0.15.0: https://github.com/prometheus/client_java, Apache 2.0 snakeyaml 2.2: http://www.snakeyaml.org, Apache 2.0 snappy-java 1.1.10.5: https://github.com/xerial/snappy-java, Apache 2.0 - sofa-common-tools 2.1.1: https://github.com/sofastack/sofa-common-tools/sofa-common-tools, Apache 2.0 - sofa-rpc-all 5.13.0: http://github.com/sofastack/sofa-rpc, Apache 2.0 jsonschema-generator 4.37.0: https://github.com/victools/jsonschema-generator, Apache 2.0 spring-ai-template-st 1.0.0: https://github.com/spring-projects/spring-ai, Apache 2.0 spring-ai-deepseek 1.0.0: https://github.com/spring-projects/spring-ai, Apache 2.0 @@ -537,7 +531,7 @@ The text of each license is the standard Apache 2.0 license. swagger-annotations 2.2.25: https://github.com/swagger-api/swagger-core/modules/swagger-annotations, Apache 2.0 swagger-core 1.6.9: https://github.com/swagger-api/swagger-core/modules/swagger-core, Apache 2.0 swagger-models 1.6.9: https://github.com/swagger-api/swagger-core/modules/swagger-models, Apache 2.0 - tracer-core 3.0.8: https://projects.spring.io/spring-boot/#/spring-boot-starter-parent/sofaboot-dependencies/tracer-all-parent/tracer-core, Apache 2.0 + tracer-core 3.0.8: https://spring.io/projects/spring-boot, Apache 2.0 transmittable-thread-local 2.12.1: https://mvnrepository.com/artifact/com.alibaba/transmittable-thread-local, Apache 2.0 spring-context-support 1.0.11: https://mvnrepository.com/artifact/com.alibaba.spring/spring-context-support/1.0.11, Apache 2.0 validation-api 2.0.1.Final: http://beanvalidation.org/licensing, 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..ff4006b51d1b 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, Motan, 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..882f6ce3d5ee 100644 --- a/shenyu-e2e/shenyu-e2e-case/pom.xml +++ b/shenyu-e2e/shenyu-e2e-case/pom.xml @@ -36,7 +36,6 @@ shenyu-e2e-case-logging-rocketmq 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-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java index f2278eb84b0d..04a55623349e 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java @@ -64,7 +64,7 @@ private ShenYuScenarioSpec testGrpc() { .name("test grpc invoker") .beforeEachSpec( ShenYuBeforeEachSpec.builder() - .checker(notExists("/sofa/findAll")) + .checker(notExists("/motan/demo/hello")) .checker(exists(Method.POST, "/grpc/echo", body)) .build() ) @@ -103,7 +103,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL, "/grpc/echo")) .build() ) - .checker(notExists("/sofa/findAll")) + .checker(notExists("/motan/demo/hello")) .waiting(exists(Method.POST, "/grpc/echo", body)) .build() ) @@ -114,7 +114,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/put") .addNotExists("/get") .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hello")).build()) .build(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/compose/script/e2e-sofa-sync-compose.sh b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/compose/script/e2e-sofa-sync-compose.sh deleted file mode 100644 index adc3ef0ed87d..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/compose/script/e2e-sofa-sync-compose.sh +++ /dev/null @@ -1,65 +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. -# - -# init kubernetes for mysql -SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")") -bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_mysql.sh - -# init register center -CUR_PATH=$(readlink -f "$(dirname "$0")") -PRGDIR=$(dirname "$CUR_PATH") -# init shenyu sync -SYNC_ARRAY=("websocket" "zookeeper") -#SYNC_ARRAY=("websocket" "nacos") -#MIDDLEWARE_SYNC_ARRAY=("zookeeper" "etcd" "nacos") - -docker network create -d bridge shenyu - -for sync in "${SYNC_ARRAY[@]}"; do - echo -e "------------------\n" - echo "[Start ${sync} synchronous] create shenyu-admin-${sync}.yml shenyu-bootstrap-${sync}.yml " - docker compose -f "$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml up -d --quiet-pull - sleep 30s - sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh http://localhost:31095/actuator/health - sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh http://localhost:31195/actuator/health - docker compose -f "${PRGDIR}"/shenyu-examples-sofa-compose.yml up -d --quiet-pull - sleep 30s - sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh http://localhost:30811/actuator/health - sleep 10s - docker ps -a - ## run e2e-test - ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-sofa -am test - # shellcheck disable=SC2181 - if (($?)); then - echo "${sync}-sync-e2e-test failed" - echo "------------------" - echo "shenyu-admin log:" - echo "------------------" - docker compose -f "$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml logs shenyu-admin - echo "shenyu-bootstrap log:" - echo "------------------" - docker compose -f "$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml logs shenyu-bootstrap - echo "shenyu-examples-sofa log:" - echo "------------------" - docker compose -f "${PRGDIR}"/shenyu-examples-sofa-compose.yml logs shenyu-examples-sofa - exit 1 - fi - docker compose -f "$SHENYU_TESTCASE_DIR"/compose/sync/shenyu-sync-"${sync}".yml down - docker compose -f "${PRGDIR}"/shenyu-examples-sofa-compose.yml down - echo "[Remove ${sync} synchronous] delete shenyu-admin-${sync}.yml shenyu-bootstrap-${sync}.yml " -done diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/compose/shenyu-examples-sofa-compose.yml b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/compose/shenyu-examples-sofa-compose.yml deleted file mode 100644 index 7f70315ed13f..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/compose/shenyu-examples-sofa-compose.yml +++ /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. - -version: '3.8' - -services: - shenyu-zookeeper: - image: zookeeper:3.9 - container_name: shenyu-zookeeper - ports: - - "2181:2181" # Client - - "2888:2888" # Server - - "3888:3888" # Leader election - - "8080:8080" # Website - healthcheck: - test: [ "CMD-SHELL", "echo srvr | nc localhost 2181" ] - interval: 10s - timeout: 5s - retries: 10 - start_period: 30s - restart: always - networks: - - shenyu - shenyu-examples-sofa: - image: shenyu-examples-sofa:latest - container_name: shenyu-examples-sofa - environment: - - shenyu.register.serverLists=http://shenyu-admin:9095 - - sofa.boot.rpc.registry.address=zookeeper://shenyu-zookeeper:2181 - ports: - - "30811:8011" - - "20888:20888" - restart: always - depends_on: - shenyu-zookeeper: - condition: service_healthy - networks: - - shenyu - -networks: - shenyu: - name: shenyu - driver: bridge - external: true diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/k8s/script/e2e-sofa-sync.sh b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/k8s/script/e2e-sofa-sync.sh deleted file mode 100644 index 9dd3ff2f650d..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/k8s/script/e2e-sofa-sync.sh +++ /dev/null @@ -1,82 +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. -# - -docker save shenyu-examples-sofa:latest | sudo k3s ctr images import - - -# init kubernetes for mysql -SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")") -bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_mysql.sh - -# init register center -CUR_PATH=$(readlink -f "$(dirname "$0")") -PRGDIR=$(dirname "$CUR_PATH") -kubectl apply -f "${SHENYU_TESTCASE_DIR}"/k8s/sync/shenyu-cm.yml - -# init shenyu sync -SYNC_ARRAY=("websocket" "http" "zookeeper") -#SYNC_ARRAY=("websocket" "nacos") -MIDDLEWARE_SYNC_ARRAY=("zookeeper" "nacos") -for sync in ${SYNC_ARRAY[@]}; do - echo -e "------------------\n" - kubectl apply -f "$SHENYU_TESTCASE_DIR"/k8s/shenyu-mysql.yml - kubectl apply -f "${SHENYU_TESTCASE_DIR}"/k8s/shenyu-zookeeper.yml - sleep 30s - echo "[Start ${sync} synchronous] create shenyu-admin-${sync}.yml shenyu-bootstrap-${sync}.yml shenyu-examples-springcloud.yml" - # shellcheck disable=SC2199 - # shellcheck disable=SC2076 - # shellcheck disable=SC2154 - if [[ "${MIDDLEWARE_SYNC_ARRAY[@]}" =~ "${sync}" ]]; then - kubectl apply -f "${SHENYU_TESTCASE_DIR}"/k8s/shenyu-"${sync}".yml - sleep 10s - fi - kubectl apply -f "${SHENYU_TESTCASE_DIR}"/k8s/sync/shenyu-admin-"${sync}".yml - sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh http://localhost:31095/actuator/health - kubectl apply -f "${PRGDIR}"/shenyu-examples-sofa.yml - sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh http://localhost:30811/actuator/health - kubectl apply -f "${SHENYU_TESTCASE_DIR}"/k8s/sync/shenyu-bootstrap-"${sync}".yml - sh "$SHENYU_TESTCASE_DIR"/k8s/script/healthcheck.sh http://localhost:31195/actuator/health - sleep 10s - kubectl get pod -o wide - - ## run e2e-test - ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-sofa -am test - # shellcheck disable=SC2181 - if (($?)); then - echo "${sync}-sync-e2e-test failed" - echo "shenyu-admin log:" - echo "------------------" - kubectl logs "$(kubectl get pod -o wide | grep shenyu-admin | awk '{print $1}')" - echo "shenyu-bootstrap log:" - echo "------------------" - kubectl logs "$(kubectl get pod -o wide | grep shenyu-bootstrap | awk '{print $1}')" - echo "shenyu-examples-sofa log:" - echo "------------------" - kubectl logs "$(kubectl get pod -o wide | grep shenyu-examples-sofa | awk '{print $1}')" - exit 1 - fi - kubectl delete -f "${SHENYU_TESTCASE_DIR}"/k8s/shenyu-mysql.yml - kubectl delete -f "${SHENYU_TESTCASE_DIR}"/k8s/sync/shenyu-admin-"${sync}".yml - kubectl delete -f "${SHENYU_TESTCASE_DIR}"/k8s/sync/shenyu-bootstrap-"${sync}".yml - kubectl delete -f "${PRGDIR}"/shenyu-examples-sofa.yml - # shellcheck disable=SC2199 - # shellcheck disable=SC2076 - if [[ "${MIDDLEWARE_SYNC_ARRAY[@]}" =~ "${sync}" ]]; then - kubectl delete -f "${SHENYU_TESTCASE_DIR}"/k8s/shenyu-"${sync}".yml - fi - echo "[Remove ${sync} synchronous] delete shenyu-admin-${sync}.yml shenyu-bootstrap-${sync}.yml shenyu-examples-springcloud.yml" -done diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/k8s/shenyu-examples-sofa.yml b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/k8s/shenyu-examples-sofa.yml deleted file mode 100644 index 43219af59851..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/k8s/shenyu-examples-sofa.yml +++ /dev/null @@ -1,66 +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-sofa - labels: - app: shenyu-examples-sofa -spec: - replicas: 1 - selector: - matchLabels: - app: shenyu-examples-sofa - strategy: {} - template: - metadata: - labels: - app: shenyu-examples-sofa - spec: - containers: - - image: shenyu-examples-sofa:latest - name: shenyu-examples-sofa - env: - - name: shenyu.register.serverLists - value: http://shenyu-admin:9095 - - name: sofa.boot.rpc.registry.address - value: zookeeper://shenyu-zookeeper:2181 - ports: - - containerPort: 8011 - - containerPort: 20888 - imagePullPolicy: IfNotPresent - restartPolicy: Always -status: {} - ---- -apiVersion: v1 -kind: Service -metadata: - name: shenyu-examples-sofa - labels: - app: shenyu-examples-sofa -spec: - selector: - app: shenyu-examples-sofa - type: NodePort - ports: - - name: "28011" - port: 28011 - targetPort: 28011 - nodePort: 30811 -status: - loadBalancer: {} diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/pom.xml b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/pom.xml deleted file mode 100644 index 3f40ace47e60..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - shenyu-e2e-case - org.apache.shenyu - 0.0.1-SNAPSHOT - - 4.0.0 - - shenyu-e2e-case-sofa - diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynTest.java deleted file mode 100644 index 654204f63541..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/DataSynTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.e2e.testcase.sofa; - -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.ShenYuTest; -import org.apache.shenyu.e2e.enums.ServiceTypeEnum; -import org.junit.jupiter.api.Test; - -/** - * Testing the correctness of Http data synchronization method. - */ -@ShenYuTest(environments = { - @ShenYuTest.Environment( - serviceName = "shenyu-e2e-admin", - service = @ShenYuTest.ServiceConfigure(moduleName = "shenyu-e2e", - baseUrl = "http://localhost:31095", - type = ServiceTypeEnum.SHENYU_ADMIN, - parameters = { - @ShenYuTest.Parameter(key = "username", value = "admin"), - @ShenYuTest.Parameter(key = "password", value = "123456") - } - ) - ), - @ShenYuTest.Environment( - serviceName = "shenyu-e2e-gateway", - service = @ShenYuTest.ServiceConfigure(moduleName = "shenyu-e2e", - baseUrl = "http://localhost:31195", - type = ServiceTypeEnum.SHENYU_GATEWAY - ) - ) -}) -public class DataSynTest { - - @Test - void testDataSyn(final AdminClient adminClient, final GatewayClient gatewayClient) throws Exception { - adminClient.login(); - WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllSelectors, gatewayClient::getSelectorCache, adminClient); - WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllMetaData, gatewayClient::getMetaDataCache, adminClient); - WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllRules, gatewayClient::getRuleCache, adminClient); - } -} diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java deleted file mode 100644 index ffccae42c66d..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java +++ /dev/null @@ -1,363 +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.sofa; - -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 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 SofaPluginCases implements ShenYuScenarioProvider { - - @Override - public List get() { - return Lists.newArrayList( - testSofaFindAll() - //testWithUriEquals(), - //testWithUriPathPattern(), - //testWithUriStartWith(), - //testWithEndWith(), - //testWithMethodGet(), - //testWithMethodPost(), - //testWithMethodPut(), - //testWithMethodDelete() - ); - } - - private ShenYuScenarioSpec testSofaFindAll() { - return ShenYuScenarioSpec.builder() - .name("sofa test") - .beforeEachSpec(ShenYuBeforeEachSpec.builder() - .checker(exists("/sofa/findAll")) - .build()) - .caseSpec(ShenYuCaseSpec.builder() - .addExists("/sofa/findAll") - .addNotExists("/sofa/findAll/123") - .build()) - .build(); - } - - /** - * test with uri equal. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithUriEquals() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri =]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll")) - .build() - ) - .checker(notExists("/sofa/findAll")) - .waiting(exists("/sofa/findAll")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists("/sofa/findAll") - .addNotExists("/sofa/fin") - .addNotExists("/put") - .addNotExists("/get") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) - .build(); - } - - /** - * test with uri path pattern. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithUriPathPattern() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri path_pattern]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.PATH_PATTERN, "/sofa/**")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.PATH_PATTERN, "/sofa/**")) - .build() - ) - .checker(notExists("/sofa/findAll")) - .waiting(exists("/sofa/findAll")) - .build() - ).caseSpec( - ShenYuCaseSpec.builder() - .addExists("/sofa/findAll") - .addNotExists("/sof") - .addExists(Method.POST, "/sofa/findAll") - .addExists(Method.PUT, "/sofa/findAll") - .addExists(Method.DELETE, "/sofa/findAll") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) - .build(); - } - - /** - * test with uri start with. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithUriStartWith() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri starts_with]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.STARTS_WITH, "/sofa/")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.STARTS_WITH, "/sofa/")) - .build() - ) - .checker(notExists("/sofa/findAll")) - .waiting(exists("/sofa/findAll")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists("/sofa/findAll") - .addNotExists("/sofa/de") - .addExists(Method.POST, "/sofa/findAll") - .addExists(Method.PUT, "/sofa/findAll") - .addExists(Method.DELETE, "/sofa/findAll") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) - .build(); - } - - /** - * test with uri end with. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithEndWith() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri ends_with]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.ENDS_WITH, "/findAll")) - .build(), - newRuleBuilder("rule") - .conditionList(newConditions(Condition.ParamType.URI, Condition.Operator.ENDS_WITH, "/findAll")) - .build() - ) - .checker(notExists("/sofa/findAll")) - .waiting(exists("/sofa/findAll")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists("/sofa/findAll") - .addNotExists("/sofa/find") - .addExists(Method.POST, "/sofa/findAll") - .addExists(Method.PUT, "/sofa/findAll") - .addExists(Method.DELETE, "/sofa/findAll") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) - .build(); - } - - /** - * test with uri method get. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodGet() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri method GET]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "GET"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "GET"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build() - ) - .checker(notExists(Method.GET, "/sofa/findAll")) - .waiting(exists(Method.GET, "/sofa/findAll")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.GET, "/sofa/findAll") - .addNotExists(Method.GET, "/sofa/find") - .addNotExists(Method.POST, "/sofa/findAll") - .addNotExists(Method.PUT, "/sofa/findAll") - .addNotExists(Method.DELETE, "/sofa/findAll") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/sofa/findAll")).build()) - .build(); - } - - /** - * test with uri method post. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodPost() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri method POST]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "POST"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "POST"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build() - ) - .checker(notExists(Method.POST, "/sofa/findAll")) - .waiting(exists(Method.POST, "/sofa/findAll")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.POST, "/sofa/findAll") - .addNotExists(Method.POST, "/sofa/find") - .addNotExists(Method.GET, "/sofa/findAll") - .addNotExists(Method.PUT, "/sofa/findAll") - .addNotExists(Method.DELETE, "/sofa/findAll") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/sofa/findAll")).build()) - .build(); - } - - /** - * test with uri method put. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodPut() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri method PUT]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "PUT"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "PUT"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build() - ) - .checker(notExists(Method.PUT, "/sofa/findAll")) - .waiting(exists(Method.PUT, "/sofa/findAll")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.PUT, "/sofa/findAll") - .addNotExists(Method.PUT, "/sofa/find") - .addNotExists(Method.GET, "/sofa/findAll") - .addNotExists(Method.POST, "/sofa/findAll") - .addNotExists(Method.DELETE, "/sofa/findAll") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/sofa/findAll")).build()) - .build(); - } - - /** - * test with uri method delete. - * - * @return ShenYuScenarioSpec - */ - public ShenYuScenarioSpec testWithMethodDelete() { - return ShenYuScenarioSpec.builder() - .name("single-sofa uri method DELETE]") - .beforeEachSpec( - ShenYuBeforeEachSpec.builder() - .addSelectorAndRule( - newSelectorBuilder("selector", Plugin.SOFA) - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "DELETE"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build(), - newRuleBuilder("rule") - .conditionList(Lists.newArrayList( - newCondition(Condition.ParamType.METHOD, Condition.Operator.EQUAL, "DELETE"), - newCondition(Condition.ParamType.URI, Condition.Operator.EQUAL, "/sofa/findAll") - )) - .build() - ) - .checker(notExists(Method.DELETE, "/sofa/findAll")) - .waiting(exists(Method.DELETE, "/sofa/findAll")) - .build() - ) - .caseSpec( - ShenYuCaseSpec.builder() - .addExists(Method.DELETE, "/sofa/findAll") - .addNotExists(Method.DELETE, "/sofa/find") - .addNotExists(Method.GET, "/sofa/findAll") - .addNotExists(Method.POST, "/sofa/findAll") - .addNotExists(Method.PUT, "/sofa/findAll") - .build()) - .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/sofa/findAll")).build()) - .build(); - } -} diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginTest.java deleted file mode 100644 index cd92542fa128..000000000000 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginTest.java +++ /dev/null @@ -1,82 +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.sofa; - -import com.google.common.collect.Lists; -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.constant.Constants; -import org.apache.shenyu.e2e.engine.annotation.ShenYuScenario; -import org.apache.shenyu.e2e.engine.annotation.ShenYuTest; -import org.apache.shenyu.e2e.engine.scenario.specification.CaseSpec; -import org.apache.shenyu.e2e.enums.ServiceTypeEnum; -import org.junit.jupiter.api.BeforeAll; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@ShenYuTest(environments = { - @ShenYuTest.Environment( - serviceName = "shenyu-e2e-admin", - service = @ShenYuTest.ServiceConfigure(moduleName = "shenyu-e2e", - baseUrl = "http://localhost:31095", - type = ServiceTypeEnum.SHENYU_ADMIN, - parameters = { - @ShenYuTest.Parameter(key = "username", value = "admin"), - @ShenYuTest.Parameter(key = "password", value = "123456") - } - ) - ), - @ShenYuTest.Environment( - serviceName = "shenyu-e2e-gateway", - service = @ShenYuTest.ServiceConfigure(moduleName = "shenyu-e2e", - baseUrl = "http://localhost:31195", - type = ServiceTypeEnum.SHENYU_GATEWAY - ) - ) -}) -public class SofaPluginTest { - private List selectorIds = Lists.newArrayList(); - - @BeforeAll - static void setup(final AdminClient adminClient, final GatewayClient gatewayClient) throws Exception { - adminClient.login(); - WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllSelectors, gatewayClient::getSelectorCache, adminClient); - WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllMetaData, gatewayClient::getMetaDataCache, adminClient); - WaitDataSync.waitAdmin2GatewayDataSyncEquals(adminClient::listAllRules, gatewayClient::getRuleCache, adminClient); - - Map reqBody = new HashMap<>(); - reqBody.put("pluginId", "11"); - reqBody.put("name", "sofa"); - reqBody.put("enabled", "true"); - reqBody.put("role", "Proxy"); - reqBody.put("sort", "310"); - reqBody.put("config", "{\"protocol\":\"zookeeper\",\"register\":\"shenyu-zookeeper:2181\"}"); - reqBody.put("namespaceId", Constants.SYS_DEFAULT_NAMESPACE_NAMESPACE_ID); - adminClient.changePluginStatus("1801816010882822147", reqBody); - WaitDataSync.waitGatewayPluginUse(gatewayClient, "org.apache.shenyu.plugin.sofa.SofaPlugin"); - } - - @ShenYuScenario(provider = SofaPluginCases.class) - void testSofa(final GatewayClient gateway, final CaseSpec spec) { - //spec.getVerifiers().forEach(verifier -> verifier.verify(gateway.getHttpRequesterSupplier().get())); - } -} - 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..951d53102574 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 @@ -44,7 +44,6 @@ public enum Plugin { SPRING_CLOUD("springCloud", 8), HYSTRIX("hystrix", 9), SENTINEL("sentinel", 10), - SOFA("sofa", 11), RESILIENCE4J("resilience4j", 12), TARS("tars", 13), CONTEXT_PATH("contextPath", 14), diff --git a/shenyu-examples/pom.xml b/shenyu-examples/pom.xml index 1718fadd4d61..3b61d0e53811 100644 --- a/shenyu-examples/pom.xml +++ b/shenyu-examples/pom.xml @@ -49,7 +49,6 @@ shenyu-examples-dubbo shenyu-examples-springcloud shenyu-examples-eureka - shenyu-examples-sofa shenyu-examples-tars shenyu-examples-grpc shenyu-examples-motan diff --git a/shenyu-examples/shenyu-examples-sofa/README.md b/shenyu-examples/shenyu-examples-sofa/README.md deleted file mode 100644 index 9342cf4e7e2b..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Shenyu example Sofa -*** -## Run -You can run server with http/zookeeper/etcd register center - -### run with etcd register center -#### Shenyu-Admin config -add etcd register center dependency in shenyu-admin: - -```xml - - org.apache.shenyu - shenyu-register-server-etcd - ${project.version} - -``` - -set etcd register config in shenyu-admin: - -```yaml -shenyu: - register: - registerType: etcd - serverLists : http://localhost:2379 -``` - -#### shenyu-examples-sofa-service config -set etcd register config: - -```yaml -shenyu: - client: - registerType: etcd #http #zookeeper #etcd - serverLists: http://localhost:2379 #http://localhost:9095 #localhost:2181 #http://localhost:2379 - props: - contextPath: /sofa - appName: sofa - port: 8888 -``` - -run TestSofaApplication diff --git a/shenyu-examples/shenyu-examples-sofa/pom.xml b/shenyu-examples/shenyu-examples-sofa/pom.xml deleted file mode 100644 index aff6ec8d5181..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-examples - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-examples-sofa - pom - - - shenyu-examples-sofa-api - shenyu-examples-sofa-service - - - - - - org.apache.shenyu - shenyu-examples-sofa-api - ${project.version} - - - - diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/pom.xml b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/pom.xml deleted file mode 100644 index 8562cd1f6984..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-examples-sofa - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-examples-sofa-api - - - shenyu-examples-sofa-api - - diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/entity/SofaComplexTypeBean.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/entity/SofaComplexTypeBean.java deleted file mode 100644 index 3d986a9492e3..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/entity/SofaComplexTypeBean.java +++ /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. - */ - -package org.apache.shenyu.examples.sofa.api.entity; - -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; - -/** - * Sofa complex type bean. - */ -public class SofaComplexTypeBean { - - private SofaSimpleTypeBean sofaSimpleTypeBean; - - private List idLists; - - private Map idMaps; - - public SofaComplexTypeBean() { - } - - public SofaComplexTypeBean(final SofaSimpleTypeBean sofaSimpleTypeBean, final List idLists, final Map idMaps) { - this.sofaSimpleTypeBean = sofaSimpleTypeBean; - this.idLists = idLists; - this.idMaps = idMaps; - } - - /** - * Get sofaSimpleTypeBean. - * - * @return sofaSimpleTypeBean - */ - public SofaSimpleTypeBean getSofaSimpleTypeBean() { - return sofaSimpleTypeBean; - } - - /** - * Set sofaSimpleTypeBean. - * - * @param sofaSimpleTypeBean sofaSimpleTypeBean - */ - public void setSofaSimpleTypeBean(final SofaSimpleTypeBean sofaSimpleTypeBean) { - this.sofaSimpleTypeBean = sofaSimpleTypeBean; - } - - /** - * Get idLists. - * - * @return idLists - */ - public List getIdLists() { - return idLists; - } - - /** - * Set idLists. - * - * @param idLists idLists - */ - public void setIdLists(final List idLists) { - this.idLists = idLists; - } - - /** - * Get idMaps. - * - * @return idMaps - */ - public Map getIdMaps() { - return idMaps; - } - - /** - * Set idMaps. - * - * @param idMaps idMaps - */ - public void setIdMaps(final Map idMaps) { - this.idMaps = idMaps; - } - - @Override - public String toString() { - return new StringJoiner(", ", SofaComplexTypeBean.class.getSimpleName() + "[", "]") - .add("sofaSimpleTypeBean=" + sofaSimpleTypeBean) - .add("idLists=" + idLists) - .add("idMaps=" + idMaps) - .toString(); - } - -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/entity/SofaSimpleTypeBean.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/entity/SofaSimpleTypeBean.java deleted file mode 100644 index 45b275159e31..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/entity/SofaSimpleTypeBean.java +++ /dev/null @@ -1,83 +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.sofa.api.entity; - -import java.io.Serializable; - -/** - * Sofa simple type Bean. - */ -public class SofaSimpleTypeBean implements Serializable { - - private String id; - - private String name; - - public SofaSimpleTypeBean() { - } - - public SofaSimpleTypeBean(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 "SofaSimpleTypeBean{" - + "id='" + id + '\'' - + ", name='" + name + '\'' - + '}'; - } - -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaClientMultiParamService.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaClientMultiParamService.java deleted file mode 100644 index 0f363b7fb465..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaClientMultiParamService.java +++ /dev/null @@ -1,122 +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.sofa.api.service; - -import org.apache.shenyu.examples.sofa.api.entity.SofaComplexTypeBean; -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; - -import java.util.List; -import java.util.Map; - -/** - * Sofa multi parameter service. - */ -public interface SofaClientMultiParamService { - - /** - * Find by ids and name. - * body: {"ids":["1232","456"],"name":"hello world"} - * - * @param ids the ids - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByIdsAndName(List ids, String name); - - /** - * Find by array ids and name. - * body :{"ids":[123,4561],"name":"hello world"} - * - * @param ids the ids - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByArrayIdsAndName(Integer[] ids, String name); - - /** - * Find by string array. - * body :{"ids":["1232","456"]} - * - * @param ids the ids - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByStringArray(String[] ids); - - /** - * Find by list id. - * body :{"ids":["1232","456"]} - * - * @param ids the ids - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByListId(List ids); - - /** - * Batch save SofaSimpleTypeBean. - * body :{"sofaTestList":[{"id":"123","name":"xiaoyu"},{"id":"456","name":"myth"}]} - * - * @param sofaTestList the sofa test list - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean batchSave(List sofaTestList); - - /** - * Batch save name and id. - * body: {"sofaTestList":[{"id":"123","name":"xiaoyu"},{"id":"456","name":"myth"}],"id":"789","name":"ttt"} - * - * @param sofaTestList the sofa test list. - * @param id the id - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean batchSaveNameAndId(List sofaTestList, String id, String name); - - - /** - * Save sofa complex type bean. - * body : {"sofaSimpleTypeBean":{"id":"123","name":"xiaoyu"},"idLists":["456","789"],"idMaps":{"id2":"2","id1":"1"}} - * - * @param sofaComplexTypeBean the sofa complex type bean. - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean saveComplexBean(SofaComplexTypeBean sofaComplexTypeBean); - - - /** - * Save complex bean test and name dubbo test. - * body : {"sofaComplexTypeBean":{"sofaSimpleTypeBean":{"id":"123","name":"xiaoyu"},"idLists":["456","789"],"idMaps":{"id2":"2","id1":"1"}},"name":"xiaoyu"} - * - * @param sofaComplexTypeBean the sofa complex type bean. - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean saveComplexBeanAndName(SofaComplexTypeBean sofaComplexTypeBean, String name); - - /** - * Save complex bean test and name dubbo test. - * body : {"sofaComplexTypeBean":[{"sofaSimpleTypeBean":{"id":"123","name":"xiaoyu"},"idLists":["456","789"],"idMaps":{"id2":"2","id1":"1"}}], - * "sofaSimpleTypeBeanList":[{"id":"123","name":"xiaoyu"}]} - * - * @param sofaComplexTypeBeanList the sofa complex type bean. - * @param sofaSimpleTypeBeanMap the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean saveTwoList(List sofaComplexTypeBeanList, - Map sofaSimpleTypeBeanMap); - -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaClientSingleParamService.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaClientSingleParamService.java deleted file mode 100644 index c363bdffa028..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaClientSingleParamService.java +++ /dev/null @@ -1,51 +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.sofa.api.service; - -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; - -/** - * Sofa single parameter service. - */ -public interface SofaClientSingleParamService { - - /** - * find by id. - * body:{"id":"1223"} - * - * @param id id - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findById(String id); - - /** - * Find all dubbo test. - * - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findAll(); - - /** - * Insert dubbo test. - * body :{"id":"122344","name":"xiaoyu"} - * - * @param sofaSimpleTypeBean the simple type parameters. - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean insert(SofaSimpleTypeBean sofaSimpleTypeBean); -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaMultiParamService.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaMultiParamService.java deleted file mode 100644 index dbd899b42db9..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaMultiParamService.java +++ /dev/null @@ -1,121 +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.sofa.api.service; - -import org.apache.shenyu.examples.sofa.api.entity.SofaComplexTypeBean; -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; - -import java.util.List; -import java.util.Map; - -/** - * Sofa multi parameter service. - */ -public interface SofaMultiParamService { - - /** - * Find by ids and name. - * body: {"ids":["1232","456"],"name":"hello world"} - * - * @param ids the ids - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByIdsAndName(List ids, String name); - - /** - * Find by array ids and name. - * body :{"ids":[123,4561],"name":"hello world"} - * - * @param ids the ids - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByArrayIdsAndName(Integer[] ids, String name); - - /** - * Find by string array. - * body :{"ids":["1232","456"]} - * - * @param ids the ids - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByStringArray(String[] ids); - - /** - * Find by list id. - * body :{"ids":["1232","456"]} - * - * @param ids the ids - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findByListId(List ids); - - /** - * Batch save SofaSimpleTypeBean. - * body :{"sofaTestList":[{"id":"123","name":"xiaoyu"},{"id":"456","name":"myth"}]} - * - * @param sofaTestList the sofa test list - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean batchSave(List sofaTestList); - - /** - * Batch save name and id. - * body: {"sofaTestList":[{"id":"123","name":"xiaoyu"},{"id":"456","name":"myth"}],"id":"789","name":"ttt"} - * - * @param sofaTestList the sofa test list. - * @param id the id - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean batchSaveNameAndId(List sofaTestList, String id, String name); - - - /** - * Save sofa complex type bean. - * body : {"sofaSimpleTypeBean":{"id":"123","name":"xiaoyu"},"idLists":["456","789"],"idMaps":{"id2":"2","id1":"1"}} - * - * @param sofaComplexTypeBean the sofa complex type bean. - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean saveComplexBean(SofaComplexTypeBean sofaComplexTypeBean); - - - /** - * Save complex bean test and name dubbo test. - * body : {"sofaComplexTypeBean":{"sofaSimpleTypeBean":{"id":"123","name":"xiaoyu"},"idLists":["456","789"],"idMaps":{"id2":"2","id1":"1"}},"name":"xiaoyu"} - * - * @param sofaComplexTypeBean the sofa complex type bean. - * @param name the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean saveComplexBeanAndName(SofaComplexTypeBean sofaComplexTypeBean, String name); - - /** - * Save complex bean test and name dubbo test. - * body : {"sofaComplexTypeBean":[{"sofaSimpleTypeBean":{"id":"123","name":"xiaoyu"},"idLists":["456","789"],"idMaps":{"id2":"2","id1":"1"}}], - * "sofaSimpleTypeBeanList":[{"id":"123","name":"xiaoyu"}]} - * - * @param sofaComplexTypeBeanList the sofa complex type bean. - * @param sofaSimpleTypeBeanMap the name - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean saveTwoList(List sofaComplexTypeBeanList, Map sofaSimpleTypeBeanMap); - -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaSingleParamService.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaSingleParamService.java deleted file mode 100644 index c8ffeceec057..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-api/src/main/java/org/apache/shenyu/examples/sofa/api/service/SofaSingleParamService.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.examples.sofa.api.service; - -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; - -/** - * Sofa single parameter service. - */ -public interface SofaSingleParamService { - - /** - * find by id. - * body:{"id":"1223"} - * - * @param id id - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findById(String id); - - /** - * Find all dubbo test. - * - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean findAll(); - - /** - * Insert dubbo test. - * body :{"id":"122344","name":"xiaoyu"} - * - * @param sofaSimpleTypeBean the simple type parameters. - * @return SofaSimpleTypeBean - */ - SofaSimpleTypeBean insert(SofaSimpleTypeBean sofaSimpleTypeBean); - -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/Dockerfile b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/Dockerfile deleted file mode 100644 index e37d49de6122..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-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-sofa -ENV LOCAL_PATH /opt/${APP_NAME} - -RUN mkdir -p ${LOCAL_PATH} - -ADD target/${APP_NAME}.jar ${LOCAL_PATH} - -WORKDIR ${LOCAL_PATH} -EXPOSE 28011 -EXPOSE 8888 - -CMD java --add-opens java.base/java.lang=ALL-UNNAMED -jar ${APP_NAME}.jar diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/ingress.yml b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/ingress.yml deleted file mode 100644 index d26dc076e52e..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/ingress.yml +++ /dev/null @@ -1,87 +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: sofa-find-id - namespace: shenyu-ingress - annotations: - kubernetes.io/ingress.class: shenyu - shenyu.apache.org/plugin-sofa-enabled: 'true' - shenyu.apache.org/plugin-sofa-app-name: sofa - shenyu.apache.org/plugin-context-path-path: /sofa - shenyu.apache.org/plugin-sofa-path: /sofa/findById - shenyu.apache.org/plugin-sofa-rpc-type: sofa - shenyu.apache.org/plugin-sofa-service-name: org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService - shenyu.apache.org/plugin-sofa-method-name: findById - shenyu.apache.org/plugin-sofa-params-type: java.lang.String - shenyu.apache.org/plugin-sofa-rpc-expand: | - {"loadbalance":"hash","retries":3,"timeout":-1} -spec: - selector: - app: shenyu-examples-sofa - ports: - - port: 8888 - ---- - -apiVersion: v1 -kind: Service -metadata: - name: sofa-find-all - namespace: shenyu-ingress - annotations: - kubernetes.io/ingress.class: shenyu - shenyu.apache.org/plugin-sofa-enabled: 'true' - shenyu.apache.org/plugin-context-path-path: /sofa - shenyu.apache.org/plugin-sofa-app-name: sofa - shenyu.apache.org/plugin-sofa-path: /sofa/findAll - shenyu.apache.org/plugin-sofa-rpc-type: sofa - shenyu.apache.org/plugin-sofa-service-name: org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService - shenyu.apache.org/plugin-sofa-method-name: findAll - shenyu.apache.org/plugin-sofa-rpc-expand: | - {"loadbalance":"hash","retries":3,"timeout":-1} -spec: - selector: - app: shenyu-examples-sofa - ports: - - port: 8888 - ---- - -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - namespace: shenyu-ingress - labels: - shenyu.apache.org/metadata-labels-1: sofa-find-id - shenyu.apache.org/metadata-labels-2: sofa-find-all - annotations: - kubernetes.io/ingress.class: shenyu - shenyu.apache.org/plugin-sofa-enabled: 'true' - shenyu.apache.org/zookeeper-register-address: shenyu-zk:2181 - name: demo-ingress -spec: - rules: - - http: - paths: - - backend: - service: - name: shenyu-examples-sofa - port: - number: 8888 - path: /sofa/ - pathType: Prefix diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-examples-sofa.yml b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-examples-sofa.yml deleted file mode 100644 index f0ab46a6a231..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-examples-sofa.yml +++ /dev/null @@ -1,90 +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-sofa-deployment - namespace: shenyu-ingress - labels: - app: shenyu-examples-sofa - all: shenyu-examples-sofa -spec: - replicas: 1 - selector: - matchLabels: - app: shenyu-examples-sofa - all: shenyu-examples-sofa - strategy: {} - template: - metadata: - labels: - app: shenyu-examples-sofa - all: shenyu-examples-sofa - spec: - containers: - - image: shenyu-examples-sofa - name: shenyu-examples-sofa - livenessProbe: - initialDelaySeconds: 30 - periodSeconds: 10 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 3 - exec: - command: - - /bin/sh - - "-c" - - wget -q -O - http://localhost:8081/actuator/health | grep UP || exit 1 - env: - - name: shenyu.register.serverLists - value: http://shenyu-admin:9095 -# - name: com.alipay.sofa.rpc.registry-address -# value: zookeeper://shenyu-zk:2181 - - name: sofa.boot.rpc.registry.address - value: zookeeper://shenyu-zk:2181 - ports: - - containerPort: 28011 - - containerPort: 8888 - imagePullPolicy: IfNotPresent - restartPolicy: Always -status: {} - ---- -apiVersion: v1 -kind: Service -metadata: - name: shenyu-examples-sofa-service - namespace: shenyu-ingress - labels: - app: shenyu-examples-sofa - all: shenyu-examples-sofa -spec: - selector: - app: shenyu-examples-sofa - all: shenyu-examples-sofa - type: NodePort - ports: - - name: "8888" - port: 8888 - targetPort: 8888 - nodePort: 31111 - - name: "28011" - port: 28011 - targetPort: 28011 - nodePort: 31112 -status: - loadBalancer: {} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-zookeeper.yml b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-zookeeper.yml deleted file mode 100644 index 6528c4856fe4..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-zookeeper.yml +++ /dev/null @@ -1,87 +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: apps/v1 -kind: Deployment -metadata: - namespace: shenyu-ingress - labels: - app: shenyu-zk - all: shenyu-examples-sofa - name: shenyu-zk -spec: - replicas: 1 - selector: - matchLabels: - app: shenyu-zk - all: shenyu-examples-sofa - strategy: {} - template: - metadata: - namespace: shenyu-ingress - labels: - app: shenyu-zk - all: shenyu-examples-sofa - 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-sofa -spec: - type: NodePort - selector: - app: shenyu-zk - all: shenyu-examples-sofa - 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-sofa/shenyu-examples-sofa-service/pom.xml b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/pom.xml deleted file mode 100644 index 63198f231dd7..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/pom.xml +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-examples-sofa - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-examples-sofa-service - - - 4.3.0 - 4.3.0 - 4.3.0 - 1.13.1 - 2.1.1 - 2.15.1 - 4.5.13 - 3.25.5 - 3.5.7 - 32.1.2-jre - 1.54.2 - 1.9 - - - - - com.alipay.sofa - actuator-sofa-boot-starter - ${rpc-sofa-boot-starter.version} - - - com.alipay.sofa - rpc-sofa-boot-starter - ${rpc-sofa-boot-starter.version} - - - commons-logging - commons-logging - - - grpc-protobuf - io.grpc - - - grpc-context - io.grpc - - - grpc-stub - io.grpc - - - guava - com.google.guava - - - sofa-common-tools - com.alipay.sofa.common - - - commons-io - commons-io - - - httpclient - org.apache.httpcomponents - - - protobuf-java - com.google.protobuf - - - auto-value-annotations - com.google.auto.value - - - - - com.alipay.sofa.common - sofa-common-tools - ${sofa-common-tools.version} - - - guava - com.google.guava - - - - - commons-io - commons-io - ${commons-io.version} - - - org.apache.httpcomponents - httpclient - ${httpclient.version} - - - commons-logging - commons-logging - - - - - com.google.protobuf - protobuf-java - ${protobuf-java.version} - - - org.apache.curator - curator-x-discovery - ${curator.version} - - - org.apache.zookeeper - zookeeper - ${zookeeper.version} - - - slf4j-reload4j - org.slf4j - - - - - com.google.auto.value - auto-value-annotations - ${auto-value-annotations.version} - - - - com.google.guava - guava - ${guava.version} - - - io.grpc - grpc-context - ${grpc.version} - - - io.grpc - grpc-protobuf - ${grpc.version} - - - guava - com.google.guava - - - - - io.grpc - grpc-stub - ${grpc.version} - - - guava - com.google.guava - - - - - org.springframework.boot - spring-boot-starter - - - - org.apache.curator - curator-client - ${curator.version} - - - guava - com.google.guava - - - - - org.apache.curator - curator-framework - ${curator.version} - - - org.apache.curator - curator-recipes - ${curator.version} - - - - org.apache.shenyu - shenyu-examples-sofa-api - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-client-sofa - ${project.version} - - - guava - com.google.guava - - - snakeyaml - org.yaml - - - grpc-context - io.grpc - - - auto-value-annotations - com.google.auto.value - - - protobuf-java - com.google.protobuf - - - j2objc-annotations - com.google.j2objc - - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.boot - spring-boot-starter-web - - - org.apache.shenyu - shenyu-examples-common - ${project.version} - - - io.micrometer - micrometer-core - ${micrometer.version} - - - - - shenyu-examples-sofa - - - org.springframework.boot - spring-boot-maven-plugin - - org.apache.shenyu.examples.sofa.service.TestSofaApplication - true - - - - - - - - example - - shenyu-examples-sofa - shenyu-examples-sofa - latest - - - false - - - - - io.fabric8 - docker-maven-plugin - ${docker-maven-plugin.version} - - - - shenyu-examples-sofa - - ${project.basedir} - - - - - - - start - - build - - - - - - - - - diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/http/sofa-test-api.http b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/http/sofa-test-api.http deleted file mode 100644 index 3f29522e1de2..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/http/sofa-test-api.http +++ /dev/null @@ -1,221 +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 findById -POST http://localhost:9195/sofa/findById -Accept: application/json -Content-Type: application/json - -{ - "id": "123" -} - -### shengyu getway proxy findAll -GET http://localhost:9195/sofa/findAll -Accept: application/json - - -### shengyu getway proxy insert -POST http://localhost:9195/sofa/insert -Accept: application/json -Content-Type: application/json - -{ - "sofaSimpleTypeBean": { - "id": 123, - "name": "test" - } -} - -### shengyu getway proxy findByIdsAndName -GET http://localhost:9195/sofa/findByIdsAndName -Accept: application/json -Content-Type: application/json - -{ - "ids": [ - 123, - 124, - 125 - ], - "name": "test" -} - -### shengyu getway proxy findByArrayIdsAndName -GET http://localhost:9195/sofa/findByArrayIdsAndName -Accept: application/json -Content-Type: application/json - -{ - "ids": [ - 123, - 124, - 125 - ], - "name": "test" -} - -### shengyu getway proxy findByStringArray -GET http://localhost:9195/sofa/findByStringArray -Accept: application/json -Content-Type: application/json - -{ - "ids": [ - 123, - 124, - 125 - ] -} - -### shengyu getway proxy findByListId -GET http://localhost:9195/sofa/findByListId -Accept: application/json -Content-Type: application/json - -{ - "ids": [ - 123, - 124, - 125 - ] -} - -### shengyu getway proxy batchSave -PUT http://localhost:9195/sofa/batchSave -Accept: application/json -Content-Type: application/json - -{ - "sofaTestList": [ - { - "id": "123", - "name": "test" - }, - { - "id": "123", - "name": "test" - }, - { - "id": "123", - "name": "test" - } - ] -} - -### shengyu getway proxy batchSaveNameAndId -PUT http://localhost:9195/sofa/batchSaveNameAndId -Accept: application/json -Content-Type: application/json - -{ - "sofaTestList": [ - { - "id": "123", - "name": "test" - }, - { - "id": "123", - "name": "test" - }, - { - "id": "123", - "name": "test" - } - ], - "id": "123", - "name": "test" -} - -### shengyu getway proxy saveComplexBean -PUT http://localhost:9195/sofa/saveComplexBean -Accept: application/json -Content-Type: application/json - -{ - "sofaComplexTypeBean": { - "sofaSimpleTypeBean": { - "id": "123", - "name": "test" - }, - "idLists": [ - 123, - 124 - ], - "idMaps": { - "abc": "abc", - "cbd": "cbd" - } - } -} - -### shengyu getway proxy saveComplexBeanAndName -PUT http://localhost:9195/sofa/saveComplexBeanAndName -Accept: application/json -Content-Type: application/json - -{ - "sofaComplexTypeBean": { - "sofaSimpleTypeBean": { - "id": "123", - "name": "test" - }, - "idLists": [ - 123, - 124 - ], - "idMaps": { - "abc": "abc", - "cbd": "cbd" - } - }, - "name": "name" -} - -### shengyu getway proxy saveTwoList -PUT http://localhost:9195/sofa/saveTwoList -Accept: application/json -Content-Type: application/json - -{ - "sofaComplexTypeBeanList": [ - { - "sofaSimpleTypeBean": { - "id": "123", - "name": "test" - }, - "idLists": [ - 123, - 124 - ], - "idMaps": { - "abc": "abc", - "cbd": "cbd" - } - } - ], - "sofaSimpleTypeBeanMap": { - "testKey1": { - "id": "123", - "name": "test" - }, - "testKey2": { - "id": "123", - "name": "test" - } - } -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/TestSofaApplication.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/TestSofaApplication.java deleted file mode 100644 index f97e1e8be2c0..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/TestSofaApplication.java +++ /dev/null @@ -1,40 +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.sofa.service; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ImportResource; - -/** - * Sofa service starter. - */ -@SpringBootApplication -@ImportResource(locations = { "classpath*:invoke-server-example.xml"}) -public class TestSofaApplication { - - /** - * Main Entrance. - * - * @param args startup arguments - */ - public static void main(final String[] args) { - SpringApplication.run(TestSofaApplication.class, args); - } - -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaClientMultiParamServiceImpl.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaClientMultiParamServiceImpl.java deleted file mode 100644 index 813b7f67192d..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaClientMultiParamServiceImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.examples.sofa.service.impl; - -import org.apache.shenyu.client.apidocs.annotations.ApiDoc; -import org.apache.shenyu.client.apidocs.annotations.ApiModule; -import org.apache.shenyu.client.sofa.common.annotation.ShenyuSofaClient; -import org.apache.shenyu.examples.sofa.api.entity.SofaComplexTypeBean; -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; -import org.apache.shenyu.examples.sofa.api.service.SofaClientMultiParamService; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * Sofa multi parameter service. - */ -@ShenyuSofaClient("/demo") -@Service -@ApiModule(value = "demo") -public class SofaClientMultiParamServiceImpl implements SofaClientMultiParamService { - - @Override - @ShenyuSofaClient("/findByIdsAndName") - @ApiDoc(desc = "findByIdsAndName") - public SofaSimpleTypeBean findByIdsAndName(final List ids, final String name) { - return new SofaSimpleTypeBean(ids.toString(), "hello world shenyu sofa param findByIdsAndName :" + name); - } - - @Override - @ShenyuSofaClient("/findByArrayIdsAndName") - @ApiDoc(desc = "findByArrayIdsAndName") - public SofaSimpleTypeBean findByArrayIdsAndName(final Integer[] ids, final String name) { - return new SofaSimpleTypeBean(Arrays.toString(ids), "hello world shenyu sofa param findByArrayIdsAndName :" + name); - } - - @Override - @ShenyuSofaClient("/findByStringArray") - @ApiDoc(desc = "findByStringArray") - public SofaSimpleTypeBean findByStringArray(final String[] ids) { - return new SofaSimpleTypeBean(Arrays.toString(ids), "hello world shenyu sofa param findByStringArray"); - } - - @Override - @ShenyuSofaClient("/findByListId") - @ApiDoc(desc = "findByListId") - public SofaSimpleTypeBean findByListId(final List ids) { - return new SofaSimpleTypeBean(ids.toString(), "hello world shenyu sofa param findByListId"); - } - - @Override - @ShenyuSofaClient("/batchSave") - @ApiDoc(desc = "batchSave") - public SofaSimpleTypeBean batchSave(final List sofaTestList) { - final String id = sofaTestList.stream().map(SofaSimpleTypeBean::getId).collect(Collectors.joining("-")); - final String name = "hello world shenyu sofa param batchSave :" - + sofaTestList.stream() - .map(SofaSimpleTypeBean::getName) - .collect(Collectors.joining("-")); - return new SofaSimpleTypeBean(id, name); - } - - @Override - @ShenyuSofaClient("/batchSaveNameAndId") - @ApiDoc(desc = "batchSaveNameAndId") - public SofaSimpleTypeBean batchSaveNameAndId(final List sofaTestList, final String id, final String name) { - final String newName = "hello world shenyu sofa param batchSaveAndNameAndId :" + name + ":" - + sofaTestList.stream() - .map(SofaSimpleTypeBean::getName) - .collect(Collectors.joining("-")); - return new SofaSimpleTypeBean(id, newName); - } - - @Override - @ShenyuSofaClient("/saveComplexBean") - @ApiDoc(desc = "saveComplexBean") - public SofaSimpleTypeBean saveComplexBean(final SofaComplexTypeBean sofaComplexTypeBean) { - final String id = sofaComplexTypeBean.getIdLists().toString(); - final String typeName = "hello world shenyu sofa param saveComplexBean :" + sofaComplexTypeBean.getSofaSimpleTypeBean().getName(); - return new SofaSimpleTypeBean(id, typeName); - } - - @Override - @ShenyuSofaClient("/saveComplexBeanAndName") - @ApiDoc(desc = "saveComplexBeanAndName") - public SofaSimpleTypeBean saveComplexBeanAndName(final SofaComplexTypeBean sofaComplexTypeBean, final String name) { - final String id = sofaComplexTypeBean.getIdLists().toString(); - final String typeName = "hello world shenyu sofa param saveComplexBeanAndName :" + sofaComplexTypeBean.getSofaSimpleTypeBean().getName() + "-" + name; - return new SofaSimpleTypeBean(id, typeName); - } - - @Override - @ShenyuSofaClient("/saveTwoList") - @ApiDoc(desc = "saveTwoList") - public SofaSimpleTypeBean saveTwoList(final List sofaComplexTypeBeanList, final Map sofaSimpleTypeBeanMap) { - SofaSimpleTypeBean simpleTypeBean = new SofaSimpleTypeBean(); - if (!CollectionUtils.isEmpty(sofaComplexTypeBeanList) && !CollectionUtils.isEmpty(sofaSimpleTypeBeanMap)) { - final SofaComplexTypeBean firstBean = sofaComplexTypeBeanList.get(0); - final Optional firstTypeOptional = sofaSimpleTypeBeanMap.values().stream().findFirst(); - simpleTypeBean.setId(firstBean.getIdLists().toString()); - simpleTypeBean.setName("hello world shenyu sofa param saveTwoList :" + firstBean.getSofaSimpleTypeBean().getName() - + "-" + firstTypeOptional.map(SofaSimpleTypeBean::getName)); - } - return simpleTypeBean; - } -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaClientSingleParamServiceImpl.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaClientSingleParamServiceImpl.java deleted file mode 100644 index 859bbc01c658..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaClientSingleParamServiceImpl.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.examples.sofa.service.impl; - -import org.apache.shenyu.client.sofa.common.annotation.ShenyuSofaClient; -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; -import org.apache.shenyu.examples.sofa.api.service.SofaClientSingleParamService; -import org.springframework.stereotype.Service; - -import java.util.Random; - -/** - * Sofa single param service. - */ -@ShenyuSofaClient("/demo/**") -@Service -public class SofaClientSingleParamServiceImpl implements SofaClientSingleParamService { - - @Override - @ShenyuSofaClient("/findById") - public SofaSimpleTypeBean findById(final String id) { - return new SofaSimpleTypeBean(id, "hello world shenyu Sofa, findById"); - } - - @Override - @ShenyuSofaClient("/findAll") - public SofaSimpleTypeBean findAll() { - return new SofaSimpleTypeBean(String.valueOf(new Random().nextInt()), "hello world shenyu Sofa , findAll"); - } - - @Override - @ShenyuSofaClient("/insert") - public SofaSimpleTypeBean insert(final SofaSimpleTypeBean sofaSimpleTypeBean) { - sofaSimpleTypeBean.setName("hello world shenyu Sofa: " + sofaSimpleTypeBean.getName()); - return sofaSimpleTypeBean; - } -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaMultiParamServiceImpl.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaMultiParamServiceImpl.java deleted file mode 100644 index 67f4f743bd2c..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaMultiParamServiceImpl.java +++ /dev/null @@ -1,125 +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.sofa.service.impl; - -import org.apache.shenyu.client.apidocs.annotations.ApiDoc; -import org.apache.shenyu.client.apidocs.annotations.ApiModule; -import org.apache.shenyu.client.sofa.common.annotation.ShenyuSofaClient; -import org.apache.shenyu.examples.sofa.api.entity.SofaComplexTypeBean; -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; -import org.apache.shenyu.examples.sofa.api.service.SofaMultiParamService; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * Sofa multi parameter service. - */ -@Service("sofaMultiParamService") -@ApiModule(value = "sofaMultiParamService") -public class SofaMultiParamServiceImpl implements SofaMultiParamService { - - @Override - @ShenyuSofaClient("/findByIdsAndName") - @ApiDoc(desc = "findByIdsAndName") - public SofaSimpleTypeBean findByIdsAndName(final List ids, final String name) { - return new SofaSimpleTypeBean(ids.toString(), "hello world shenyu sofa param findByIdsAndName :" + name); - } - - @Override - @ShenyuSofaClient("/findByArrayIdsAndName") - @ApiDoc(desc = "findByArrayIdsAndName") - public SofaSimpleTypeBean findByArrayIdsAndName(final Integer[] ids, final String name) { - return new SofaSimpleTypeBean(Arrays.toString(ids), "hello world shenyu sofa param findByArrayIdsAndName :" + name); - } - - @Override - @ShenyuSofaClient("/findByStringArray") - @ApiDoc(desc = "findByStringArray") - public SofaSimpleTypeBean findByStringArray(final String[] ids) { - return new SofaSimpleTypeBean(Arrays.toString(ids), "hello world shenyu sofa param findByStringArray"); - } - - @Override - @ShenyuSofaClient("/findByListId") - @ApiDoc(desc = "findByListId") - public SofaSimpleTypeBean findByListId(final List ids) { - return new SofaSimpleTypeBean(ids.toString(), "hello world shenyu sofa param findByListId"); - } - - @Override - @ShenyuSofaClient("/batchSave") - @ApiDoc(desc = "batchSave") - public SofaSimpleTypeBean batchSave(final List sofaTestList) { - final String id = sofaTestList.stream().map(SofaSimpleTypeBean::getId).collect(Collectors.joining("-")); - final String name = "hello world shenyu sofa param batchSave :" - + sofaTestList.stream() - .map(SofaSimpleTypeBean::getName) - .collect(Collectors.joining("-")); - return new SofaSimpleTypeBean(id, name); - } - - @Override - @ShenyuSofaClient("/batchSaveNameAndId") - @ApiDoc(desc = "batchSaveNameAndId") - public SofaSimpleTypeBean batchSaveNameAndId(final List sofaTestList, final String id, final String name) { - final String newName = "hello world shenyu sofa param batchSaveAndNameAndId :" + name + ":" - + sofaTestList.stream() - .map(SofaSimpleTypeBean::getName) - .collect(Collectors.joining("-")); - return new SofaSimpleTypeBean(id, newName); - } - - @Override - @ShenyuSofaClient("/saveComplexBean") - @ApiDoc(desc = "saveComplexBean") - public SofaSimpleTypeBean saveComplexBean(final SofaComplexTypeBean sofaComplexTypeBean) { - final String id = sofaComplexTypeBean.getIdLists().toString(); - final String typeName = "hello world shenyu sofa param saveComplexBean :" + sofaComplexTypeBean.getSofaSimpleTypeBean().getName(); - return new SofaSimpleTypeBean(id, typeName); - } - - @Override - @ShenyuSofaClient("/saveComplexBeanAndName") - @ApiDoc(desc = "saveComplexBeanAndName") - public SofaSimpleTypeBean saveComplexBeanAndName(final SofaComplexTypeBean sofaComplexTypeBean, final String name) { - final String id = sofaComplexTypeBean.getIdLists().toString(); - final String typeName = "hello world shenyu sofa param saveComplexBeanAndName :" + sofaComplexTypeBean.getSofaSimpleTypeBean().getName() + "-" + name; - return new SofaSimpleTypeBean(id, typeName); - } - - @Override - @ShenyuSofaClient("/saveTwoList") - @ApiDoc(desc = "saveTwoList") - public SofaSimpleTypeBean saveTwoList(final List sofaComplexTypeBeanList, final Map sofaSimpleTypeBeanMap) { - SofaSimpleTypeBean simpleTypeBean = new SofaSimpleTypeBean(); - if (!CollectionUtils.isEmpty(sofaComplexTypeBeanList) && !CollectionUtils.isEmpty(sofaSimpleTypeBeanMap)) { - final SofaComplexTypeBean firstBean = sofaComplexTypeBeanList.get(0); - final Optional firstTypeOptional = sofaSimpleTypeBeanMap.values().stream().findFirst(); - simpleTypeBean.setId(firstBean.getIdLists().toString()); - simpleTypeBean.setName("hello world shenyu sofa param saveTwoList :" + firstBean.getSofaSimpleTypeBean().getName() - + "-" + firstTypeOptional.map(SofaSimpleTypeBean::getName)); - } - return simpleTypeBean; - } -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaSingleParamServiceImpl.java b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaSingleParamServiceImpl.java deleted file mode 100644 index 806bbda5f985..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/java/org/apache/shenyu/examples/sofa/service/impl/SofaSingleParamServiceImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.examples.sofa.service.impl; - -import org.apache.shenyu.client.apidocs.annotations.ApiDoc; -import org.apache.shenyu.client.apidocs.annotations.ApiModule; -import org.apache.shenyu.client.sofa.common.annotation.ShenyuSofaClient; -import org.apache.shenyu.examples.common.aop.Log; -import org.apache.shenyu.examples.sofa.api.entity.SofaSimpleTypeBean; -import org.apache.shenyu.examples.sofa.api.service.SofaSingleParamService; -import org.springframework.stereotype.Service; - -import java.util.Random; - -/** - * Sofa single param service. - */ -@Service("sofaSingleParamService") -@ApiModule(value = "sofaSingleParamService") -public class SofaSingleParamServiceImpl implements SofaSingleParamService { - - @Override - @ShenyuSofaClient("/findById") - @Log - @ApiDoc(desc = "findById") - public SofaSimpleTypeBean findById(final String id) { - return new SofaSimpleTypeBean(id, "hello world shenyu Sofa, findById"); - } - - @Override - @ShenyuSofaClient("/findAll") - @ApiDoc(desc = "findAll") - public SofaSimpleTypeBean findAll() { - return new SofaSimpleTypeBean(String.valueOf(new Random().nextInt()), "hello world shenyu Sofa , findAll"); - } - - @Override - @ShenyuSofaClient("/insert") - @ApiDoc(desc = "insert") - public SofaSimpleTypeBean insert(final SofaSimpleTypeBean sofaSimpleTypeBean) { - sofaSimpleTypeBean.setName("hello world shenyu Sofa: " + sofaSimpleTypeBean.getName()); - return sofaSimpleTypeBean; - } -} diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/resources/application.yml b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/resources/application.yml deleted file mode 100644 index 71102458d62f..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/resources/application.yml +++ /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. - -server: - port: 28011 - address: 0.0.0.0 - servlet: - context-path: / -spring: - main: - allow-bean-definition-overriding: true - application: - name: sofa -#com: -# alipay: -# sofa: -# rpc: -# registry-address: zookeeper://127.0.0.1:2181 -# bolt-port: 8888 -sofa: - boot: - rpc: - registry: - address: zookeeper://127.0.0.1:2181 - -shenyu: - namespace: 649330b6-c2d7-4edc-be8e-8a54df9eb385 - register: - registerType: http - serverLists: http://localhost:9095 - props: - username: admin - password: 123456 - client: - sofa: - props: - contextPath: /sofa - ipAndPort: sofa - appName: sofa - port: 8888 diff --git a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/resources/invoke-server-example.xml b/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/resources/invoke-server-example.xml deleted file mode 100644 index 7567eefcb2c9..000000000000 --- a/shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/src/main/resources/invoke-server-example.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/shenyu-integrated-test/pom.xml b/shenyu-integrated-test/pom.xml index 46da401efc69..0f7b8be7ada9 100644 --- a/shenyu-integrated-test/pom.xml +++ b/shenyu-integrated-test/pom.xml @@ -36,7 +36,6 @@ 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 shenyu-integrated-test-combination @@ -48,7 +47,6 @@ shenyu-integrated-test-k8s-ingress-apache-dubbo shenyu-integrated-test-k8s-ingress-websocket shenyu-integrated-test-k8s-ingress-grpc - shenyu-integrated-test-k8s-ingress-sofa @@ -61,7 +59,6 @@ 2.9.0 4.9.3 1.7.2 - 3.4.0 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..f947ca1b2d33 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-combination/docker-compose.yml +++ b/shenyu-integrated-test/shenyu-integrated-test-combination/docker-compose.yml @@ -137,31 +137,6 @@ services: shenyu-integrated-test-combination: condition: service_healthy - shenyu-examples-sofa: - deploy: - resources: - limits: - memory: 2048M - container_name: shenyu-examples-sofa - image: shenyu-examples-sofa:latest - restart: always - environment: - - shenyu.register.serverLists=http://shenyu-admin:9095 - - com.alipay.sofa.rpc.registry-address=zookeeper://shenyu-zk:2181 - - sofa.boot.rpc.registry.address=zookeeper://shenyu-zk:2181 - healthcheck: - test: [ "CMD-SHELL", "wget -q -O - http://localhost:28011/actuator/health | grep UP || exit 1" ] - timeout: 2s - retries: 3 - start_period: 5s - ports: - - "28011:28011" - - "8888:8888" - networks: - - shenyu - depends_on: - shenyu-integrated-test-combination: - condition: service_healthy shenyu-admin: image: apache/shenyu-admin:latest diff --git a/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml index 0222de0e5d91..04f1b7567f93 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml +++ b/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml @@ -152,36 +152,6 @@ - - - com.alipay.sofa - sofa-rpc-all - - - net.jcip - jcip-annotations - - - io.grpc - grpc-core - - - sofa-common-tools - com.alipay.sofa.common - - - - - com.alipay.sofa.common - sofa-common-tools - ${sofa-common-tools.version} - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-sofa - ${project.version} - - 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..2388fc647a2f 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 @@ -23,7 +23,6 @@ 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; import org.springframework.web.bind.annotation.RequestMapping; @@ -84,15 +83,4 @@ public String getFromMotan() { .orElse(""); } - /** - * get the shared thread pool from sofa. - * - * @return the shared thread pool - */ - @GetMapping("/getFromSofa") - public String getFromSofa() { - return Optional.ofNullable(ApplicationConfigCache.getInstance().getThreadPool()) - .map(Objects::toString) - .orElse(""); - } } 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..cbfdd795b544 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 @@ -26,7 +26,6 @@ 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; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -59,9 +58,6 @@ public static void setup() throws IOException { // 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")); } @Test @@ -102,6 +98,5 @@ public static void testIsOneThreadPool() throws IOException { 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-k8s-ingress-sofa/Dockerfile b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/Dockerfile deleted file mode 100644 index e48f867d68c6..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/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-sofa -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 -jar ${APP_NAME}.jar diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/deploy/deploy-shenyu.yaml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/deploy/deploy-shenyu.yaml deleted file mode 100644 index a38325bda2e5..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/deploy/deploy-shenyu.yaml +++ /dev/null @@ -1,103 +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 -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-sofa: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 - namespace: shenyu-ingress -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-sofa/deploy/kind-config.yaml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/deploy/kind-config.yaml deleted file mode 100644 index 0dc0313af1f9..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/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-sofa/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/pom.xml deleted file mode 100644 index ca6ccc2a961b..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/pom.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - 4.0.0 - - org.apache.shenyu - shenyu-integrated-test - 2.7.1-SNAPSHOT - - - shenyu-integrated-test-k8s-ingress-sofa - shenyu-integrated-test-k8s-ingress-sofa - - - 4.3.0 - - - - com.alipay.sofa - sofa-rpc-all - - - net.jcip - jcip-annotations - - - io.grpc - grpc-core - - - commons-io - commons-io - - - grpc-context - io.grpc - - - sofa-common-tools - com.alipay.sofa.common - - - - - com.alipay.sofa.common - sofa-common-tools - ${sofa-common-tools.version} - - - - org.apache.curator - curator-client - ${curator.version} - - - commons-io - commons-io - - - - - - org.apache.curator - curator-framework - ${curator.version} - - - - org.apache.curator - curator-recipes - ${curator.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-sofa - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-jwt - ${project.version} - - - - org.apache.shenyu - shenyu-integrated-test-common - ${project.version} - - - - - org.apache.shenyu - shenyu-spring-boot-starter-k8s - ${project.version} - - - commons-compress - org.apache.commons - - - commons-io - commons-io - - - - - - commons-io - commons-io - 2.15.1 - - - io.grpc - grpc-context - 1.65.1 - - - - - - it - - shenyu-integrated-test-k8s-ingress-sofa - apache/shenyu-integrated-test-k8s-ingress-sofa - latest - - - shenyu-integrated-test-k8s-ingress-sofa - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - - package - - repackage - - - - - org.apache.shenyu.integrated.test.k8s.ingress.sofa.SofaIngressControllerIntegratedBootstrap - - true - - - - io.fabric8 - docker-maven-plugin - ${docker-maven-plugin.version} - - - - apache/shenyu-integrated-test-k8s-ingress-sofa - - ${project.basedir} - - - - - - - start - - build - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - - - - diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/build_k8s_cluster.sh b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/build_k8s_cluster.sh deleted file mode 100644 index 35d0b12396c6..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/build_k8s_cluster.sh +++ /dev/null @@ -1,32 +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-sofa:latest" -kind load docker-image "apache/shenyu-integrated-test-k8s-ingress-sofa:latest" -kubectl apply -f ./shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-zookeeper.yml -kubectl wait --for=condition=Ready pod -l app=shenyu-zk -n shenyu-ingress -kubectl apply -f ./shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/shenyu-examples-sofa.yml -kubectl wait --for=condition=Ready pod -l app=shenyu-examples-sofa -n shenyu-ingress -kubectl apply -f ./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/deploy/deploy-shenyu.yaml -kubectl wait --for=condition=Ready pod -l app=shenyu-ingress-controller -n shenyu-ingress -kubectl apply -f ./shenyu-examples/shenyu-examples-sofa/shenyu-examples-sofa-service/k8s/ingress.yml - -kubectl get pod -o wide -n shenyu-ingress - -echo "Waiting for shenyu-examples-sofa-service to be ready" -kubectl logs "$(kubectl get pod -o wide -n shenyu-ingress| grep shenyu-examples-sofa-deployment | awk '{print $1}')" -n shenyu-ingress diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/healthcheck.sh b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/healthcheck.sh deleted file mode 100644 index 08e7c44e2a82..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/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 60` - 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 3 -echo -e "\n-------------------" diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/services.list b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/services.list deleted file mode 100644 index ef0e742c04c8..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/script/services.list +++ /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. - -http://localhost:30095/actuator/health -http://localhost:31184/actuator/health diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/SofaIngressControllerIntegratedBootstrap.java b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/SofaIngressControllerIntegratedBootstrap.java deleted file mode 100644 index d6513ab6b43e..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/SofaIngressControllerIntegratedBootstrap.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.integrated.test.k8s.ingress.sofa; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * The type sofa integrated bootstrap. - */ -@SpringBootApplication -public class SofaIngressControllerIntegratedBootstrap { - /** - * main method of app. - * - * @param args args - */ - public static void main(final String[] args) { - SpringApplication.run(SofaIngressControllerIntegratedBootstrap.class); - } -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/dto/SofaTestData.java b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/dto/SofaTestData.java deleted file mode 100644 index 3956aa699c36..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/dto/SofaTestData.java +++ /dev/null @@ -1,51 +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.sofa.dto; - -public class SofaTestData { - - private String id; - - private String name; - - /** - * get id. - * - * @return id - */ - public String getId() { - return id; - } - - /** - * get name. - * - * @return name - */ - public String getName() { - return name; - } - - @Override - public String toString() { - return "SofaTest{" - + "id='" + id + '\'' - + ", name='" + name + '\'' - + '}'; - } -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/resources/application-local.yml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/resources/application-local.yml deleted file mode 100644 index 643c44178ef6..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/resources/application-local.yml +++ /dev/null @@ -1,55 +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 - 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-k8s-ingress-sofa/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/main/resources/application.yml deleted file mode 100644 index 393ad24df15b..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/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-k8s-ingress-sofa/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/SofaPluginShareThreadPoolTest.java b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/SofaPluginShareThreadPoolTest.java deleted file mode 100644 index a8bc54f8d395..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-sofa/src/test/java/org/apache/shenyu/integrated/test/k8s/ingress/sofa/SofaPluginShareThreadPoolTest.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.integrated.test.k8s.ingress.sofa; - -import com.google.gson.reflect.TypeToken; -import org.apache.shenyu.integrated.test.k8s.ingress.sofa.dto.SofaTestData; -import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; -import org.apache.shenyu.integratedtest.common.helper.HttpHelper; -import org.hamcrest.core.Is; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.IOException; - -import static org.hamcrest.MatcherAssert.assertThat; - -public class SofaPluginShareThreadPoolTest 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 IOException { - SofaTestData response = HttpHelper.INSTANCE.getFromGateway("/sofa/findById?id=1001", new TypeToken() { }.getType()); - assertThat(response.getName(), Is.is("hello world shenyu Sofa, findById")); - assertThat(response.getId(), Is.is("1001")); - } -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/Dockerfile b/shenyu-integrated-test/shenyu-integrated-test-sofa/Dockerfile deleted file mode 100644 index 522abe705137..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/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-sofa -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 -jar ${APP_NAME}.jar diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml b/shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml deleted file mode 100644 index f8b736a07b73..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/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 - ports: - - "2181:2181" - 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-sofa: - deploy: - resources: - limits: - memory: 2048M - container_name: shenyu-examples-sofa - image: shenyu-examples-sofa:latest - restart: always - environment: - - shenyu.register.serverLists=http://shenyu-admin:9095 - - sofa.boot.rpc.registry.address=zookeeper://shenyu-zk:2181 - healthcheck: - test: [ "CMD-SHELL", "wget -q -O - http://localhost:28011/actuator/health | grep UP || exit 1" ] - timeout: 2s - retries: 3 - start_period: 5s - ports: - - "28011:28011" - - "8888:8888" - networks: - - shenyu - depends_on: - shenyu-integrated-test-sofa: - condition: service_healthy - - shenyu-integrated-test-sofa: - container_name: shenyu-integrated-test-sofa - image: apache/shenyu-integrated-test-sofa:latest - restart: always - deploy: - resources: - limits: - memory: 2048M - environment: - - shenyu.sync.websocket.urls=ws://shenyu-admin:9095/websocket - depends_on: - shenyu-admin: - condition: service_healthy - ports: - - "9195:9195" - healthcheck: - test: [ "CMD", "wget", "-q", "-O", "-", "http://shenyu-integrated-test-sofa: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-sofa/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-sofa/pom.xml deleted file mode 100644 index c81aa4e3e652..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/pom.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - shenyu-integrated-test - org.apache.shenyu - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-integrated-test-sofa - - - 8 - 8 - 4.3.0 - - - - - - org.apache.shenyu - shenyu-integrated-test-common - ${project.version} - - - - org.apache.curator - curator-recipes - ${curator.version} - - - curator-framework - org.apache.curator - - - - - org.apache.curator - curator-framework - ${curator.version} - - - curator-client - org.apache.curator - - - - - - org.apache.curator - curator-client - ${curator.version} - - - - - com.alipay.sofa - sofa-rpc-all - - - net.jcip - jcip-annotations - - - io.grpc - grpc-core - - - sofa-common-tools - com.alipay.sofa.common - - - - - com.alipay.sofa.common - sofa-common-tools - ${sofa-common-tools.version} - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-sofa - ${project.version} - - - - - - - it - - shenyu-integrated-test-sofa - apache/shenyu-integrated-test-sofa - latest - - - shenyu-integrated-test-sofa - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - - package - - repackage - - - - - org.apache.shenyu.integrated.test.sofa.SofaIntegratedBootstrap - true - - - - io.fabric8 - docker-maven-plugin - ${docker-maven-plugin.version} - - - - apache/shenyu-integrated-test-sofa - - ${project.basedir} - - - - - - - start - - build - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - - - - diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/script/healthcheck.sh b/shenyu-integrated-test/shenyu-integrated-test-sofa/script/healthcheck.sh deleted file mode 100644 index bebd5e2c8dc4..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/script/healthcheck.sh +++ /dev/null @@ -1,41 +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 -#docker compose -f ./shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml logs shenyu-zk -#sleep 90 -docker compose -f ./shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml logs shenyu-examples-sofa -sleep 90 -docker compose -f ./shenyu-integrated-test/shenyu-integrated-test-sofa/docker-compose.yml logs shenyu-integrated-test-sofa -sleep 90 -echo -e "\n-------------------" diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/script/services.list b/shenyu-integrated-test/shenyu-integrated-test-sofa/script/services.list deleted file mode 100644 index 032e35a8b1e1..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/script/services.list +++ /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. - -http://localhost:9095/actuator/health -http://localhost:9195/actuator/health -http://localhost:28011/actuator/health diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/SofaIntegratedBootstrap.java b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/SofaIntegratedBootstrap.java deleted file mode 100644 index 766e3c93aabf..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/SofaIntegratedBootstrap.java +++ /dev/null @@ -1,34 +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.sofa; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SofaIntegratedBootstrap { - - /** - * main mathod of app. - * - * @param args args - */ - public static void main(final String[] args) { - SpringApplication.run(SofaIntegratedBootstrap.class); - } -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/dto/SofaTestData.java b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/dto/SofaTestData.java deleted file mode 100644 index 4d163cd8ddcd..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/java/org/apache/shenyu/integrated/test/sofa/dto/SofaTestData.java +++ /dev/null @@ -1,51 +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.sofa.dto; - -public class SofaTestData { - - private String id; - - private String name; - - /** - * get id. - * - * @return id - */ - public String getId() { - return id; - } - - /** - * get name. - * - * @return name - */ - public String getName() { - return name; - } - - @Override - public String toString() { - return "SofaTest{" - + "id='" + id + '\'' - + ", name='" + name + '\'' - + '}'; - } -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application-local.yml b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application-local.yml deleted file mode 100644 index c74a79c76d83..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/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://shenyu-admin: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: debug -# 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-sofa/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/main/resources/application.yml deleted file mode 100644 index 393ad24df15b..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/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-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginShareThreadPoolTest.java b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginShareThreadPoolTest.java deleted file mode 100644 index 9ae9b2351a9e..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginShareThreadPoolTest.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.integrated.test.sofa; - -import com.google.gson.reflect.TypeToken; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.integrated.test.sofa.dto.SofaTestData; -import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; -import org.apache.shenyu.integratedtest.common.helper.HttpHelper; -import org.hamcrest.Matchers; -import org.hamcrest.core.Is; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import static org.hamcrest.MatcherAssert.assertThat; - -public class SofaPluginShareThreadPoolTest extends AbstractPluginDataInit { - - @BeforeAll - public static void setup() throws IOException { - String pluginResult = initPlugin(PluginEnum.SOFA.getName(), "{\"protocol\":\"zookeeper\",\"register\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}"); - assertThat(pluginResult, Matchers.is("success")); - } - - @Test - public void testHelloWorld() throws IOException { - SofaTestData response = HttpHelper.INSTANCE.getFromGateway("/sofa/findById?id=1001", new TypeToken() { }.getType()); - assertThat(response.getName(), Is.is("hello world shenyu Sofa, findById")); - assertThat(response.getId(), Is.is("1001")); - } - -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginTest.java b/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginTest.java deleted file mode 100644 index 6b027d34cf2d..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-sofa/src/test/java/org/apache/shenyu/integrated/test/sofa/SofaPluginTest.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.integrated.test.sofa; - -import com.google.gson.reflect.TypeToken; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.integrated.test.sofa.dto.SofaTestData; -import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; -import org.apache.shenyu.integratedtest.common.helper.HttpHelper; -import org.hamcrest.Matchers; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.io.IOException; - -import static org.hamcrest.core.Is.is; -import static org.hamcrest.MatcherAssert.assertThat; - -public class SofaPluginTest extends AbstractPluginDataInit { - - @BeforeAll - public static void setup() throws IOException { - String pluginResult = initPlugin(PluginEnum.SOFA.getName(), "{\"protocol\":\"zookeeper\",\"register\":\"shenyu-zk:2181\"}"); - assertThat(pluginResult, Matchers.is("success")); - } - - @Test - public void testHelloWorld() throws IOException { - SofaTestData response = HttpHelper.INSTANCE.getFromGateway("/sofa/findById?id=1001", new TypeToken() { }.getType()); - assertThat(response.getName(), is("hello world shenyu Sofa, findById")); - assertThat(response.getId(), is("1001")); - } -} 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..d5c738953a10 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 @@ -186,36 +186,4 @@ public class IngressConstants { //The configuration key to specify the Grpc parameter type for the plugin, in string public static final String PLUGIN_GRPC_PARAMETER_TYPE = "shenyu.apache.org/plugin-grpc-parameter-type"; - //The configuration key to specify the Sofa application name for the plugin, in string - public static final String PLUGIN_SOFA_APP_NAME = "shenyu.apache.org/plugin-sofa-app-name"; - - //The configuration key to specify the Sofa service name for the plugin, in string - public static final String PLUGIN_SOFA_SERVICE_NAME = "shenyu.apache.org/plugin-sofa-service-name"; - - //The configuration key to specify the Sofa method name for the plugin, in string - public static final String PLUGIN_SOFA_METHOD_NAME = "shenyu.apache.org/plugin-sofa-method-name"; - - //The configuration key to specify the Sofa params type for the plugin, in string - public static final String PLUGIN_SOFA_PARAMS_TYPE = "shenyu.apache.org/plugin-sofa-params-type"; - - //The configuration key to specify the Sofa rpc type for the plugin, in string - public static final String PLUGIN_SOFA_RPC_TYPE = "shenyu.apache.org/plugin-sofa-rpc-type"; - - //The configuration key to specify the Sofa context path for the plugin, in string - public static final String PLUGIN_SOFA_CONTEXT_PATH = "shenyu.apache.org/plugin-sofa-context-path"; - - //The configuration key to specify the Sofa path for the plugin, in string - public static final String PLUGIN_SOFA_PATH = "shenyu.apache.org/plugin-sofa-path"; - - //The configuration key to specify the Sofa enabled for the plugin, in string - public static final String PLUGIN_SOFA_ENABLED = "shenyu.apache.org/plugin-sofa-enabled"; - - //The configuration key to specify the Sofa rpc expand for the plugin, in string - public static final String PLUGIN_SOFA_RPC_EXPAND = "shenyu.apache.org/plugin-sofa-rpc-expand"; - - //The configuration key to specify the Sofa parameter type for the plugin, in string - public static final String PLUGIN_SOFA_PARAMETER_TYPE = "shenyu.apache.org/plugin-sofa-parameter-type"; - - //The configuration key to specify the Sofa parameter type for the plugin, in string - public static final String PLUGIN_SOFA_RPC_EXT = "shenyu.apache.org/plugin-sofa-rpc-ext"; } 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..8ecdd362cb40 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 @@ -69,11 +69,9 @@ public List parse(final V1Ingress ingress, final CoreV1Api c 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 (hasContextPathAnnotation(ingress)) { contextPathParse(ingress, shenyuMemoryConfigList, coreV1Api); } if (dubboEnabled) { @@ -88,9 +86,6 @@ public List parse(final V1Ingress ingress, final CoreV1Api c } else if (grpcEnabled) { GrpcParser grpcParser = new GrpcParser(serviceLister, endpointsLister); shenyuMemoryConfigList.add(grpcParser.parse(ingress, coreV1Api)); - } else if (sofaEnabled) { - SofaParser sofaParser = new SofaParser(serviceLister, endpointsLister); - shenyuMemoryConfigList.add(sofaParser.parse(ingress, coreV1Api)); } else { DivideIngressParser divideIngressParser = new DivideIngressParser(serviceLister, endpointsLister); shenyuMemoryConfigList.add(divideIngressParser.parse(ingress, coreV1Api)); @@ -103,6 +98,11 @@ private boolean getBooleanAnnotation(final V1Ingress ingress, final String annot return Objects.nonNull(annotationValue) && Boolean.parseBoolean(annotationValue); } + private boolean hasContextPathAnnotation(final V1Ingress ingress) { + String annotationValue = ingress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_CONTEXT_PATH_PATH); + return Objects.nonNull(annotationValue) && !annotationValue.trim().isEmpty(); + } + private void contextPathParse(final V1Ingress ingress, final List shenyuMemoryConfigList, final CoreV1Api coreV1Api) { List rules = ingress.getSpec().getRules(); for (V1IngressRule rule : rules) { diff --git a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/SofaParser.java b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/SofaParser.java deleted file mode 100644 index aa7bf9c4cd6f..000000000000 --- a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/SofaParser.java +++ /dev/null @@ -1,320 +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.collections4.MapUtils; -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.dto.convert.rule.impl.SofaRuleHandle; -import org.apache.shenyu.common.enums.LoadBalanceEnum; -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.RpcTypeEnum; -import org.apache.shenyu.common.enums.SelectorTypeEnum; -import org.apache.shenyu.common.utils.GsonUtils; -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; - -/** - * Parser of Ingress Sofa Annotations. - */ -public class SofaParser implements K8sResourceParser { - - private static final Logger LOG = LoggerFactory.getLogger(SofaParser.class); - - private final Lister serviceLister; - - private final Lister endpointsLister; - - /** - * SofaIngressParser Constructor. - * - * @param serviceInformer serviceInformer - * @param endpointsInformer endpointsInformer - */ - public SofaParser(final Lister serviceInformer, final Lister endpointsInformer) { - this.serviceLister = serviceInformer; - this.endpointsLister = endpointsInformer; - } - - /** - * 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 sofa backend - V1IngressBackend sofaBackend = 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, sofaBackend become global default - if (Objects.nonNull(sofaBackend) && Objects.nonNull(sofaBackend.getService())) { - IngressConfiguration defaultRouteConfig = getSofaRouteConfig(ingress.getMetadata().getAnnotations()); - res.setGlobalDefaultBackend(Pair.of(Pair.of(namespace + "/" + ingress.getMetadata().getName(), sofaBackend.getService().getName()), - defaultRouteConfig)); - } - } else { - // if rules is not null, sofaBackend 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) { - if (Objects.nonNull(tls.getSecretName()) && Objects.nonNull(tls.getHosts()) && CollectionUtils.isNotEmpty(tls.getHosts())) { - try { - V1Secret secret = coreV1Api.readNamespacedSecret(tls.getSecretName(), namespace, "ture"); - Map secretData = secret.getData(); - if (MapUtils.isNotEmpty(secretData)) { - InputStream keyCertChainInputStream = new ByteArrayInputStream(secretData.get("tls.crt")); - InputStream keyInputStream = new ByteArrayInputStream(secretData.get("tls.key")); - tls.getHosts().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 = Objects.nonNull(ingressRule.getHost()) ? createHostCondition(ingressRule.getHost()) : null; - if (Objects.nonNull(ingressRule.getHttp())) { - List paths = ingressRule.getHttp().getPaths(); - if (Objects.nonNull(paths)) { - for (V1HTTPIngressPath path : paths) { - if (Objects.isNull(path.getPath())) { - continue; - } - OperatorEnum operator = getOperator(path.getPathType()); - ConditionData pathCondition = createPathCondition(path.getPath(), operator); - List conditionList = new ArrayList<>(2); - if (Objects.nonNull(hostCondition)) { - conditionList.add(hostCondition); - } - conditionList.add(pathCondition); - - SelectorData selectorData = createSelectorData(path.getPath(), conditionList); - List ruleDataList = new ArrayList<>(); - List metaDataList = new ArrayList<>(); - for (String label : labels.keySet()) { - Map metadataAnnotations = serviceLister.namespace(namespace).get(labels.get(label)).getMetadata().getAnnotations(); - SofaRuleHandle ruleHandle = createSofaRuleHandle(annotations); - List ruleConditionList = getRuleConditionList(metadataAnnotations); - RuleData ruleData = createRuleData(metadataAnnotations, ruleHandle, 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_SOFA_PATH)); - ruleConditionList.add(ruleCondition); - return ruleConditionList; - } - - private ConditionData createHostCondition(final String host) { - ConditionData hostCondition = new ConditionData(); - hostCondition.setParamType(ParamTypeEnum.DOMAIN.getName()); - hostCondition.setOperator(OperatorEnum.EQ.getAlias()); - hostCondition.setParamValue(host); - return hostCondition; - } - - private OperatorEnum getOperator(final String pathType) { - if ("ImplementationSpecific".equals(pathType)) { - return OperatorEnum.MATCH; - } else if ("Prefix".equals(pathType)) { - return OperatorEnum.STARTS_WITH; - } else if ("Exact".equals(pathType)) { - return OperatorEnum.EQ; - } else { - LOG.info("Invalid path type, set it with match operator"); - return OperatorEnum.MATCH; - } - } - - private ConditionData createPathCondition(final String path, final OperatorEnum operator) { - ConditionData pathCondition = new ConditionData(); - pathCondition.setOperator(operator.getAlias()); - pathCondition.setParamType(ParamTypeEnum.URI.getName()); - pathCondition.setParamValue(path); - return pathCondition; - } - - private SofaRuleHandle createSofaRuleHandle(final Map annotations) { - SofaRuleHandle sofaRuleHandle = new SofaRuleHandle(); - if (Objects.nonNull(annotations)) { - sofaRuleHandle.setLoadBalance(annotations.getOrDefault(IngressConstants.LOADBALANCER_ANNOTATION_KEY, LoadBalanceEnum.RANDOM.getName())); - sofaRuleHandle.setTimeout(Long.parseLong(annotations.getOrDefault(IngressConstants.TIMEOUT_ANNOTATION_KEY, "3000"))); - sofaRuleHandle.setRetries(Integer.parseInt(annotations.getOrDefault(IngressConstants.RETRY_ANNOTATION_KEY, "3"))); - } - return sofaRuleHandle; - } - - private SelectorData createSelectorData(final String path, final List conditionList) { - return SelectorData.builder() - .pluginId(String.valueOf(PluginEnum.SOFA.getCode())) - .pluginName(PluginEnum.SOFA.getName()) - .name(path) - .matchMode(MatchModeEnum.AND.getCode()) - .type(SelectorTypeEnum.CUSTOM_FLOW.getCode()) - .enabled(true) - .logged(false) - .continued(true) - .conditionList(conditionList) - .build(); - } - - private RuleData createRuleData(final Map metadataAnnotations, final SofaRuleHandle ruleHandle, final List ruleConditionList) { - return RuleData.builder() - .name(metadataAnnotations.get(IngressConstants.PLUGIN_SOFA_PATH)) - .pluginName(PluginEnum.SOFA.getName()) - .matchMode(MatchModeEnum.AND.getCode()) - .conditionDataList(ruleConditionList) - .handle(GsonUtils.getInstance().toJson(ruleHandle)) - .loged(true) - .enabled(true) - .build(); - } - - private MetaData parseMetaData(final Map annotations) { - return MetaData.builder() - .appName(annotations.get(IngressConstants.PLUGIN_SOFA_APP_NAME)) - .path(annotations.get(IngressConstants.PLUGIN_SOFA_PATH)) - .rpcType(annotations.get(IngressConstants.PLUGIN_SOFA_RPC_TYPE)) - .rpcExt(annotations.get(IngressConstants.PLUGIN_SOFA_RPC_EXPAND)) - .serviceName(annotations.get(IngressConstants.PLUGIN_SOFA_SERVICE_NAME)) - .methodName(annotations.get(IngressConstants.PLUGIN_SOFA_METHOD_NAME)) - .parameterTypes(annotations.get(IngressConstants.PLUGIN_SOFA_PARAMS_TYPE)) - .enabled(true) - .build(); - } - - private IngressConfiguration getSofaRouteConfig(final Map annotations) { - final ConditionData conditionData = new ConditionData(); - conditionData.setParamName("sofa"); - conditionData.setParamType(ParamTypeEnum.URI.getName()); - conditionData.setOperator(OperatorEnum.PATH_PATTERN.getAlias()); - conditionData.setParamValue("/**"); - - final SelectorData selectorData = SelectorData.builder() - .name("sofa-selector") - .sort(Integer.MAX_VALUE) - .conditionList(Collections.singletonList(conditionData)) - .enabled(true) - .id(IngressConstants.ID) - .pluginName(PluginEnum.SOFA.getName()) - .pluginId(String.valueOf(PluginEnum.SOFA.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.SOFA.getName()) - .name("sofa-rule") - .matchMode(MatchModeEnum.AND.getCode()) - .conditionDataList(Collections.singletonList(conditionData)) - .loged(false) - .enabled(true) - .sort(Integer.MAX_VALUE).build(); - - MetaData metaData = new MetaData(); - if (Objects.nonNull(annotations)) { - metaData.setAppName(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_APP_NAME, "sofa")); - metaData.setMethodName(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_METHOD_NAME, "methodName")); - metaData.setPath(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_PATH, "/sofa/findAll")); - metaData.setRpcType(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_RPC_TYPE, RpcTypeEnum.SOFA.getName())); - metaData.setServiceName(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_SERVICE_NAME, "findAll")); - metaData.setContextPath(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_CONTEXT_PATH, "/sofa")); - metaData.setRpcExt(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_RPC_EXT, "{\"loadbalance\":\"hash\",\"retries\":3,\"timeout\":-1}")); - metaData.setParameterTypes(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_PARAMETER_TYPE, "")); - metaData.setEnabled(Boolean.parseBoolean(annotations.getOrDefault(IngressConstants.PLUGIN_SOFA_ENABLED, "true"))); - } - 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..88e07ef79e5f 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 @@ -201,9 +201,6 @@ private void enablePluginsBasedOnAnnotations(final Map annotatio enablePlugin(shenyuCacheRepository, PluginEnum.WEB_SOCKET, null); } else if (Objects.equals(annotations.get(IngressConstants.PLUGIN_GRPC_ENABLED), "true")) { enablePlugin(shenyuCacheRepository, PluginEnum.GRPC, null); - } else if (Objects.equals(annotations.get(IngressConstants.PLUGIN_SOFA_ENABLED), "true")) { - String zookeeperUrl = getZookeeperUrl(annotations, request); - enablePlugin(shenyuCacheRepository, PluginEnum.SOFA, zookeeperUrl); } } @@ -219,9 +216,6 @@ private void doDeleteConfigByIngress(final Request request, final V1Ingress oldI selectorList = deleteSelectorByIngressName(request.getNamespace(), request.getName(), PluginEnum.WEB_SOCKET.getName(), ""); } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_GRPC_ENABLED), "true")) { selectorList = deleteSelectorByIngressName(request.getNamespace(), request.getName(), PluginEnum.GRPC.getName(), ""); - } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_SOFA_ENABLED), "true")) { - selectorList = deleteSelectorByIngressName(request.getNamespace(), request.getName(), PluginEnum.SOFA.getName(), - oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_SOFA_CONTEXT_PATH)); } else { selectorList = deleteSelectorByIngressName(request.getNamespace(), request.getName(), PluginEnum.DIVIDE.getName(), ""); } @@ -234,8 +228,6 @@ private void doDeleteConfigByIngress(final Request request, final V1Ingress oldI IngressSelectorCache.getInstance().remove(request.getNamespace(), request.getName(), PluginEnum.WEB_SOCKET.getName()); } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_GRPC_ENABLED), "true")) { IngressSelectorCache.getInstance().remove(request.getNamespace(), request.getName(), PluginEnum.GRPC.getName()); - } else if (Objects.equals(oldIngress.getMetadata().getAnnotations().get(IngressConstants.PLUGIN_SOFA_ENABLED), "true")) { - IngressSelectorCache.getInstance().remove(request.getNamespace(), request.getName(), PluginEnum.SOFA.getName()); } else { IngressSelectorCache.getInstance().remove(request.getNamespace(), request.getName(), PluginEnum.DIVIDE.getName()); } @@ -284,8 +276,6 @@ private String getPluginConfig(final PluginEnum pluginEnum, final String zookeep return "{\"registerProtocol\":\"zk\",\"registerAddress\":\"" + zookeeperUrl + "\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}"; case WEB_SOCKET: return "{multiSelectorHandle: 1}"; - case SOFA: - return "{\"protocol\":\"zookeeper\",\"register\":\"" + zookeeperUrl + "\",\"threadpool\":\"shared\"}"; case GRPC: return "{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}"; default: @@ -568,7 +558,6 @@ private String getPluginName(final V1Ingress ingress) { 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)) { @@ -577,8 +566,6 @@ private String getPluginName(final V1Ingress ingress) { pluginName = PluginEnum.WEB_SOCKET.getName(); } else if ((Boolean.TRUE.toString()).equals(pluginGrpcEnabled)) { pluginName = PluginEnum.GRPC.getName(); - } else if ((Boolean.TRUE.toString()).equals(pluginSofaEnabled)) { - pluginName = PluginEnum.SOFA.getName(); } else { pluginName = PluginEnum.DIVIDE.getName(); } diff --git a/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/parser/IngressParserTest.java b/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/parser/IngressParserTest.java new file mode 100644 index 000000000000..c891551a1a8a --- /dev/null +++ b/shenyu-kubernetes-controller/src/test/java/org/apache/shenyu/k8s/parser/IngressParserTest.java @@ -0,0 +1,159 @@ +/* + * 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.SharedIndexInformer; +import io.kubernetes.client.informer.cache.Indexer; +import io.kubernetes.client.openapi.apis.CoreV1Api; +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.V1IngressRuleBuilder; +import io.kubernetes.client.openapi.models.V1Service; +import org.apache.shenyu.common.enums.PluginEnum; +import org.apache.shenyu.k8s.common.IngressConstants; +import org.apache.shenyu.k8s.common.ShenyuMemoryConfig; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * Tests for {@link IngressParser}. + */ +public final class IngressParserTest { + + private SharedIndexInformer serviceInformer; + + private SharedIndexInformer endpointsInformer; + + private Indexer endpointsIndexer; + + private IngressParser ingressParser; + + @BeforeEach + @SuppressWarnings("unchecked") + public void setUp() { + serviceInformer = mock(SharedIndexInformer.class); + endpointsInformer = mock(SharedIndexInformer.class); + when(serviceInformer.getIndexer()).thenReturn(mock(Indexer.class)); + endpointsIndexer = mock(Indexer.class); + when(endpointsInformer.getIndexer()).thenReturn(endpointsIndexer); + ingressParser = new IngressParser(serviceInformer, endpointsInformer); + } + + @Test + public void parseShouldSkipContextPathConfigWhenSpecificPluginHasNoContextPathAnnotations() { + mockEndpoints("demo-ns", "demo-service"); + + V1Ingress ingress = new V1IngressBuilder() + .withNewMetadata() + .withName("demo-ingress") + .withNamespace("demo-ns") + .addToAnnotations(IngressConstants.K8S_INGRESS_CLASS_ANNOTATION_KEY, IngressConstants.SHENYU_INGRESS_CLASS) + .addToAnnotations(IngressConstants.PLUGIN_WEB_SOCKET_ENABLED, Boolean.TRUE.toString()) + .endMetadata() + .withNewSpec() + .withRules(new V1IngressRuleBuilder() + .withNewHttp() + .withPaths(new V1HTTPIngressPathBuilder() + .withPath("/ws") + .withPathType("Prefix") + .withNewBackend() + .withNewService() + .withName("demo-service") + .withNewPort() + .withNumber(8080) + .endPort() + .endService() + .endBackend() + .build()) + .endHttp() + .build()) + .endSpec() + .build(); + + List configs = ingressParser.parse(ingress, mock(CoreV1Api.class)); + + Assertions.assertEquals(1, configs.size()); + Assertions.assertEquals(PluginEnum.WEB_SOCKET.getName(), + configs.get(0).getRouteConfigList().get(0).getSelectorData().getPluginName()); + } + + @Test + public void parseShouldKeepExplicitContextPathConfig() { + mockEndpoints("demo-ns", "demo-service"); + + V1Ingress ingress = new V1IngressBuilder() + .withNewMetadata() + .withName("demo-ingress") + .withNamespace("demo-ns") + .addToAnnotations(IngressConstants.K8S_INGRESS_CLASS_ANNOTATION_KEY, IngressConstants.SHENYU_INGRESS_CLASS) + .addToAnnotations(IngressConstants.PLUGIN_CONTEXT_PATH_PATH, "/gateway") + .addToAnnotations(IngressConstants.PLUGIN_CONTEXT_PATH_ADD_PREFIX, "/backend") + .endMetadata() + .withNewSpec() + .withRules(new V1IngressRuleBuilder() + .withNewHttp() + .withPaths(new V1HTTPIngressPathBuilder() + .withPath("/gateway") + .withPathType("Prefix") + .withNewBackend() + .withNewService() + .withName("demo-service") + .withNewPort() + .withNumber(8080) + .endPort() + .endService() + .endBackend() + .build()) + .endHttp() + .build()) + .endSpec() + .build(); + + List configs = ingressParser.parse(ingress, mock(CoreV1Api.class)); + + Assertions.assertEquals(2, configs.size()); + Assertions.assertEquals(PluginEnum.CONTEXT_PATH.getName(), + configs.get(0).getRouteConfigList().get(0).getSelectorData().getPluginName()); + Assertions.assertEquals(PluginEnum.DIVIDE.getName(), + configs.get(1).getRouteConfigList().get(0).getSelectorData().getPluginName()); + } + + private void mockEndpoints(final String namespace, final String serviceName) { + V1Endpoints endpoints = new V1EndpointsBuilder() + .withNewMetadata() + .withNamespace(namespace) + .withName(serviceName) + .endMetadata() + .withSubsets(new V1EndpointSubsetBuilder() + .withAddresses(new V1EndpointAddress().ip("127.0.0.1")) + .build()) + .build(); + when(endpointsIndexer.getByKey(namespace + "/" + serviceName)).thenReturn(endpoints); + } +} diff --git a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/context/ShenyuContext.java b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/context/ShenyuContext.java index b421610942ea..00a36440571c 100644 --- a/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/context/ShenyuContext.java +++ b/shenyu-plugin/shenyu-plugin-api/src/main/java/org/apache/shenyu/plugin/api/context/ShenyuContext.java @@ -38,7 +38,7 @@ public class ShenyuContext implements Serializable { private String method; /** - * is rpcType data. now we only support "http","dubbo","sofa". + * is rpcType data. */ private String rpcType; 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..40bb5a505ce8 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 @@ -87,11 +87,6 @@ public enum ShenyuResultEnum { */ DUBBO_HAVE_BODY_PARAM(431, "Dubbo must have body param, please enter the JSON format in the body!"), - /** - * Sofa have body param shenyu result enum. - */ - SOFA_HAVE_BODY_PARAM(432, "Sofa must have body param, please enter the JSON format in the body!"), - /** * Tars have body param shenyu result enum. */ 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..2e7e8d920d66 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml @@ -31,7 +31,6 @@ 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..dafdc3b633db 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.MOTAN, RpcTypeEnum.TARS); } } diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/test/java/org/apache/shenyu/plugin/general/context/GeneralContextPluginTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/test/java/org/apache/shenyu/plugin/general/context/GeneralContextPluginTest.java index 105348f8dba8..f9e2eb7f22d8 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/test/java/org/apache/shenyu/plugin/general/context/GeneralContextPluginTest.java +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-general-context/src/test/java/org/apache/shenyu/plugin/general/context/GeneralContextPluginTest.java @@ -104,7 +104,7 @@ public void testDoExecute() { assertEquals(shenyuGeneralContext.get("addGeneralContextKey"), "addGeneralContextValue"); assertEquals(shenyuGeneralContext.get("shenyuTestHeaderNewKey"), "shenyuTestHeaderValue"); - shenyuGeneralContext = ((Map>) newExchange.getValue().getAttributes().get(Constants.GENERAL_CONTEXT)).get(PluginEnum.SOFA.getName()); + shenyuGeneralContext = ((Map>) newExchange.getValue().getAttributes().get(Constants.GENERAL_CONTEXT)).get(PluginEnum.TARS.getName()); assertNull(shenyuGeneralContext); } 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 index 196d56af6daf..41a62df29e8b 100644 --- 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 @@ -57,7 +57,7 @@ public void setup() { exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); metaData = new MetaData(); metaData.setId("1332017966661636096"); - metaData.setAppName("sofa"); + metaData.setAppName("motan"); metaData.setPath("/motan/findAll"); metaData.setServiceName("org.apache.shenyu.test.motan.api.service.MotanTestService"); metaData.setMethodName("findAll"); diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/pom.xml b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/pom.xml deleted file mode 100644 index 26d8ec059b7b..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-plugin-rpc - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-plugin-sofa - - - - com.alipay.sofa - sofa-rpc-all - provided - - - - io.grpc - grpc-core - ${grpc.version} - - - - grpc-api - io.grpc - ${grpc.version} - - - diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/SofaPlugin.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/SofaPlugin.java deleted file mode 100644 index 11bd95edb177..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/SofaPlugin.java +++ /dev/null @@ -1,133 +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.sofa; - -import com.alipay.sofa.rpc.context.RpcInvokeContext; -import java.util.Objects; -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.sofa.proxy.SofaProxyService; -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.Map; -import java.util.Optional; - -/** - * The sofa plugin. - */ -public class SofaPlugin extends AbstractShenyuPlugin { - - private static final Logger LOG = LoggerFactory.getLogger(SofaPlugin.class); - - private final SofaProxyService sofaProxyService; - - /** - * Instantiates a new Sofa plugin. - * - * @param sofaProxyService the sofa proxy service - */ - public SofaPlugin(final SofaProxyService sofaProxyService) { - this.sofaProxyService = sofaProxyService; - } - - @Override - protected String getRawPath(final ServerWebExchange exchange) { - return RequestUrlUtils.getRewrittenRawPath(exchange); - } - - @Override - 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.SOFA_HAVE_BODY_PARAM); - return WebFluxResultUtils.result(exchange, error); - } - Map> rpcContext = exchange.getAttribute(Constants.GENERAL_CONTEXT); - Optional.ofNullable(rpcContext).map(context -> context.get(PluginEnum.SOFA.getName())).ifPresent(context -> RpcInvokeContext.getContext().putAllRequestBaggage(context)); - final Mono result = sofaProxyService.genericInvoker(param, metaData, selector, exchange); - return result.then(chain.execute(exchange)); - } - - /** - * acquire plugin name. - * - * @return plugin name. - */ - @Override - public String named() { - return PluginEnum.SOFA.getName(); - } - - /** - * plugin is execute. - * - * @param exchange the current server exchange - * @return default false. - */ - @Override - public boolean skip(final ServerWebExchange exchange) { - return skipExcept(exchange, RpcTypeEnum.SOFA); - } - - @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.SOFA.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-sofa/src/main/java/org/apache/shenyu/plugin/sofa/cache/ApplicationConfigCache.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/cache/ApplicationConfigCache.java deleted file mode 100644 index 1f9195668eb3..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/cache/ApplicationConfigCache.java +++ /dev/null @@ -1,529 +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.sofa.cache; - -import com.alipay.sofa.rpc.api.GenericService; -import com.alipay.sofa.rpc.common.RpcConstants; -import com.alipay.sofa.rpc.config.ApplicationConfig; -import com.alipay.sofa.rpc.config.ConsumerConfig; -import com.alipay.sofa.rpc.config.RegistryConfig; -import com.alipay.sofa.rpc.context.AsyncRuntime; -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 org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.reflect.FieldUtils; -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.convert.plugin.SofaRegisterConfig; -import org.apache.shenyu.common.dto.convert.selector.SofaUpstream; -import org.apache.shenyu.common.enums.LoadBalanceEnum; -import org.apache.shenyu.common.exception.ShenyuException; -import org.apache.shenyu.common.utils.DigestUtils; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.plugin.api.utils.SpringBeanUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.lang.NonNull; -import org.springframework.util.ReflectionUtils; - -import java.lang.reflect.Field; - -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.concurrent.LinkedBlockingQueue; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -/** - * The type Application config cache. - */ -public final class ApplicationConfigCache { - - private static final Logger LOG = LoggerFactory.getLogger(ApplicationConfigCache.class); - - private static final Map UPSTREAM_CACHE_MAP = Maps.newConcurrentMap(); - - private final ThreadFactory factory = ShenyuThreadFactory.create("shenyu-sofa", true); - - private ApplicationConfig applicationConfig; - - private RegistryConfig registryConfig; - - private ThreadPoolExecutor threadPool; - - private final LoadingCache> cache = CacheBuilder.newBuilder() - .maximumSize(Constants.CACHE_MAX_COUNT) - .removalListener(notification -> { - if (Objects.nonNull(notification.getValue())) { - try { - Class cz = notification.getValue().getClass(); - final Field field = FieldUtils.getDeclaredField(cz, "consumerBootstrap", true); - FieldUtils.writeField(field, notification.getValue(), null); - // After the configuration change, sofa 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 (IllegalAccessException e) { - LOG.error("modify ref have exception", e); - } - } - }) - .build(new CacheLoader<>() { - - @Override - @NonNull - public ConsumerConfig load(@NonNull final String key) { - return new ConsumerConfig<>(); - } - }); - - private ApplicationConfigCache() { - } - - /** - * Gets instance. - * - * @return the instance - */ - public static ApplicationConfigCache getInstance() { - return ApplicationConfigCacheInstance.INSTANCE; - } - - /** - * Init. - * - * @param sofaRegisterConfig the sofa register config - */ - public void init(final SofaRegisterConfig sofaRegisterConfig) { - final String shenyuProxy = "shenyu_proxy"; - if (Objects.isNull(applicationConfig)) { - applicationConfig = new ApplicationConfig(); - applicationConfig.setAppId(shenyuProxy); - applicationConfig.setAppName(shenyuProxy); - } - if (Objects.isNull(registryConfig)) { - registryConfig = new RegistryConfig(); - registryConfig.setId(shenyuProxy); - registryConfig.setRegister(false); - - } - registryConfig.setProtocol(sofaRegisterConfig.getProtocol()); - registryConfig.setAddress(sofaRegisterConfig.getRegister()); - if (StringUtils.isNotBlank(sofaRegisterConfig.getThreadpool())) { - initThreadPool(sofaRegisterConfig); - Optional.ofNullable(threadPool).ifPresent(this::setAsyncRuntimeThreadPool); - } - } - - /** - * Set sofa asyncRuntime thread pool. - */ - private void setAsyncRuntimeThreadPool(final ThreadPoolExecutor threadPool) { - Field field = ReflectionUtils.findField(AsyncRuntime.class, "asyncThreadPool"); - ReflectionUtils.makeAccessible(field); - ReflectionUtils.setField(field, AsyncRuntime.class, threadPool); - } - - /** - * Init thread pool. - */ - private void initThreadPool(final SofaRegisterConfig config) { - if (Objects.nonNull(threadPool)) { - return; - } - switch (config.getThreadpool()) { - 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: - 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); - return; - default: - } - } - - /** - * Init ref reference config. - * - * @param metaData the meta data - * @return the reference config - */ - public ConsumerConfig initRef(final MetaData metaData) { - try { - ConsumerConfig referenceConfig = cache.get(metaData.getPath()); - if (StringUtils.isNoneBlank(referenceConfig.getInterfaceId())) { - return referenceConfig; - } - } catch (ExecutionException e) { - LOG.error("init sofa ref ex:{}", e.getMessage()); - } - return build(metaData); - - } - - /** - * Init ref reference config use sofaUpstream. - * - * @param selectorId the selectorId - * @param metaData the meta data - * @param sofaUpstream the sofaUpstream - * @return the reference config - */ - public ConsumerConfig initRef(final String selectorId, final MetaData metaData, final SofaUpstream sofaUpstream) { - try { - String cacheKey = generateUpstreamCacheKey(selectorId, metaData.getPath(), sofaUpstream); - ConsumerConfig referenceConfig = cache.get(cacheKey); - if (StringUtils.isNoneBlank(referenceConfig.getInterfaceId())) { - return referenceConfig; - } - } catch (ExecutionException e) { - LOG.error("init sofa ref ex:{}", e.getMessage()); - } - return build(metaData, selectorId, sofaUpstream); - - } - - /** - * generate sofa upstream reference cache key. - * - * @param selectorId selectorId - * @param metaDataPath metaDataPath - * @param sofaUpstream sofaUpstream - * @return the reference config cache key - */ - public String generateUpstreamCacheKey(final String selectorId, final String metaDataPath, final SofaUpstream sofaUpstream) { - StringJoiner stringJoiner = new StringJoiner(Constants.SEPARATOR_UNDERLINE); - stringJoiner.add(selectorId); - stringJoiner.add(metaDataPath); - if (StringUtils.isNotBlank(sofaUpstream.getProtocol())) { - stringJoiner.add(sofaUpstream.getProtocol()); - } - // use registry hash to short reference cache key - String registryHash = DigestUtils.md5Hex(sofaUpstream.getRegister()); - stringJoiner.add(registryHash); - return stringJoiner.toString(); - } - - - - /** - * Build reference config. - * - * @param metaData the meta data - * @return the reference config - */ - public ConsumerConfig build(final MetaData metaData) { - if (Objects.isNull(applicationConfig) || Objects.isNull(registryConfig)) { - return new ConsumerConfig<>(); - } - ConsumerConfig reference = buildReference(metaData); - try { - Object obj = reference.refer(); - if (Objects.nonNull(obj)) { - LOG.info("init sofa reference success there meteData is :{}", metaData); - cache.put(metaData.getPath(), reference); - } - } catch (Exception e) { - LOG.error("init sofa reference exception", e); - } - return reference; - } - - /** - * build with dynamic namespace and selectorData's SofaUpstream、ruleData's custom param. - * - * @param metaData metaData - * @param selectorId selectorId - * @param sofaUpstream sofaUpstream - * @return the reference config - */ - @SuppressWarnings("deprecation") - public ConsumerConfig build(final MetaData metaData, final String selectorId, final SofaUpstream sofaUpstream) { - if (Objects.isNull(sofaUpstream)) { - return this.build(metaData); - } - - ConsumerConfig reference = buildReference(metaData, sofaUpstream); - try { - Object obj = reference.refer(); - if (Objects.nonNull(obj)) { - LOG.info("buildN init apache sofa reference success there meteData is :{}", metaData); - String cacheKey = this.generateUpstreamCacheKey(selectorId, metaData.getPath(), sofaUpstream); - cache.put(cacheKey, reference); - } - } catch (Exception e) { - LOG.error("buildN init sofa reference exception", e); - } - return reference; - } - - /** - * buildReference param. - * - * @param metaData metaData - * @return the reference config - */ - private ConsumerConfig buildReference(final MetaData metaData) { - ConsumerConfig reference = new ConsumerConfig<>(); - reference.setGeneric(true); - reference.setApplication(applicationConfig); - reference.setRegistry(registryConfig); - reference.setInterfaceId(metaData.getServiceName()); - reference.setProtocol(RpcConstants.PROTOCOL_TYPE_BOLT); - reference.setInvokeType(RpcConstants.INVOKER_TYPE_CALLBACK); - reference.setRepeatedReferLimit(-1); - String rpcExt = metaData.getRpcExt(); - SofaParamExtInfo sofaParamExtInfo = GsonUtils.getInstance().fromJson(rpcExt, SofaParamExtInfo.class); - if (Objects.nonNull(sofaParamExtInfo)) { - if (StringUtils.isNoneBlank(sofaParamExtInfo.getLoadbalance())) { - final String loadBalance = sofaParamExtInfo.getLoadbalance(); - reference.setLoadBalancer(buildLoadBalanceName(loadBalance)); - } - Optional.ofNullable(sofaParamExtInfo.getTimeout()).ifPresent(reference::setTimeout); - Optional.ofNullable(sofaParamExtInfo.getRetries()).ifPresent(reference::setRetries); - } - return reference; - } - - /** - * buildReference param with sofaUpstream. - * - * @param metaData metaData - * @param sofaUpstream sofaUpstream - * @return the reference config - */ - private ConsumerConfig buildReference(final MetaData metaData, final SofaUpstream sofaUpstream) { - if (Objects.isNull(applicationConfig) || Objects.isNull(registryConfig)) { - return new ConsumerConfig<>(); - } - ConsumerConfig reference = new ConsumerConfig<>(); - reference.setGeneric(true); - reference.setApplication(applicationConfig); - - if (Objects.nonNull(sofaUpstream)) { - RegistryConfig registryConfigTemp = new RegistryConfig(); - registryConfigTemp.setProtocol(sofaUpstream.getProtocol()); - registryConfigTemp.setId(Constants.SOFA_DEFAULT_APPLICATION_NAME); - registryConfigTemp.setRegister(false); - registryConfigTemp.setAddress(sofaUpstream.getRegister()); - reference.setRegistry(registryConfigTemp); - } else { - reference.setRegistry(registryConfig); - } - - reference.setInterfaceId(metaData.getServiceName()); - reference.setProtocol(RpcConstants.PROTOCOL_TYPE_BOLT); - reference.setInvokeType(RpcConstants.INVOKER_TYPE_CALLBACK); - reference.setRepeatedReferLimit(-1); - String rpcExt = metaData.getRpcExt(); - SofaParamExtInfo sofaParamExtInfo = GsonUtils.getInstance().fromJson(rpcExt, SofaParamExtInfo.class); - if (Objects.nonNull(sofaParamExtInfo)) { - if (StringUtils.isNoneBlank(sofaParamExtInfo.getLoadbalance())) { - final String loadBalance = sofaParamExtInfo.getLoadbalance(); - reference.setLoadBalancer(buildLoadBalanceName(loadBalance)); - } - Optional.ofNullable(sofaParamExtInfo.getTimeout()).ifPresent(reference::setTimeout); - Optional.ofNullable(sofaParamExtInfo.getRetries()).ifPresent(reference::setRetries); - } - return reference; - } - - private String buildLoadBalanceName(final String loadBalance) { - if (LoadBalanceEnum.HASH.getName().equals(loadBalance) || StringUtils.equalsIgnoreCase("consistenthash", loadBalance)) { - return "consistentHash"; - } - if (LoadBalanceEnum.ROUND_ROBIN.getName().equals(loadBalance) || StringUtils.equalsIgnoreCase("roundrobin", loadBalance)) { - return "roundRobin"; - } - return loadBalance; - } - - /** - * Get reference config. - * - * @param path path - * @return the reference config - */ - public ConsumerConfig get(final String path) { - try { - return cache.get(path); - } catch (ExecutionException e) { - throw new ShenyuException(e.getCause()); - } - } - - /** - * Get Upstream. - * - * @param path path - * @return the upstream - */ - public SofaUpstream getUpstream(final String path) { - return UPSTREAM_CACHE_MAP.get(path); - } - - /** - * Put Upstream. - * - * @param path path - * @param sofaUpstream sofaUpstream - * @return the upstreamList - */ - public SofaUpstream putUpstream(final String path, final SofaUpstream sofaUpstream) { - return UPSTREAM_CACHE_MAP.put(path, sofaUpstream); - } - - /** - * Invalidate. - * - * @param path the path name - */ - public void invalidate(final String path) { - cache.invalidate(path); - } - - /** - * Invalidate all. - */ - public void invalidateAll() { - cache.invalidateAll(); - UPSTREAM_CACHE_MAP.clear(); - } - - /** - * Invalidate when sofa metadata update. - * - * @param metadataPath the 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); - needInvalidateKeys.forEach(UPSTREAM_CACHE_MAP::remove); - } - - /** - * Invalidate when sofa selector update. - * - * @param selectorId the 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); - needInvalidateKeys.forEach(UPSTREAM_CACHE_MAP::remove); - } - - /** - * get thread pool, just for integrated test. - * - * @return the thread pool - */ - public ThreadPoolExecutor getThreadPool() { - return threadPool; - } - - /** - * The type Application config cache instance. - */ - static final class ApplicationConfigCacheInstance { - - /** - * The Instance. - */ - static final ApplicationConfigCache INSTANCE = new ApplicationConfigCache(); - - private ApplicationConfigCacheInstance() { - - } - - } - - /** - * The type Sofa param ext info. - */ - static class SofaParamExtInfo { - - private String loadbalance; - - private Integer retries; - - private Integer timeout; - - public String getLoadbalance() { - return loadbalance; - } - - public void setLoadbalance(final String loadbalance) { - this.loadbalance = loadbalance; - } - - public Integer getRetries() { - return retries; - } - - public void setRetries(final Integer retries) { - this.retries = retries; - } - - public Integer getTimeout() { - return timeout; - } - - public void setTimeout(final Integer timeout) { - this.timeout = timeout; - } - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/context/SofaShenyuContextDecorator.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/context/SofaShenyuContextDecorator.java deleted file mode 100644 index ee668021e498..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/context/SofaShenyuContextDecorator.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.sofa.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 Sofa shenyu context decorator. - */ -public class SofaShenyuContextDecorator 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.SOFA.getName()); - return shenyuContext; - } - - @Override - public String rpcType() { - return RpcTypeEnum.SOFA.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandler.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandler.java deleted file mode 100644 index a318780d191d..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandler.java +++ /dev/null @@ -1,63 +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.sofa.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.sofa.cache.ApplicationConfigCache; - -import java.util.Objects; -import java.util.concurrent.ConcurrentMap; - -/** - * The sofa metadata handler. - */ -public class SofaMetaDataHandler implements MetaDataHandler { - - private static final ConcurrentMap META_DATA = Maps.newConcurrentMap(); - - @Override - public void handle(final MetaData metaData) { - MetaData exist = META_DATA.get(metaData.getPath()); - if (Objects.isNull(exist) || Objects.isNull(ApplicationConfigCache.getInstance().get(exist.getPath()).refer())) { - // The first initialization - ApplicationConfigCache.getInstance().initRef(metaData); - } else { - if (!exist.getServiceName().equals(metaData.getServiceName()) || !exist.getRpcExt().equals(metaData.getRpcExt())) { - // remove old upstream reference - ApplicationConfigCache.getInstance().invalidateWithMetadataPath(metaData.getPath()); - // update - ApplicationConfigCache.getInstance().build(metaData); - } - } - META_DATA.put(metaData.getPath(), metaData); - } - - @Override - public void remove(final MetaData metaData) { - ApplicationConfigCache.getInstance().invalidateWithMetadataPath(metaData.getPath()); - META_DATA.remove(metaData.getPath()); - } - - @Override - public String rpcType() { - return RpcTypeEnum.SOFA.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaPluginDataHandler.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaPluginDataHandler.java deleted file mode 100644 index 926804616298..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/handler/SofaPluginDataHandler.java +++ /dev/null @@ -1,77 +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.sofa.handler; - -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.plugin.SofaRegisterConfig; -import org.apache.shenyu.common.dto.PluginData; -import org.apache.shenyu.common.dto.convert.selector.SofaUpstream; -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.sofa.cache.ApplicationConfigCache; - -import java.util.Objects; - -/** - * The type sofa plugin data handler. - */ -public class SofaPluginDataHandler implements PluginDataHandler { - - @Override - public void handlerPlugin(final PluginData pluginData) { - if (Objects.nonNull(pluginData) && pluginData.getEnabled()) { - SofaRegisterConfig sofaRegisterConfig = GsonUtils.getInstance().fromJson(pluginData.getConfig(), SofaRegisterConfig.class); - if (Objects.isNull(sofaRegisterConfig)) { - return; - } - SofaRegisterConfig exist = Singleton.INST.get(SofaRegisterConfig.class); - if (Objects.isNull(exist) || !sofaRegisterConfig.equals(exist)) { - // If it is null, initialize it - ApplicationConfigCache.getInstance().init(sofaRegisterConfig); - ApplicationConfigCache.getInstance().invalidateAll(); - } - Singleton.INST.single(SofaRegisterConfig.class, sofaRegisterConfig); - } - } - - @Override - public void handlerSelector(final SelectorData selectorData) { - SofaUpstream nCacheUpstreams = GsonUtils.getInstance().fromJson(selectorData.getHandle(), SofaUpstream.class); - SofaUpstream oCacheUpstream = ApplicationConfigCache.getInstance().getUpstream(selectorData.getId()); - if (!Objects.equals(nCacheUpstreams, oCacheUpstream)) { - ApplicationConfigCache.getInstance().invalidateWithSelectorId(selectorData.getId()); - } - } - - @Override - public void removePlugin(final PluginData pluginData) { - ApplicationConfigCache.getInstance().invalidateAll(); - } - - @Override - public void removeSelector(final SelectorData selectorData) { - ApplicationConfigCache.getInstance().invalidateWithSelectorId(selectorData.getId()); - } - - @Override - public String pluginNamed() { - return PluginEnum.SOFA.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/param/SofaParamResolveService.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/param/SofaParamResolveService.java deleted file mode 100644 index b79ebb4e49f8..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/param/SofaParamResolveService.java +++ /dev/null @@ -1,39 +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.sofa.param; - -import org.apache.commons.lang3.tuple.Pair; -import org.springframework.lang.NonNull; - -/** - * The interface Generic param service. - * This service is used to construct the parameters required for the sofa generalization. - */ -public interface SofaParamResolveService { - - /** - * Build parameter pair. - * this is Resolve http body to get dubbo param. - * - * @param body the body - * @param parameterTypes the parameter types - * @return the pair - */ - @NonNull - Pair buildParameter(String body, String parameterTypes); -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/param/SofaParamResolveServiceImpl.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/param/SofaParamResolveServiceImpl.java deleted file mode 100644 index fc8981ed517f..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/param/SofaParamResolveServiceImpl.java +++ /dev/null @@ -1,155 +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.sofa.param; - -import com.alipay.hessian.generic.model.GenericCollection; -import com.alipay.hessian.generic.model.GenericMap; -import com.alipay.hessian.generic.model.GenericObject; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -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.utils.GsonUtils; -import org.apache.shenyu.common.utils.ParamCheckUtils; -import org.springframework.lang.NonNull; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * The type Default generic param resolve service. - */ -public class SofaParamResolveServiceImpl implements SofaParamResolveService { - - @Override - @NonNull - public Pair buildParameter(final String body, final String parameterTypes) { - final String[] parameterTypeStrings = StringUtils.split(parameterTypes, ","); - List parameterTypeArr = new ArrayList<>(parameterTypeStrings.length); - List values = new ArrayList<>(); - final List params = new ArrayList<>(GsonUtils.getInstance().toObjectMap(body).values()); - for (int paramIndex = 0; paramIndex < parameterTypeStrings.length; paramIndex++) { - ParamCheckUtils.checkParamsLength(params.size(), parameterTypeStrings.length); - final String[] parameter = StringUtils.split(parameterTypeStrings[paramIndex], "#"); - parameterTypeArr.add(parameter[0]); - values.add(convertToParameterValue(params.get(paramIndex), parameter)); - } - return new ImmutablePair<>(parameterTypeArr.toArray(new String[0]), values.toArray()); - } - - /** - * convert to parameter value. - * - * @param value value support [json object string, json array string,string] - * @param parameterType parameter type support [javaPackage.ClassName#GenericType1#GenericType2], split is , - * @return GenericObject, GenericMap, List, string, array... - * @see com.alipay.hessian.generic.model - */ - @SuppressWarnings("all") - private Object convertToParameterValue(final Object value, final String[] parameterType) { - if (isSingleType(parameterType)) { - return value; - } - if (value instanceof JsonObject && parameterType[0].contains("Map")) { - final Map mapValue = GsonUtils.getInstance().convertToMap(value.toString()); - if (parameterType.length == 1) { - // no generic info - return mapValue; - } - Assert.state(parameterType.length == 3, "parameterType length must be 3."); - // generic map - final GenericMap genericMap = new GenericMap(parameterType[2]); - mapValue.replaceAll((k, v) -> convertToGenericObject(parameterType[2], mapValue.get(k))); - genericMap.setMap(mapValue); - return genericMap; - } - if (value instanceof JsonObject) { - return convertToGenericObject(parameterType[0], value); - } - if (value instanceof JsonArray) { - if (parameterType.length == 1) { - // no generic info - return GsonUtils.getInstance().fromList(value.toString(), Object.class); - } - // generic collection - final GenericCollection genericCollection = new GenericCollection(parameterType[1]); - genericCollection.setCollection(convertToGenericObjects(parameterType[1], (Iterable) value)); - return genericCollection; - } - return value; - } - - /** - * convert json object to {@link GenericObject}. - * - * @param paramType param type string - * @param paramValue param value (if is object, auto to convert string) - * @return {@link GenericObject},if is single customize type return paramValue - * @see GenericObject - * @see #isSingleType(String) - */ - private static Object convertToGenericObject(final String paramType, final Object paramValue) { - if (isSingleType(paramType)) { - return paramValue; - } - final Map mapValue = GsonUtils.getInstance().convertToMap(paramValue.toString()); - GenericObject genericObject = new GenericObject(paramType); - mapValue.forEach(genericObject::putField); - return genericObject; - } - - /** - * Convert to GenericObject. - * - * @param type generic type. - * @param params actual parameters. - * @return list of GenericObject. - */ - private static List convertToGenericObjects(final String type, final Iterable params) { - List list = new ArrayList<>(); - for (Object param : params) { - list.add(convertToGenericObject(type, param)); - } - return list; - } - - /** - * only one parameter which is customized type. - * - * @param parameter parameter array. - * @return only one parameter and it's customized type return true otherwise return false. - */ - private static boolean isSingleType(final String[] parameter) { - return parameter.length == 1 && isSingleType(parameter[0]); - } - - /** - * is single type.
- * single type is package[java.xxx or [Ljava.xxx] - * - * @param parameterType parameter type. - * @return type is single type - */ - private static boolean isSingleType(final String parameterType) { - return parameterType.startsWith("java"); - } - -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyService.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyService.java deleted file mode 100644 index 91895cc5332b..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyService.java +++ /dev/null @@ -1,138 +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.sofa.proxy; - -import com.alipay.hessian.generic.model.GenericObject; -import com.alipay.sofa.rpc.api.GenericService; -import com.alipay.sofa.rpc.config.ConsumerConfig; -import com.alipay.sofa.rpc.context.RpcInvokeContext; -import com.alipay.sofa.rpc.core.exception.SofaRpcException; -import com.alipay.sofa.rpc.core.invoke.SofaResponseCallback; -import com.alipay.sofa.rpc.core.request.RequestBase; -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.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.selector.SofaUpstream; -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.plugin.sofa.cache.ApplicationConfigCache; -import org.apache.shenyu.plugin.sofa.param.SofaParamResolveService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; - -import java.util.Objects; -import java.util.concurrent.CompletableFuture; - -/** - * sofa proxy service is use GenericService. - */ -public class SofaProxyService { - - private static final Logger LOG = LoggerFactory.getLogger(SofaProxyService.class); - - private final SofaParamResolveService sofaParamResolveService; - - /** - * Instantiates a new Sofa proxy service. - * - * @param sofaParamResolveService the sofa param resolve service - */ - public SofaProxyService(final SofaParamResolveService sofaParamResolveService) { - this.sofaParamResolveService = sofaParamResolveService; - } - - /** - * Generic invoker object. - * - * @param body the body - * @param metaData the meta data - * @param selectorData the selector data - * @param exchange the webExchange - * @return the object - * @throws ShenyuException the shenyu exception - */ - public Mono genericInvoker(final String body, final MetaData metaData, final SelectorData selectorData, final ServerWebExchange exchange) throws ShenyuException { - ConsumerConfig reference = this.getConsumerConfig(selectorData, metaData, exchange); - Pair pair; - if (StringUtils.isBlank(metaData.getParameterTypes()) || ParamCheckUtils.bodyIsEmpty(body)) { - pair = new ImmutablePair<>(new String[]{}, new Object[]{}); - } else { - pair = sofaParamResolveService.buildParameter(body, metaData.getParameterTypes()); - } - CompletableFuture future = new CompletableFuture<>(); - RpcInvokeContext.getContext().setResponseCallback(new SofaResponseCallback<>() { - @Override - public void onAppResponse(final Object o, final String s, final RequestBase requestBase) { - future.complete(o); - } - - @Override - public void onAppException(final Throwable throwable, final String s, final RequestBase requestBase) { - future.completeExceptionally(throwable); - } - - @Override - public void onSofaException(final SofaRpcException e, final String s, final RequestBase requestBase) { - future.completeExceptionally(e); - } - }); - GenericService genericService = reference.refer(); - genericService.$genericInvoke(metaData.getMethodName(), pair.getLeft(), pair.getRight()); - return Mono.fromFuture(future.thenApply(ret -> { - Object result = ret; - if (Objects.isNull(result)) { - result = Constants.SOFA_RPC_RESULT_EMPTY; - } - - GenericObject genericObject = (GenericObject) result; - exchange.getAttributes().put(Constants.RPC_RESULT, genericObject.getFields()); - exchange.getAttributes().put(Constants.CLIENT_RESPONSE_RESULT_TYPE, ResultEnum.SUCCESS.getName()); - return result; - })).onErrorMap(ShenyuException::new); - } - - private ConsumerConfig getConsumerConfig(final SelectorData selectorData, final MetaData metaData, final ServerWebExchange exchange) { - String referenceKey = metaData.getPath(); - SofaUpstream sofaUpstream = GsonUtils.getInstance().fromJson(selectorData.getHandle(), SofaUpstream.class); - // if sofaUpstreams is empty, use default plugin config - if (Objects.isNull(sofaUpstream)) { - ConsumerConfig reference = ApplicationConfigCache.getInstance().get(referenceKey); - if (StringUtils.isEmpty(reference.getInterfaceId())) { - ApplicationConfigCache.getInstance().invalidate(referenceKey); - reference = ApplicationConfigCache.getInstance().initRef(metaData); - } - return reference; - } - referenceKey = ApplicationConfigCache.getInstance().generateUpstreamCacheKey(selectorData.getId(), metaData.getPath(), sofaUpstream); - ConsumerConfig reference = ApplicationConfigCache.getInstance().get(referenceKey); - if (StringUtils.isEmpty(reference.getInterfaceId())) { - ApplicationConfigCache.getInstance().invalidate(referenceKey); - reference = ApplicationConfigCache.getInstance().initRef(selectorData.getId(), metaData, sofaUpstream); - ApplicationConfigCache.getInstance().putUpstream(referenceKey, sofaUpstream); - } - return reference; - } - -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/SofaPluginTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/SofaPluginTest.java deleted file mode 100644 index 3f7b2d951980..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/SofaPluginTest.java +++ /dev/null @@ -1,148 +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.sofa; - -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.DefaultShenyuResult; -import org.apache.shenyu.plugin.api.result.ShenyuResult; -import org.apache.shenyu.plugin.api.utils.SpringBeanUtils; -import org.apache.shenyu.plugin.sofa.proxy.SofaProxyService; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.junit.jupiter.MockitoSettings; -import org.mockito.quality.Strictness; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.mock.http.server.reactive.MockServerHttpRequest; -import org.springframework.mock.web.server.MockServerWebExchange; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * SofaPluginTest. - */ -@ExtendWith(MockitoExtension.class) -@MockitoSettings(strictness = Strictness.LENIENT) -public final class SofaPluginTest { - private SofaPlugin sofaPlugin; - - private MetaData metaData; - - private ServerWebExchange exchange; - - @Mock - private ShenyuPluginChain chain; - - @BeforeEach - public void setUp() { - exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); - metaData = new MetaData(); - metaData.setId("1332017966661636096"); - metaData.setAppName("sofa"); - metaData.setPath("/sofa/findAll"); - metaData.setServiceName("org.apache.shenyu.test.dubbo.api.service.DubboTestService"); - metaData.setMethodName("findAll"); - metaData.setRpcType(RpcTypeEnum.SOFA.getName()); - SofaProxyService sofaProxyService = mock(SofaProxyService.class); - when(sofaProxyService.genericInvoker(eq(null), eq(metaData), any(), eq(exchange))).thenReturn(Mono.empty()); - sofaPlugin = new SofaPlugin(sofaProxyService); - } - - @Test - public void testSofaPlugin() { - RuleData data = mock(RuleData.class); - ShenyuContext context = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, context); - exchange.getAttributes().put(Constants.META_DATA, metaData); - when(chain.execute(exchange)).thenReturn(Mono.empty()); - SelectorData selectorData = mock(SelectorData.class); - StepVerifier.create(sofaPlugin.doExecute(exchange, chain, selectorData, data)).expectSubscription().verifyComplete(); - - metaData.setParameterTypes("parameterTypes"); - StepVerifier.create(sofaPlugin.doExecute(exchange, chain, selectorData, data)).expectSubscription().verifyComplete(); - } - - @Test - public void testSofaPlugin2() { - ShenyuContext context = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, context); - exchange.getAttributes().put(Constants.META_DATA, metaData); - when(chain.execute(exchange)).thenReturn(Mono.empty()); - SelectorData selectorData = mock(SelectorData.class); - metaData.setParameterTypes(null); - metaData.setMethodName(null); - RuleData data = mock(RuleData.class); - StepVerifier.create(sofaPlugin.doExecute(exchange, chain, selectorData, data)).expectSubscription().verifyComplete(); - } - - @Test - public void testNamed() { - final String result = sofaPlugin.named(); - assertEquals(PluginEnum.SOFA.getName(), result); - } - - @Test - public void testSkip() { - final ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); - ShenyuContext context = mock(ShenyuContext.class); - when(context.getRpcType()).thenReturn(RpcTypeEnum.SOFA.getName()); - exchange.getAttributes().put(Constants.CONTEXT, context); - exchange.getAttributes().put(Constants.META_DATA, metaData); - final boolean result = sofaPlugin.skip(exchange); - assertFalse(result); - } - - @Test - public void testGetOrder() { - final int result = sofaPlugin.getOrder(); - assertEquals(PluginEnum.SOFA.getCode(), result); - } - - @Test - public void handleRuleIfNullTest() { - ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class); - SpringBeanUtils.getInstance().setApplicationContext(context); - when(context.getBean(ShenyuResult.class)).thenReturn(new DefaultShenyuResult()); - StepVerifier.create(sofaPlugin.handleRuleIfNull("pluginName", this.exchange, this.chain)).expectSubscription().verifyComplete(); - } - - @Test - public void handleSelectorIfNullTest() { - ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class); - SpringBeanUtils.getInstance().setApplicationContext(context); - when(context.getBean(ShenyuResult.class)).thenReturn(new DefaultShenyuResult()); - StepVerifier.create(sofaPlugin.handleSelectorIfNull("pluginName", this.exchange, this.chain)).expectSubscription().verifyComplete(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/cache/ApplicationConfigCacheTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/cache/ApplicationConfigCacheTest.java deleted file mode 100644 index 3a009deafffa..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/cache/ApplicationConfigCacheTest.java +++ /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. - */ - -package org.apache.shenyu.plugin.sofa.cache; - -import com.alipay.sofa.rpc.config.ConsumerConfig; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.plugin.SofaRegisterConfig; -import org.apache.shenyu.common.dto.convert.selector.SofaUpstream; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.junit.jupiter.MockitoSettings; -import org.mockito.quality.Strictness; - -import static org.junit.Assert.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * ApplicationConfigCacheTest. - */ -@ExtendWith(MockitoExtension.class) -@MockitoSettings(strictness = Strictness.LENIENT) -public class ApplicationConfigCacheTest { - - private ApplicationConfigCache cache; - - private MetaData metaData; - - @Mock - private SelectorData selectorData; - - @BeforeEach - void setUp() { - metaData = new MetaData(); - metaData.setId("1332017966661636096"); - metaData.setAppName("sofa"); - metaData.setPath("/sofa/findAll"); - metaData.setServiceName("org.apache.shenyu.test.dubbo.api.service.DubboTestService"); - metaData.setMethodName("findAll"); - metaData.setRpcType(RpcTypeEnum.SOFA.getName()); - when(selectorData.getId()).thenReturn("153153464562434"); - cache = ApplicationConfigCache.getInstance(); - cache.invalidateAll(); - } - - @Test - void testInitRefAndGet() { - SofaRegisterConfig config = mock(SofaRegisterConfig.class); - when(config.getProtocol()).thenReturn("zookeeper"); - when(config.getRegister()).thenReturn("127.0.0.1:2181"); - cache.init(config); - - ConsumerConfig refConfig = cache.initRef(metaData); - assertNotNull(refConfig); - assertEquals("org.apache.shenyu.test.dubbo.api.service.DubboTestService", refConfig.getInterfaceId()); - - } - - @Test - void testInitRef2AndGet() { - - SofaRegisterConfig config = mock(SofaRegisterConfig.class); - when(config.getProtocol()).thenReturn("zookeeper"); - when(config.getRegister()).thenReturn("127.0.0.1:2181"); - cache.init(config); - - SofaUpstream sofaUpstream = mock(SofaUpstream.class); - when(sofaUpstream.getProtocol()).thenReturn("zookeeper"); - when(sofaUpstream.getRegister()).thenReturn("127.0.0.1:2182"); - ConsumerConfig refConfig = cache.initRef(selectorData.getId(), metaData, sofaUpstream); - assertNotNull(refConfig); - assertEquals("org.apache.shenyu.test.dubbo.api.service.DubboTestService", refConfig.getInterfaceId()); - assertEquals("127.0.0.1:2182", refConfig.getRegistry().get(0).getAddress()); - } - -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/context/SofaShenyuContextDecoratorTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/context/SofaShenyuContextDecoratorTest.java deleted file mode 100644 index 7e3d76bc495b..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/context/SofaShenyuContextDecoratorTest.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.plugin.sofa.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.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * SofaShenyuContextDecoratorTest. - */ -public class SofaShenyuContextDecoratorTest { - - private SofaShenyuContextDecorator sofaShenyuContextDecorator; - - @BeforeEach - public void setUp() { - sofaShenyuContextDecorator = new SofaShenyuContextDecorator(); - } - - @Test - public void testPluginNamed() { - assertEquals(sofaShenyuContextDecorator.rpcType(), RpcTypeEnum.SOFA.getName()); - } - - @Test - public void decoratorTest() { - final MetaData metaData = MetaData.builder().contextPath("path").build(); - final ShenyuContext shenyuContext = new ShenyuContext(); - final ShenyuContext context = sofaShenyuContextDecorator.decorator(shenyuContext, metaData); - assertEquals(context.getContextPath(), "path"); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandlerTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandlerTest.java deleted file mode 100644 index 1699d3eeb9a9..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/handler/SofaMetaDataHandlerTest.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.plugin.sofa.handler; - -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * SofaMetaDataHandlerTest. - */ -public class SofaMetaDataHandlerTest { - - private SofaMetaDataHandler sofaMetaDataHandler; - - @BeforeEach - public void setUp() { - sofaMetaDataHandler = new SofaMetaDataHandler(); - } - - @Test - public void testPluginNamed() { - assertEquals(sofaMetaDataHandler.rpcType(), RpcTypeEnum.SOFA.getName()); - } - - @Test - public void removeTest() { - assertDoesNotThrow(() -> sofaMetaDataHandler.remove(MetaData.builder().path("path").build())); - } - - @Test - public void handleTest() { - final MetaData metaData = MetaData.builder().path("path").build(); - metaData.setServiceName("serviceName"); - assertDoesNotThrow(() -> sofaMetaDataHandler.handle(metaData)); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/handler/SofaPluginDataHandlerTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/handler/SofaPluginDataHandlerTest.java deleted file mode 100644 index 17b9a96473e5..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/handler/SofaPluginDataHandlerTest.java +++ /dev/null @@ -1,68 +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.sofa.handler; - -import org.apache.shenyu.common.dto.PluginData; -import org.apache.shenyu.common.dto.convert.plugin.SofaRegisterConfig; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.Singleton; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; - -/** - * SofaPluginDataHandlerTest. - */ -@ExtendWith(MockitoExtension.class) -@TestMethodOrder(MethodOrderer.Alphanumeric.class) -public final class SofaPluginDataHandlerTest { - - private final String registryConfig = "{\"protocol\":\"zookeeper\",\"register\":\"127.0.0.1:2181\"}"; - - private SofaPluginDataHandler sofaPluginDataHandler; - - @BeforeEach - public void setUp() { - sofaPluginDataHandler = new SofaPluginDataHandler(); - } - - @Test - public void testPluginEnable() { - PluginData pluginData = new PluginData("", "", registryConfig, "1", true, null); - sofaPluginDataHandler.handlerPlugin(pluginData); - assertEquals("127.0.0.1:2181", Singleton.INST.get(SofaRegisterConfig.class).getRegister()); - } - - @Test - public void testPluginDisable() { - PluginData pluginData = new PluginData("", "", registryConfig, "1", false, null); - sofaPluginDataHandler.handlerPlugin(pluginData); - assertNull(Singleton.INST.get(SofaRegisterConfig.class)); - } - - @Test - public void testPluginNamed() { - assertEquals(sofaPluginDataHandler.pluginNamed(), PluginEnum.SOFA.getName()); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/param/SofaBodyParamResolveServiceTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/param/SofaBodyParamResolveServiceTest.java deleted file mode 100644 index 79558b317177..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/param/SofaBodyParamResolveServiceTest.java +++ /dev/null @@ -1,327 +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.sofa.param; - -import com.alipay.hessian.generic.model.GenericObject; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.lang.NonNull; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.fail; - -/** - * Test cases for WebSocketParamFilter. - */ -@ExtendWith(MockitoExtension.class) -public final class SofaBodyParamResolveServiceTest { - - @InjectMocks - private SofaParamResolveServiceImpl impl; - - @Test - public void testBuildParameter() { - //language=JSON - String body = "{\"id\": \"12345\",\"name\": \"candyYu\"}"; - String parameterTypes = "org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.Student"; - Pair pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 1); - assertIsStudent(pair.getRight()[0], true); - - //language=JSON - body = "{\"testArray\":[{\"id\":\"123\",\"name\":\"candy\"},{\"id\":\"456\",\"name\":\"myth\"}]}"; - parameterTypes = "org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.Student[]"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 1); - List right = new ArrayList<>((Collection) pair.getRight()[0]); - assertIsStudent(right.get(0), true); - assertIsStudent(right.get(1), true); - - //language=JSON - body = "{\"ids\":[\"123\",\"456\"],\"name\":\"hello world\"}\n"; - parameterTypes = "java.lang.Integer[],java.lang.String"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 2); - - //language=JSON - body = "{\"idMaps\":{\"id2\":\"2\",\"id1\":\"1\"},\"name\":\"hello world\"}\n"; - parameterTypes = "java.util.HashMap,java.lang.String"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 2); - - //language=JSON - body = "{\"complexBeanTest\":{\"dubboTest\":{\"id\":\"123\",\"name\":\"xiaoyu\"},\"idLists\":[\"456\",\"789\"],\"idMaps\":{\"id2\":\"2\",\"id1\":\"1\"}}}"; - parameterTypes = "org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.ComplexBean"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 1); - assertIsComplexBean(pair.getRight()[0], true); - - //language=JSON - body = "{\"complexBeanTest\":{\"dubboTest\":{\"id\":\"123\",\"name\":\"xiaoyu\"},\"idLists\":[\"456\",\"789\"],\"idMaps\":{\"id2\":\"2\",\"id1\":\"1\"}},\"name\":\"xiaoyu\"}"; - parameterTypes = "org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.ComplexBean, java.lang.String"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 2); - - // test format json - //language=JSON - body = "{\n" - + " \"ids\": [\n" - + " \"123\",\n" - + " \"456\"\n" - + " ],\n" - + " \"id\": 123,\n" - + " \"name\": \"hello world\",\n" - + " \"testArray\": [\n" - + " {\n" - + " \"id\": \"123\",\n" - + " \"name\": \"candy\"\n" - + " },\n" - + " {\n" - + " \"id\": \"456\",\n" - + " \"name\": \"myth\"\n" - + " }\n" - + " ]\n" - + "}\n"; - parameterTypes = "java.lang.Integer[],java.lang.Integer,java.lang.String,org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.Student[]"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 4); - assertIsStudent(pair.getRight()[3], true); - } - - @Test - public void testBuildParameterWithNull() { - //language=JSON - String body = "{\"student\":{\"id\":null,\"name\":null}}"; - String parameterTypes = "org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.Student"; - Pair pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 1); - assertIsStudent(pair.getRight()[0], false); - - //language=JSON - body = "{\"students\":[{\"id\":null,\"name\":null}]}"; - parameterTypes = "org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.Student[]"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 1); - assertIsStudent(pair.getRight()[0], false); - - //language=JSON - body = "{\"complexBean\":{\"dubboTest\":{\"id\":null,\"name\":null},\"idLists\":[null,null],\"idMaps\":{\"id2\":null,\"id1\":null}}}"; - parameterTypes = "org.apache.shenyu.web.rpc.DubboMultiParameterResolveServiceImplTest.ComplexBean"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 1); - assertIsComplexBean(pair.getRight()[0], false); - - //language=JSON - body = "{\"name\":null}"; - parameterTypes = "java.lang.String"; - pair = impl.buildParameter(body, parameterTypes); - assertLeftAndRightSame(pair, 1); - assertNull(pair.getRight()[0]); - } - - private void assertLeftAndRightSame(final Pair pair, final int i) { - assertThat(pair.getLeft().length, is(i)); - assertThat(pair.getRight().length, is(i)); - } - - /** - * assert object is student.
- *
    - *
  • {@link GenericObject} structure is {@link Student}.
  • - *
  • {@link Map} structure is {@link Student}.
  • - *
  • {@link List} value structure is {@link Student}.
  • - *
- * - * @param object target. - * @param allowValueNotNull allow value not null. - * @see Student - */ - private void assertIsStudent(@NonNull final Object object, final boolean allowValueNotNull) { - assertIsObject(object, Student.class, !allowValueNotNull); - } - - /** - * assert object is student.
- *
    - *
  • {@link GenericObject} structure is {@link ComplexBean}.
  • - *
  • {@link Map} structure is {@link ComplexBean}.
  • - *
  • {@link List} value structure is {@link ComplexBean}.
  • - *
- * - * @param object target. - * @param allowValueNotNull allow value not null. - * @see ComplexBean - */ - private void assertIsComplexBean(@NonNull final Object object, final boolean allowValueNotNull) { - assertIsObject(object, ComplexBean.class, !allowValueNotNull); - - } - - /** - * assert object is target structure.
- *
    - *
  • {@link GenericObject} structure is target structure.
  • - *
  • {@link Map} structure is target structure.
  • - *
  • {@link List} value structure is target structure.
  • - *
- * - * @param object object. - * @param clazz target structure. - * @param allowValueToBeNull allow value to be Null. If the value is not null, the deep assertion - */ - private void assertIsObject(@NonNull final Object object, @NonNull final Class clazz, final boolean allowValueToBeNull) { - final Field[] fields = clazz.getDeclaredFields(); - if (object instanceof GenericObject) { - final GenericObject genericObject = (GenericObject) object; - for (Field field : fields) { - if (excludeField(field)) { - continue; - } - if (!genericObject.hasField(field.getName())) { - fail(genericObject + " fieldName: " + field.getName() + " fieldType => " + field.getType().getName()); - } - // not allow value is null - if (!allowValueToBeNull) { - assertNotNull(genericObject.getField(field.getName())); - // value is not null, deep assert - assertIsObject(genericObject.getField(field.getName()), field.getType(), allowValueToBeNull); - } - } - } - if (object instanceof Map) { - final Map map = (Map) object; - for (Field field : fields) { - if (excludeField(field)) { - continue; - } - if (!map.containsKey(field.getName())) { - fail(map + " fieldName: " + field.getName() + " fieldType => " + field.getType().getName()); - } - // not allow value is null - if (!allowValueToBeNull) { - assertNotNull(map.get(field.getName())); - assertIsObject(map.get(field.getName()), field.getType(), allowValueToBeNull); - } - } - } - if (object instanceof List) { - for (Object o : (List) object) { - assertIsObject(o, clazz, allowValueToBeNull); - } - } - } - - /** - * exclude field.
- * if used jacoco, if used idea test coverage, It will add fields to your clazz. you mast ignore. - * idea test coverage solution - * jacoco solution - * - * @param field field - * @return is exclude - */ - private boolean excludeField(final Field field) { - return StringUtils.startsWithAny(field.getName(), "_", "$"); - } - - private static final class Student { - - private String id; - - private String name; - - private Student() { - } - - private Student(final String id, final String name) { - this.id = id; - this.name = name; - } - - private String getId() { - return id; - } - - private void setId(final String id) { - this.id = id; - } - - private String getName() { - return name; - } - - private void setName(final String name) { - this.name = name; - } - } - - private static final class ComplexBean { - - private Student dubboTest; - - private List idLists; - - private Map idMaps; - - private ComplexBean() { - } - - private ComplexBean(final Student dubboTest, final List idLists, final Map idMaps) { - this.dubboTest = dubboTest; - this.idLists = idLists; - this.idMaps = idMaps; - } - - private Student getDubboTest() { - return dubboTest; - } - - private void setDubboTest(final Student dubboTest) { - this.dubboTest = dubboTest; - } - - private List getIdLists() { - return idLists; - } - - private void setIdLists(final List idLists) { - this.idLists = idLists; - } - - private Map getIdMaps() { - return idMaps; - } - - private void setIdMaps(final Map idMaps) { - this.idMaps = idMaps; - } - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyServiceTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyServiceTest.java deleted file mode 100644 index 218c7106c51c..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-sofa/src/test/java/org/apache/shenyu/plugin/sofa/proxy/SofaProxyServiceTest.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.sofa.proxy; - -import com.alipay.sofa.rpc.api.GenericService; -import com.alipay.sofa.rpc.config.ConsumerConfig; -import com.alipay.sofa.rpc.context.RpcInvokeContext; -import com.google.common.cache.LoadingCache; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -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.SofaRegisterConfig; -import org.apache.shenyu.common.dto.convert.selector.SofaUpstream; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.plugin.api.utils.SpringBeanUtils; -import org.apache.shenyu.plugin.sofa.cache.ApplicationConfigCache; -import org.apache.shenyu.plugin.sofa.param.SofaParamResolveService; -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.context.ConfigurableApplicationContext; -import org.springframework.lang.NonNull; -import org.springframework.mock.http.server.reactive.MockServerHttpRequest; -import org.springframework.mock.web.server.MockServerWebExchange; -import org.springframework.web.server.ServerWebExchange; - -import java.lang.reflect.Field; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * SofaProxyServiceTest. - */ -@ExtendWith(MockitoExtension.class) -public final class SofaProxyServiceTest { - - private static final String PATH = "/sofa/findAll"; - - private static final String METHOD_NAME = "findAll"; - - private static final String[] LEFT = new String[]{}; - - private static final Object[] RIGHT = new Object[]{}; - - 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(PATH); - metaData.setServiceName("org.apache.shenyu.test.dubbo.api.service.DubboTestService"); - metaData.setMethodName(METHOD_NAME); - metaData.setRpcType(RpcTypeEnum.SOFA.getName()); - metaData.setRpcExt("{\"loadbalance\": \"loadbalance\"}"); - } - - @AfterEach - public void after() { - ApplicationConfigCache.getInstance().invalidateAll(); - } - - @Test - @SuppressWarnings("all") - public void testGenericInvoker() throws IllegalAccessException { - ConsumerConfig consumerConfig = mock(ConsumerConfig.class); - GenericService genericService = mock(GenericService.class); - when(consumerConfig.refer()).thenReturn(genericService); - when(consumerConfig.getInterfaceId()).thenReturn(PATH); - when(genericService.$genericInvoke(METHOD_NAME, LEFT, RIGHT)).thenReturn(null); - ApplicationConfigCache applicationConfigCache = ApplicationConfigCache.getInstance(); - final Field cacheField = FieldUtils.getDeclaredField(ApplicationConfigCache.class, "cache", true); - assertNotNull(cacheField); - final Object cache = cacheField.get(applicationConfigCache); - assertTrue(cache instanceof LoadingCache); - ((LoadingCache) cache).put(PATH, consumerConfig); - SofaProxyService sofaProxyService = new SofaProxyService(new SofaParamResolveServiceImpl()); - sofaProxyService.genericInvoker("", metaData, new SelectorData(), exchange); - RpcInvokeContext.getContext().getResponseCallback().onAppResponse("success", null, null); - final SofaRegisterConfig sofaRegisterConfig = new SofaRegisterConfig(); - sofaRegisterConfig.setThreadpool(Constants.SHARED); - applicationConfigCache.init(sofaRegisterConfig); - } - - @Test - @SuppressWarnings("all") - public void testGenericInvoker2() throws IllegalAccessException { - ConsumerConfig consumerConfig = mock(ConsumerConfig.class); - GenericService genericService = mock(GenericService.class); - when(consumerConfig.refer()).thenReturn(genericService); - when(consumerConfig.getInterfaceId()).thenReturn(PATH); - when(genericService.$genericInvoke(METHOD_NAME, LEFT, RIGHT)).thenReturn(null); - ApplicationConfigCache applicationConfigCache = ApplicationConfigCache.getInstance(); - SelectorData selectorData = SelectorData.builder().id("153153464562434") - .handle("{\n" + " \"register\": \"zookeeper://127.0.0.1:2181\",\n" - + " \"appName\": \"sofa-demo-service\",\n" - + " \"port\": 12200,\n" - + " \"weight\": 50,\n" - + " \"warmup\": 60,\n" - + " \"upstreamHost\": \"127.0.0.1\",\n" - + " \"protocol\": \"zookeeper\",\n" - + " \"upstreamUrl\": \"127.0.0.1:12200\",\n" - + " \"gray\": false,\n" - + " \"status\": true,\n" - + " \"timestamp\": 1718001234567\n" - + "}").build(); - SofaUpstream sofaUpstream = GsonUtils.getInstance().fromJson(selectorData.getHandle(), SofaUpstream.class); - final Field cacheField = FieldUtils.getDeclaredField(ApplicationConfigCache.class, "cache", true); - assertNotNull(cacheField); - final Object cache = cacheField.get(applicationConfigCache); - assertTrue(cache instanceof LoadingCache); - String key = applicationConfigCache.generateUpstreamCacheKey("153153464562434", PATH, sofaUpstream); - ((LoadingCache) cache).put(key, consumerConfig); - SofaProxyService sofaProxyService = new SofaProxyService(new SofaParamResolveServiceImpl()); - final SofaRegisterConfig sofaRegisterConfig = new SofaRegisterConfig(); - applicationConfigCache.init(sofaRegisterConfig); - sofaProxyService.genericInvoker("", metaData, selectorData, exchange); - RpcInvokeContext.getContext().getResponseCallback().onAppResponse("success", null, null); - } - - @Test - public void applicationConfigCacheTest() throws NoSuchFieldException, IllegalAccessException { - ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class); - SpringBeanUtils.getInstance().setApplicationContext(context); - final ShenyuThreadPoolExecutor shenyuThreadPoolExecutor = mock(ShenyuThreadPoolExecutor.class); - when(context.getBean(ShenyuThreadPoolExecutor.class)).thenReturn(shenyuThreadPoolExecutor); - ApplicationConfigCache applicationConfigCache = ApplicationConfigCache.getInstance(); - final SofaRegisterConfig sofaRegisterConfig = new SofaRegisterConfig(); - sofaRegisterConfig.setThreadpool(Constants.SHARED); - assertDoesNotThrow(() -> applicationConfigCache.init(sofaRegisterConfig)); - final Field threadPool = ApplicationConfigCache.class.getDeclaredField("threadPool"); - threadPool.setAccessible(true); - threadPool.set(applicationConfigCache, null); - sofaRegisterConfig.setThreadpool(Constants.FIXED); - assertThrows(UnsupportedOperationException.class, () -> applicationConfigCache.init(sofaRegisterConfig)); - threadPool.set(applicationConfigCache, null); - sofaRegisterConfig.setThreadpool(Constants.EAGER); - assertThrows(UnsupportedOperationException.class, () -> applicationConfigCache.init(sofaRegisterConfig)); - threadPool.set(applicationConfigCache, null); - sofaRegisterConfig.setThreadpool(Constants.LIMITED); - assertThrows(UnsupportedOperationException.class, () -> applicationConfigCache.init(sofaRegisterConfig)); - threadPool.set(applicationConfigCache, null); - sofaRegisterConfig.setThreadpool(Constants.CACHED); - assertDoesNotThrow(() -> applicationConfigCache.init(sofaRegisterConfig)); - threadPool.set(applicationConfigCache, null); - sofaRegisterConfig.setThreadpool("other"); - assertDoesNotThrow(() -> applicationConfigCache.init(sofaRegisterConfig)); - } - - @Test - public void buildTest() { - ApplicationConfigCache applicationConfigCache = ApplicationConfigCache.getInstance(); - final SofaRegisterConfig sofaRegisterConfig = new SofaRegisterConfig(); - applicationConfigCache.init(sofaRegisterConfig); - applicationConfigCache.build(metaData); - } - - static class SofaParamResolveServiceImpl implements SofaParamResolveService { - - @Override - @NonNull - public Pair buildParameter(final String body, final String parameterTypes) { - return new ImmutablePair<>(LEFT, RIGHT); - } - } -} 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..30d7304421d3 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,8 +107,7 @@ public boolean skip(final ServerWebExchange exchange) { RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.TARS, - RpcTypeEnum.MOTAN, - RpcTypeEnum.SOFA); + RpcTypeEnum.MOTAN); } @NonNull 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..d5608ac6c8a3 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(), + return Lists.newArrayList(RpcTypeEnum.DUBBO.getName(), RpcTypeEnum.GRPC.getName(), RpcTypeEnum.MOTAN.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..0a28faebe928 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 @@ -64,7 +64,6 @@ public void setup() { when(messageWriter.writeWith(any(), any())).thenReturn(Mono.empty()); writerMap.put(RpcTypeEnum.HTTP.getName(), messageWriter); 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); @@ -79,9 +78,6 @@ public void testExecute() { ServerWebExchange dubboExchange = generateServerWebExchange(RpcTypeEnum.DUBBO.getName()); StepVerifier.create(responsePlugin.execute(dubboExchange, chain)).expectSubscription().verifyComplete(); - ServerWebExchange sofaExchange = generateServerWebExchange(RpcTypeEnum.SOFA.getName()); - StepVerifier.create(responsePlugin.execute(sofaExchange, chain)).expectSubscription().verifyComplete(); - ServerWebExchange grpcExchange = generateServerWebExchange(RpcTypeEnum.GRPC.getName()); StepVerifier.create(responsePlugin.execute(grpcExchange, 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..9acae0315b4d 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. + * rpc type. */ 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..96486fbac521 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 @@ -32,11 +32,6 @@ public enum RegisterTypeEnum { */ DUBBO("dubbo"), - /** - * Sofa rpc type enum. - */ - SOFA("sofa"), - /** * Tars rpc type enum. */ 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..e9963b47df2e 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 @@ -29,7 +29,6 @@ shenyu-spring-boot-starter-client-springmvc shenyu-spring-boot-starter-client-apache-dubbo - shenyu-spring-boot-starter-client-sofa shenyu-spring-boot-starter-client-tars shenyu-spring-boot-starter-client-grpc shenyu-spring-boot-starter-client-mcp diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/pom.xml deleted file mode 100644 index 4bafd25d4f0f..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-spring-boot-starter-client - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-spring-boot-starter-client-sofa - - - 4.3.0 - - - - - org.apache.shenyu - shenyu-client-sofa - ${project.version} - - - org.apache.shenyu - shenyu-spring-boot-starter-client-common - ${project.version} - - - com.alipay.sofa - runtime-sofa-boot-starter - ${runtime-sofa-boot-starter.version} - test - - - diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/main/java/org/apache/shenyu/springboot/starter/client/sofa/ShenyuSofaClientConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/main/java/org/apache/shenyu/springboot/starter/client/sofa/ShenyuSofaClientConfiguration.java deleted file mode 100644 index ca8fe17b8d8e..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/main/java/org/apache/shenyu/springboot/starter/client/sofa/ShenyuSofaClientConfiguration.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.springboot.starter.client.sofa; - -import org.apache.shenyu.client.sofa.SofaServiceEventListener; -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.springframework.boot.autoconfigure.ImportAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Sofa type client event listener. - */ -@Configuration -@ImportAutoConfiguration(ShenyuClientCommonBeanConfiguration.class) -@ConditionalOnProperty(value = "shenyu.register.enabled", matchIfMissing = true, havingValue = "true") -public class ShenyuSofaClientConfiguration { - - static { - VersionUtils.checkDuplicate(ShenyuSofaClientConfiguration.class); - } - - /** - * Sofa service event listener. - * - * @param clientConfig the client config - * @param shenyuClientRegisterRepository the shenyuClientRegisterRepository - * @return the sofa service event listener - */ - @Bean - public SofaServiceEventListener sofaServiceEventListener(final ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) { - return new SofaServiceEventListener(clientConfig, shenyuClientRegisterRepository); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/main/resources/META-INF/spring.factories b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 4f9afdcec908..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/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.sofa.ShenyuSofaClientConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/main/resources/META-INF/spring.provides b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/main/resources/META-INF/spring.provides deleted file mode 100644 index 181e634e9c69..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/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-sofa diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/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-sofa/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 78d2ff8b29bd..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/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.sofa.ShenyuSofaClientConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/test/java/org/apache/shenyu/springboot/starter/client/sofa/ShenyuSofaClientConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/test/java/org/apache/shenyu/springboot/starter/client/sofa/ShenyuSofaClientConfigurationTest.java deleted file mode 100644 index 415b614a1b37..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-sofa/src/test/java/org/apache/shenyu/springboot/starter/client/sofa/ShenyuSofaClientConfigurationTest.java +++ /dev/null @@ -1,78 +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.sofa; - -import org.apache.shenyu.client.sofa.SofaServiceEventListener; -import org.apache.shenyu.register.client.http.utils.RegisterUtils; -import org.junit.jupiter.api.BeforeEach; -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.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mockStatic; - -/** - * Test case for {@link ShenyuSofaClientConfiguration}. - */ -@Configuration -@EnableConfigurationProperties -public class ShenyuSofaClientConfigurationTest { - - private ApplicationContextRunner applicationContextRunner; - - @BeforeEach - public void before() { - applicationContextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(ShenyuSofaClientConfiguration.class)) - .withBean(ShenyuSofaClientConfigurationTest.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.sofa.props[contextPath]=/sofa", - "shenyu.client.sofa.props[appName]=sofa", - "shenyu.client.sofa.props[host]=127.0.0.1", - "shenyu.client.sofa.props[port]=8888" - ); - } - - @Test - public void testSofaServiceEventListener() { - MockedStatic registerUtilsMockedStatic = mockStatic(RegisterUtils.class); - registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.ofNullable("token")); - applicationContextRunner.run(context -> { - SofaServiceEventListener eventListener = context.getBean("sofaServiceEventListener", SofaServiceEventListener.class); - assertNotNull(eventListener); - assertEquals(eventListener.getAppName(), "sofa"); - assertEquals(eventListener.getHost(), "127.0.0.1"); - assertEquals(eventListener.getPort(), "8888"); - assertEquals(eventListener.getContextPath(), "/sofa"); - }); - 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..5f94e2308b71 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 @@ -36,7 +36,6 @@ shenyu-spring-boot-starter-plugin-waf 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 diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/pom.xml deleted file mode 100644 index b277ee64a17f..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-spring-boot-starter-plugin-sofa - - - - org.apache.shenyu - shenyu-plugin-sofa - ${project.version} - - - com.alipay.sofa - sofa-rpc-all - test - - - diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfiguration.java deleted file mode 100644 index 1e5006e226ba..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfiguration.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.springboot.starter.plugin.sofa; - -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.sofa.SofaPlugin; -import org.apache.shenyu.plugin.sofa.context.SofaShenyuContextDecorator; -import org.apache.shenyu.plugin.sofa.handler.SofaPluginDataHandler; -import org.apache.shenyu.plugin.sofa.param.SofaParamResolveService; -import org.apache.shenyu.plugin.sofa.param.SofaParamResolveServiceImpl; -import org.apache.shenyu.plugin.sofa.proxy.SofaProxyService; -import org.apache.shenyu.plugin.sofa.handler.SofaMetaDataHandler; -import org.springframework.beans.factory.ObjectProvider; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.condition.SearchStrategy; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * The type sofa plugin configuration. - */ -@Configuration -@ConditionalOnClass(SofaPlugin.class) -@ConditionalOnProperty(value = {"shenyu.plugins.sofa.enabled"}, havingValue = "true", matchIfMissing = true) -public class SofaPluginConfiguration { - - /** - * Sofa plugin. - * - * @param sofaParamResolveService the sofa param resolve service - * @return the shenyu plugin - */ - @Bean - public ShenyuPlugin sofaPlugin(final ObjectProvider sofaParamResolveService) { - return new SofaPlugin(new SofaProxyService(sofaParamResolveService.getIfAvailable())); - } - - /** - * Sofa param resolve service. - * - * @return the sofa param resolve service - */ - @Bean - @ConditionalOnMissingBean(value = SofaParamResolveService.class, search = SearchStrategy.ALL) - public SofaParamResolveService sofaParamResolveService() { - return new SofaParamResolveServiceImpl(); - } - - /** - * Sofa plugin data handler. - * - * @return the plugin data handler - */ - @Bean - public PluginDataHandler sofaPluginDataHandler() { - return new SofaPluginDataHandler(); - } - - /** - * Sofa meta data handler. - * - * @return the meta data handler - */ - @Bean - public MetaDataHandler sofaMetaDataHandler() { - return new SofaMetaDataHandler(); - } - - /** - * Sofa shenyu context decorator. - * - * @return the shenyu context decorator - */ - @Bean - public ShenyuContextDecorator sofaShenyuContextDecorator() { - return new SofaShenyuContextDecorator(); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/resources/META-INF/spring.factories b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 609a7c20133f..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/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.sofa.SofaPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/resources/META-INF/spring.provides b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/main/resources/META-INF/spring.provides deleted file mode 100644 index f48194bf488f..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/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-sofa diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/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-sofa/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 75a58f671054..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/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.sofa.SofaPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/test/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/test/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfigurationTest.java deleted file mode 100644 index f8f958cd3a80..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-sofa/src/test/java/org/apache/shenyu/springboot/starter/plugin/sofa/SofaPluginConfigurationTest.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.springboot.starter.plugin.sofa; - -import org.apache.shenyu.common.enums.PluginEnum; -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.sofa.param.SofaParamResolveService; -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.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * Test case for {@link SofaPluginConfiguration}. - */ -@Configuration -@EnableConfigurationProperties -public class SofaPluginConfigurationTest { - - private ApplicationContextRunner applicationContextRunner; - - @BeforeEach - public void before() { - applicationContextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(SofaPluginConfiguration.class)) - .withBean(SofaPluginConfigurationTest.class) - .withPropertyValues("debug=true"); - } - - @Test - public void testSofaPlugin() { - applicationContextRunner.run(context -> { - ShenyuPlugin plugin = context.getBean("sofaPlugin", ShenyuPlugin.class); - assertNotNull(plugin); - assertThat(plugin.named()).isEqualTo(PluginEnum.SOFA.getName()); - } - ); - } - - @Test - public void testSofaParamResolveServiceImpl() { - applicationContextRunner.run(context -> { - SofaParamResolveService service = context.getBean("sofaParamResolveService", SofaParamResolveService.class); - assertNotNull(service); - } - ); - } - - @Test - public void testSofaPluginDataHandler() { - applicationContextRunner.run(context -> { - PluginDataHandler handler = context.getBean("sofaPluginDataHandler", PluginDataHandler.class); - assertNotNull(handler); - } - ); - } - - @Test - public void testSofaMetaDataSubscriber() { - applicationContextRunner.run(context -> { - MetaDataHandler handler = context.getBean("sofaMetaDataHandler", MetaDataHandler.class); - assertNotNull(handler); - } - ); - } - - @Test - public void testSofaShenyuContextDecorator() { - applicationContextRunner.run(context -> { - ShenyuContextDecorator decorator = context.getBean("sofaShenyuContextDecorator", ShenyuContextDecorator.class); - assertNotNull(decorator); - } - ); - } -}