diff --git a/README.md b/README.md index 8cdbd00e80bd..e34fa68bcd9c 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, SOFA, 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..14191f867489 100644 --- a/db/init/mysql/schema.sql +++ b/db/init/mysql/schema.sql @@ -51,7 +51,7 @@ CREATE TABLE `api` ( `consume` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'consume content-type', `produce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'produce content-type', `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'api version,for example V0.01', - `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,motan,grpc', + `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,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', @@ -976,7 +976,6 @@ INSERT INTO `plugin` VALUES ('31', 'mock', null, 'Mock', 1, 0, '2022-06-16 14:40 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); INSERT INTO `plugin` VALUES ('15', 'grpc', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); @@ -1103,18 +1102,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613199978551', '5', 'multiRuleHandle INSERT INTO `plugin_handle` VALUES ('1529402613199978552', '5', 'headerMaxSize', 'headerMaxSize', 1, 2, 3, '{\"defaultValue\":\"10240\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978553', '5', 'requestMaxSize', 'requestMaxSize', 1, 2, 4, '{\"defaultValue\":\"102400\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978554', '5', 'retryStrategy', 'retryStrategy', 3, 2, 0, '{\"required\":\"0\",\"defaultValue\":\"current\",\"placeholder\":\"retryStrategy\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978555', '13', 'upstreamHost', 'host', 2, 1, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978556', '13', 'protocol', 'protocol', 2, 1, 2, '{\"defaultValue\":\"\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978557', '13', 'upstreamUrl', 'ip:port', 2, 1, 1, '{\"required\":\"1\",\"placeholder\":\"\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978558', '13', 'weight', 'weight', 1, 1, 3, '{\"defaultValue\":\"50\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978559', '13', 'timestamp', 'startupTime', 1, 1, 3, '{\"defaultValue\":\"0\",\"placeholder\":\"startup timestamp\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978560', '13', 'warmup', 'warmupTime', 1, 1, 5, '{\"defaultValue\":\"0\",\"placeholder\":\"warmup time ms)\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978561', '13', 'status', 'status', 3, 1, 6, '{\"defaultValue\":\"true\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978562', '13', 'loadBalance', 'loadStrategy', 3, 2, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978563', '13', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978564', '13', 'timeout', 'timeout', 1, 2, 2, '{\"defaultValue\":\"3000\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978565', '13', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978566', '13', 'multiRuleHandle', 'multiRuleHandle', 3, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978567', '15', 'upstreamUrl', 'ip:port', 2, 1, 1, '{\"required\":\"1\",\"placeholder\":\"\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978568', '15', 'weight', 'weight', 1, 1, 3, '{\"defaultValue\":\"50\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978569', '15', 'status', 'status', 3, 1, 6, '{\"defaultValue\":\"true\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); @@ -1215,10 +1202,6 @@ INSERT INTO `plugin_handle` VALUES ('1729402613204172866', '30', 'minIdle', 'min INSERT INTO `plugin_handle` VALUES ('1729402613204172867', '30', 'maxActive', 'maxActive', 1, 1, 9, '{\"required\":\"0\",\"defaultValue\":\"8\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1729402613204172868', '30', 'maxWait', 'maxWait', 3, 1, 10, '{\"required\":\"0\",\"defaultValue\":\"-1\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172869', '30', 'timeoutSeconds', 'timeoutSeconds', 1, 2, 0, '{\"required\":\"0\",\"defaultValue\":\"60\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172870', '13', 'corethreads', 'corethreads', 1, 3, 3, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -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'); @@ -1580,7 +1563,6 @@ INSERT INTO `resource` VALUES ('1529402639271772160', '1346775491550474240', 'si 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'); INSERT INTO `resource` VALUES ('1529402639284355077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -1640,15 +1622,6 @@ INSERT INTO `resource` VALUES ('1529402639368241184', '1529402639284355074', 'SH INSERT INTO `resource` VALUES ('1529402639368241185', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241186', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241187', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4j:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241188', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241189', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241190', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241191', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241192', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241193', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241194', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241195', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241196', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:tars:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241197', '1529402639284355076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241198', '1529402639284355076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241199', '1529402639284355076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -2616,7 +2589,6 @@ INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, ` INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('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'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/ob/schema.sql b/db/init/ob/schema.sql index 906323b20b10..422030138928 100644 --- a/db/init/ob/schema.sql +++ b/db/init/ob/schema.sql @@ -51,7 +51,7 @@ CREATE TABLE `api` ( `consume` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'consume content-type', `produce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'produce content-type', `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'api version,for example V0.01', - `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,motan,grpc', + `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,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', @@ -947,7 +947,6 @@ INSERT INTO `plugin` VALUES ('31', 'mock', null, 'Mock', 1, 0, '2022-06-16 14:40 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); INSERT INTO `plugin` VALUES ('15', 'grpc', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); @@ -1070,18 +1069,6 @@ INSERT INTO `plugin_handle` VALUES ('1529402613199978551', '5', 'multiRuleHandle INSERT INTO `plugin_handle` VALUES ('1529402613199978552', '5', 'headerMaxSize', 'headerMaxSize', 1, 2, 3, '{\"defaultValue\":\"10240\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978553', '5', 'requestMaxSize', 'requestMaxSize', 1, 2, 4, '{\"defaultValue\":\"102400\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978554', '5', 'retryStrategy', 'retryStrategy', 3, 2, 0, '{\"required\":\"0\",\"defaultValue\":\"current\",\"placeholder\":\"retryStrategy\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978555', '13', 'upstreamHost', 'host', 2, 1, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978556', '13', 'protocol', 'protocol', 2, 1, 2, '{\"defaultValue\":\"\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978557', '13', 'upstreamUrl', 'ip:port', 2, 1, 1, '{\"required\":\"1\",\"placeholder\":\"\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978558', '13', 'weight', 'weight', 1, 1, 3, '{\"defaultValue\":\"50\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978559', '13', 'timestamp', 'startupTime', 1, 1, 3, '{\"defaultValue\":\"0\",\"placeholder\":\"startup timestamp\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978560', '13', 'warmup', 'warmupTime', 1, 1, 5, '{\"defaultValue\":\"0\",\"placeholder\":\"warmup time ms)\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978561', '13', 'status', 'status', 3, 1, 6, '{\"defaultValue\":\"true\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978562', '13', 'loadBalance', 'loadStrategy', 3, 2, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978563', '13', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978564', '13', 'timeout', 'timeout', 1, 2, 2, '{\"defaultValue\":\"3000\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978565', '13', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613199978566', '13', 'multiRuleHandle', 'multiRuleHandle', 3, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978567', '15', 'upstreamUrl', 'ip:port', 2, 1, 1, '{\"required\":\"1\",\"placeholder\":\"\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978568', '15', 'weight', 'weight', 1, 1, 3, '{\"defaultValue\":\"50\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613199978569', '15', 'status', 'status', 3, 1, 6, '{\"defaultValue\":\"true\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); @@ -1181,10 +1168,6 @@ INSERT INTO `plugin_handle` VALUES ('1729402613204172866', '30', 'minIdle', 'min INSERT INTO `plugin_handle` VALUES ('1729402613204172867', '30', 'maxActive', 'maxActive', 1, 1, 9, '{\"required\":\"0\",\"defaultValue\":\"8\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1729402613204172868', '30', 'maxWait', 'maxWait', 3, 1, 10, '{\"required\":\"0\",\"defaultValue\":\"-1\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); INSERT INTO `plugin_handle` VALUES ('1529402613204172869', '30', 'timeoutSeconds', 'timeoutSeconds', 1, 2, 0, '{\"required\":\"0\",\"defaultValue\":\"60\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -INSERT INTO `plugin_handle` VALUES ('1529402613204172870', '13', 'corethreads', 'corethreads', 1, 3, 3, '{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}', '2022-05-25 18:02:53', '2022-05-25 18:02:53'); -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'); @@ -1529,7 +1512,6 @@ INSERT INTO `resource` VALUES ('1529402639271772160', '1346775491550474240', 'si 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'); INSERT INTO `resource` VALUES ('1529402639284355077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -1589,15 +1571,6 @@ INSERT INTO `resource` VALUES ('1529402639368241184', '1529402639284355074', 'SH INSERT INTO `resource` VALUES ('1529402639368241185', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241186', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241187', '1529402639284355074', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4j:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241188', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241189', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241190', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241191', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241192', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241193', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241194', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241195', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639368241196', '1529402639284355075', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:tars:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241197', '1529402639284355076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241198', '1529402639284355076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241199', '1529402639284355076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -2543,7 +2516,6 @@ INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, ` INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('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'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/og/create-table.sql b/db/init/og/create-table.sql index 932dd7b449f8..03507042521a 100644 --- a/db/init/og/create-table.sql +++ b/db/init/og/create-table.sql @@ -49,7 +49,7 @@ COMMENT ON COLUMN "public"."api"."http_method" IS '0-get,1-head,2-post,3-put,4-p COMMENT ON COLUMN "public"."api"."consume" IS 'consume content-type'; COMMENT ON COLUMN "public"."api"."produce" IS 'produce content-type'; COMMENT ON COLUMN "public"."api"."version" IS 'api version,for example V0.01'; -COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,motan,grpc'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,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'; @@ -949,7 +949,6 @@ INSERT INTO "public"."plugin" VALUES ('1', 'sign', NULL, 'Authentication', 20, 0 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); INSERT INTO "public"."plugin" VALUES ('15', 'grpc', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1091,18 +1090,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330564', '5', 'multiR INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330565', '5', 'headerMaxSize', 'headerMaxSize', 1, 2, 3, '{"defaultValue":"10240","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330566', '5', 'requestMaxSize', 'requestMaxSize', 1, 2, 4, '{"defaultValue":"102400","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330567', '5', 'retryStrategy', 'retryStrategy', 3, 2, 0, '{"required":"0","defaultValue":"current","placeholder":"retryStrategy","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330568', '13', 'upstreamHost', 'host', 2, 1, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330569', '13', 'protocol', 'protocol', 2, 1, 2, '{"defaultValue":"","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330570', '13', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330571', '13', 'weight', 'weight', 1, 1, 3, '{"defaultValue":"50","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330572', '13', 'timestamp', 'startupTime', 1, 1, 3, '{"defaultValue":"0","placeholder":"startup timestamp","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330573', '13', 'warmup', 'warmupTime', 1, 1, 5, '{"defaultValue":"0","placeholder":"warmup time ms)","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330574', '13', 'status', 'status', 3, 1, 6, '{"defaultValue":"true","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330575', '13', 'loadBalance', 'loadStrategy', 3, 2, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330576', '13', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330577', '13', 'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330578', '13', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330579', '13', 'multiRuleHandle', 'multiRuleHandle', 3, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330580', '15', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330581', '15', 'weight', 'weight', 1, 1, 3, '{"defaultValue":"50","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330582', '15', 'status', 'status', 3, 1, 6, '{"defaultValue":"true","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); @@ -1204,10 +1191,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1729403902783524909', '30', 'minId INSERT INTO "public"."plugin_handle" VALUES ('1729403902783524910', '30', 'maxActive', 'maxActive', 1, 1, 9, '{"required":"0","defaultValue":"8","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1729403902783524911', '30', 'maxWait', 'maxWait', 3, 1, 10, '{"required":"0","defaultValue":"-1","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1729403902783524912', '30', 'timeoutSeconds', 'timeoutSeconds', 1, 2, 0, '{"required":"0","defaultValue":"60","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524913', '13', 'corethreads', 'corethreads', 1, 3, 3, '{"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 ('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'); @@ -1551,7 +1534,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932772798464', '1346775491550474 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'); INSERT INTO "public"."resource" VALUES ('1529403932781187077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -1611,15 +1593,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932877656096', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932877656097', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656098', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656099', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4j:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656100', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656101', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656102', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656103', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656104', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656105', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656106', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656107', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656108', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:tars:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656109', '1529403932781187076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656110', '1529403932781187076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656111', '1529403932781187076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2728,7 +2701,6 @@ INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822145','64933 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'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/oracle/schema.sql b/db/init/oracle/schema.sql index 7aeb47b46c50..19a336f355f5 100644 --- a/db/init/oracle/schema.sql +++ b/db/init/oracle/schema.sql @@ -462,7 +462,7 @@ comment on column API.produce comment on column API.version is 'api version,for example V0.01'; comment on column API.rpc_type - is 'http,dubbo,sofa,tars,websocket,motan,grpc'; + is 'http,dubbo,sofa,websocket,motan,grpc'; comment on column API.state is '0-unpublished,1-published,2-offline'; comment on column API.ext @@ -1160,7 +1160,6 @@ INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('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'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config, enabled) VALUES ('15', 'grpc', 'Proxy', 310,'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}','0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('16', 'redirect', 'HttpProcess', 110,'0'); @@ -1596,54 +1595,6 @@ values ('1518229897210273844', '5', 'requestMaxSize', 'requestMaxSize', 1, 2, 4, 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 ('1518229897210273845', '5', 'retryStrategy', 'retryStrategy', 3, 2, 0, '{"required":"0","defaultValue":"current","placeholder":"retryStrategy","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 ('1518229897210273846', '13', 'upstreamHost', 'host', 2, 1, 0, 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 ('1518229897210273847', '13', 'protocol', 'protocol', 2, 1, 2, '{"defaultValue":"","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 ('1518229897210273848', '13', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","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 ('1518229897210273849', '13', 'weight', 'weight', 1, 1, 3, '{"defaultValue":"50","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 ('1518229897210273850', '13', 'timestamp', 'startupTime', 1, 1, 3, '{"defaultValue":"0","placeholder":"startup timestamp","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 ('1518229897210273851', '13', 'warmup', 'warmupTime', 1, 1, 5, '{"defaultValue":"0","placeholder":"warmup time ms)","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 ('1518229897210273852', '13', 'status', 'status', 3, 1, 6, '{"defaultValue":"true","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 ('1518229897210273853', '13', 'loadBalance', 'loadStrategy', 3, 2, 0, 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 ('1518229897210273854', '13', 'retry', 'retryCount', 1, 2, 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 ('1518229897210273855', '13', 'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","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 ('1518229897210273856', '13', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, 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 ('1518229897210273857', '13', 'multiRuleHandle', 'multiRuleHandle', 3, 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 ('1518229897210273858', '13', 'corethreads', 'corethreads', 1, 3, 3, '{"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 ('1518229897210273859', '13', 'threads', 'threads', 1, 3, 4, '{"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 ('1518229897210273860', '13', 'queues', 'queues', 1, 3, 5, '{"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 ('1518229897210273861', '13', 'threadpool', 'threadpool', 3, 3, 2, '{"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 ('1518229897214468095', '15', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","rule":""}'); @@ -3013,7 +2964,6 @@ INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespa INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('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); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0); @@ -3815,4 +3765,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..cb2c0d15517a 100644 --- a/db/init/pg/create-table.sql +++ b/db/init/pg/create-table.sql @@ -46,7 +46,7 @@ COMMENT ON COLUMN "public"."api"."http_method" IS '0-get,1-head,2-post,3-put,4-p COMMENT ON COLUMN "public"."api"."consume" IS 'consume content-type'; COMMENT ON COLUMN "public"."api"."produce" IS 'produce content-type'; COMMENT ON COLUMN "public"."api"."version" IS 'api version,for example V0.01'; -COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,tars,websocket,motan,grpc'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,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'; @@ -1007,7 +1007,6 @@ INSERT INTO "public"."plugin" VALUES ('1', 'sign', NULL, 'Authentication', 20, 0 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); INSERT INTO "public"."plugin" VALUES ('15', 'grpc', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1149,18 +1148,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330564', '5', 'multiR INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330565', '5', 'headerMaxSize', 'headerMaxSize', 1, 2, 3, '{"defaultValue":"10240","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330566', '5', 'requestMaxSize', 'requestMaxSize', 1, 2, 4, '{"defaultValue":"102400","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330567', '5', 'retryStrategy', 'retryStrategy', 3, 2, 0, '{"required":"0","defaultValue":"current","placeholder":"retryStrategy","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330568', '13', 'upstreamHost', 'host', 2, 1, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330569', '13', 'protocol', 'protocol', 2, 1, 2, '{"defaultValue":"","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330570', '13', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330571', '13', 'weight', 'weight', 1, 1, 3, '{"defaultValue":"50","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330572', '13', 'timestamp', 'startupTime', 1, 1, 3, '{"defaultValue":"0","placeholder":"startup timestamp","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330573', '13', 'warmup', 'warmupTime', 1, 1, 5, '{"defaultValue":"0","placeholder":"warmup time ms)","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330574', '13', 'status', 'status', 3, 1, 6, '{"defaultValue":"true","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330575', '13', 'loadBalance', 'loadStrategy', 3, 2, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330576', '13', 'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330577', '13', 'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330578', '13', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330579', '13', 'multiRuleHandle', 'multiRuleHandle', 3, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330580', '15', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330581', '15', 'weight', 'weight', 1, 1, 3, '{"defaultValue":"50","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902779330582', '15', 'status', 'status', 3, 1, 6, '{"defaultValue":"true","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); @@ -1261,10 +1248,6 @@ INSERT INTO "public"."plugin_handle" VALUES ('1729403902783524909', '30', 'minId INSERT INTO "public"."plugin_handle" VALUES ('1729403902783524910', '30', 'maxActive', 'maxActive', 1, 1, 9, '{"required":"0","defaultValue":"8","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1729403902783524911', '30', 'maxWait', 'maxWait', 3, 1, 10, '{"required":"0","defaultValue":"-1","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524912', '30', 'timeoutSeconds', 'timeoutSeconds', 1, 2, 0, '{"required":"0","defaultValue":"60","rule":""}', '2022-05-25 18:08:01', '2022-05-25 18:08:01'); -INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524913', '13', 'corethreads', 'corethreads', 1, 3, 3, '{"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 ('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'); @@ -1608,7 +1591,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932772798464', '1346775491550474 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'); INSERT INTO "public"."resource" VALUES ('1529403932781187077', '1346775491550474240', 'grpc', 'grpc', '/plug/grpc', 'grpc', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187078', '1346775491550474240', 'redirect', 'redirect', '/plug/redirect', 'redirect', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -1668,15 +1650,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932877656096', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932877656097', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656098', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4jRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656099', '1529403932781187074', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:resilience4j:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656100', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656101', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656102', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656103', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656104', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656105', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656106', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656107', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:tarsRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932877656108', '1529403932781187075', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:tars:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656109', '1529403932781187076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656110', '1529403932781187076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932877656111', '1529403932781187076', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:contextPathSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2845,7 +2818,6 @@ INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822145','64933 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'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); 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..4c674e0a65ac 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 tars plugin */ +DELETE FROM `api_rule_relation` WHERE `rule_id` IN ( + SELECT `id` FROM (SELECT `r`.`id` + FROM `rule` `r` + INNER JOIN `selector` `s` ON `r`.`selector_id` = `s`.`id` + WHERE `s`.`plugin_id` = '13') AS `tars_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` = '13') AS `tars_rule_ids` +); +DELETE FROM `rule` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '13') AS `tars_selector_ids` +); +DELETE FROM `selector_condition` WHERE `selector_id` IN ( + SELECT `id` FROM (SELECT `id` FROM `selector` WHERE `plugin_id` = '13') AS `tars_selector_ids` +); +DELETE FROM `selector` WHERE `plugin_id` = '13'; +DELETE FROM `meta_data` WHERE `rpc_type` = 'tars'; +DELETE FROM `api` WHERE `rpc_type` = 'tars'; +DELETE FROM `permission` WHERE `resource_id` IN ('1529402639284355075', '1529402639368241188', '1529402639368241189', '1529402639368241190', '1529402639368241191', '1529402639368241192', '1529402639368241193', '1529402639368241194', '1529402639368241195', '1529402639368241196'); +DELETE FROM `resource` WHERE `id` IN ('1529402639284355075', '1529402639368241188', '1529402639368241189', '1529402639368241190', '1529402639368241191', '1529402639368241192', '1529402639368241193', '1529402639368241194', '1529402639368241195', '1529402639368241196'); +DELETE FROM `namespace_plugin_rel` WHERE `plugin_id` = '13'; +DELETE FROM `plugin_handle` WHERE `plugin_id` = '13'; +DELETE FROM `plugin` WHERE `id` = '13'; +ALTER TABLE `api` MODIFY COLUMN `rpc_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'http,dubbo,sofa,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..7bd583aba6e6 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 tars plugin */ +DELETE FROM "public"."api_rule_relation" WHERE "rule_id" IN ( + SELECT "id" FROM ( + SELECT "r"."id" + FROM "public"."rule" "r" + INNER JOIN "public"."selector" "s" ON "r"."selector_id" = "s"."id" + WHERE "s"."plugin_id" = '13' + ) AS "tars_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" = '13' + ) AS "tars_rule_ids" +); +DELETE FROM "public"."rule" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '13') AS "tars_selector_ids" +); +DELETE FROM "public"."selector_condition" WHERE "selector_id" IN ( + SELECT "id" FROM (SELECT "id" FROM "public"."selector" WHERE "plugin_id" = '13') AS "tars_selector_ids" +); +DELETE FROM "public"."selector" WHERE "plugin_id" = '13'; +DELETE FROM "public"."meta_data" WHERE "rpc_type" = 'tars'; +DELETE FROM "public"."api" WHERE "rpc_type" = 'tars'; +DELETE FROM "public"."permission" WHERE "resource_id" IN ('1529403932781187075', '1529403932877656100', '1529403932877656101', '1529403932877656102', '1529403932877656103', '1529403932877656104', '1529403932877656105', '1529403932877656106', '1529403932877656107', '1529403932877656108'); +DELETE FROM "public"."resource" WHERE "id" IN ('1529403932781187075', '1529403932877656100', '1529403932877656101', '1529403932877656102', '1529403932877656103', '1529403932877656104', '1529403932877656105', '1529403932877656106', '1529403932877656107', '1529403932877656108'); +DELETE FROM "public"."namespace_plugin_rel" WHERE "plugin_id" = '13'; +DELETE FROM "public"."plugin_handle" WHERE "plugin_id" = '13'; +DELETE FROM "public"."plugin" WHERE "id" = '13'; +COMMENT ON COLUMN "public"."api"."rpc_type" IS 'http,dubbo,sofa,websocket,springCloud,motan,grpc'; diff --git a/pom.xml b/pom.xml index 7cd7fb444f68..ed73ee78a55f 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,6 @@ 2.5.0 5.13.0 2.1.1 - 1.7.2 5.7.0 3.0.1 3.9.5 @@ -424,12 +423,6 @@ ${springdoc.version} - - com.tencent.tars - tars-spring-boot-starter - ${tars.version} - - com.alibaba.nacos nacos-client 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..a188fefa4515 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/ApiDTO.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/ApiDTO.java @@ -75,7 +75,7 @@ public class ApiDTO implements Serializable { private String version; /** - * http,dubbo,sofa,tars,websocket,springCloud,motan,grpc. + * http,dubbo,sofa,websocket,springCloud,motan,grpc. */ private String rpcType; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java index c85fce9959e2..d9d7b393a338 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/entity/ApiDO.java @@ -66,7 +66,7 @@ public class ApiDO { private String version; /** - * http,dubbo,sofa,tars,websocket,springCloud,motan,grpc. + * http,dubbo,sofa,websocket,springCloud,motan,grpc. */ private String rpcType; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java index a9088f515b95..763673e10c45 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/vo/ApiVO.java @@ -68,7 +68,7 @@ public class ApiVO implements Serializable { private String version; /** - * http,dubbo,sofa,tars,websocket,springCloud,motan,grpc. + * http,dubbo,sofa,websocket,springCloud,motan,grpc. */ private String rpcType; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/TarsSelectorHandleConverter.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/TarsSelectorHandleConverter.java deleted file mode 100644 index a7bcce4c3a84..000000000000 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/TarsSelectorHandleConverter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.admin.service.converter; - -import org.apache.shenyu.admin.utils.CommonUpstreamUtils; -import org.apache.shenyu.common.dto.convert.selector.CommonUpstream; -import org.apache.shenyu.common.dto.convert.selector.TarsUpstream; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * The type Tars selector handle converter. - */ -@Component -public class TarsSelectorHandleConverter extends AbstractSelectorHandleConverter implements SelectorHandleConverter { - - @Override - public List convertUpstream(final String handle) { - return CommonUpstreamUtils.convertCommonUpstreamList(convert(handle)); - } - - @Override - public String pluginName() { - return PluginEnum.TARS.getName(); - } - - /** - * Do handle object. - * - * @param handle the handle - * @param aliveList the alive list - * @return the object - */ - @Override - protected Object doHandle(final String handle, final List aliveList) { - List existList = updateStatusAndFilter(convert(handle), aliveList); - aliveList.stream().filter(alive -> existList.stream().noneMatch(valid -> valid.getUpstreamUrl().equals(alive.getUpstreamUrl()))) - .forEach(alive -> existList.add(CommonUpstreamUtils.buildAliveTarsUpstream(alive.getUpstreamUrl()))); - existList.removeIf(e -> aliveList.stream().noneMatch(alive -> alive.getUpstreamUrl().equals(e.getUpstreamUrl()))); - return existList; - } - - private List convert(final String handle) { - return GsonUtils.getInstance().fromList(handle, TarsUpstream.class); - } -} diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterTarsServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterTarsServiceImpl.java deleted file mode 100644 index 2f6fd65b66f3..000000000000 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterTarsServiceImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.admin.service.register; - -import org.apache.commons.collections4.CollectionUtils; -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.admin.service.converter.TarsSelectorHandleConverter; -import org.apache.shenyu.admin.utils.CommonUpstreamUtils; -import org.apache.shenyu.common.dto.convert.selector.TarsUpstream; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.common.utils.GsonUtils; -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.springframework.stereotype.Service; - -import jakarta.annotation.Resource; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.stream.Collectors; - -/** - * tars service register. - */ -@Service -public class ShenyuClientRegisterTarsServiceImpl extends AbstractShenyuClientRegisterServiceImpl { - - @Resource - private TarsSelectorHandleConverter tarsSelectorHandleConverter; - - @Override - public String rpcType() { - return RpcTypeEnum.TARS.getName(); - } - - @Override - protected String selectorHandler(final MetaDataRegisterDTO metaDataDTO) { - return ""; - } - - @Override - protected String ruleHandler() { - return ""; - } - - @Override - protected void registerMetadata(final MetaDataRegisterDTO metaDataDTO) { - MetaDataService metaDataService = getMetaDataService(); - MetaDataDO exist = metaDataService.findByServiceNameAndMethodNameAndNamespaceId(metaDataDTO.getServiceName(), metaDataDTO.getMethodName(), metaDataDTO.getNamespaceId()); - metaDataService.saveOrUpdateMetaData(exist, metaDataDTO); - } - - @Override - protected String buildHandle(final List uriList, final SelectorDO selectorDO) { - List addList = buildTarsUpstreamList(uriList); - List canAddList = new CopyOnWriteArrayList<>(); - boolean isEventDeleted = uriList.size() == 1 && EventType.DELETED.equals(uriList.get(0).getEventType()); - if (isEventDeleted) { - addList.get(0).setStatus(false); - } - List existList = GsonUtils.getInstance().fromCurrentList(selectorDO.getHandle(), TarsUpstream.class); - if (CollectionUtils.isEmpty(existList)) { - canAddList = addList; - } else { - List diffList = addList.stream().filter(upstream -> !existList.contains(upstream)).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(diffList)) { - canAddList.addAll(diffList); - existList.addAll(diffList); - } - List diffStatusList = addList.stream().filter(upstream -> !upstream.isStatus() - || existList.stream().anyMatch(e -> e.equals(upstream) && e.isStatus() != upstream.isStatus())).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(diffStatusList)) { - canAddList.addAll(diffStatusList); - } - } - - if (doSubmit(selectorDO.getId(), canAddList)) { - return null; - } - return GsonUtils.getInstance().toJson(CollectionUtils.isEmpty(existList) ? canAddList : existList); - } - - private List buildTarsUpstreamList(final List uriList) { - return uriList.stream().map(dto -> CommonUpstreamUtils.buildDefaultTarsUpstream(dto.getHost(), dto.getPort())) - .collect(Collectors.toCollection(CopyOnWriteArrayList::new)); - } -} diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/CommonUpstreamUtils.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/CommonUpstreamUtils.java index 6a6cdc5c2e26..03f6f2f1e4f2 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/CommonUpstreamUtils.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/CommonUpstreamUtils.java @@ -24,7 +24,6 @@ import org.apache.shenyu.common.dto.convert.selector.DivideUpstream; import org.apache.shenyu.common.dto.convert.selector.DubboUpstream; import org.apache.shenyu.common.dto.convert.selector.GrpcUpstream; -import org.apache.shenyu.common.dto.convert.selector.TarsUpstream; import org.apache.shenyu.common.dto.convert.selector.WebSocketUpstream; import org.apache.shenyu.register.common.enums.EventType; @@ -208,34 +207,6 @@ public static GrpcUpstream buildAliveGrpcUpstream(final String upstreamUrl) { .timestamp(System.currentTimeMillis()).build(); } - /** - * Build default tars upstream tars upstream. - * - * @param host the host - * @param port the port - * @return the tars upstream - */ - public static TarsUpstream buildDefaultTarsUpstream(final String host, final Integer port) { - return TarsUpstream.builder().upstreamUrl(buildUrl(host, port)) - .weight(DEFAULT_WEIGHT).warmup(Constants.WARMUP_TIME) - .timestamp(System.currentTimeMillis()) - .status(Objects.nonNull(port) && StringUtils.isNotBlank(host)) - .build(); - } - - /** - * Build alive tars upstream tars upstream. - * - * @param upstreamUrl the upstreamUrl - * @return the tars upstream - */ - public static TarsUpstream buildAliveTarsUpstream(final String upstreamUrl) { - return TarsUpstream.builder().upstreamUrl(upstreamUrl).weight(DEFAULT_WEIGHT) - .warmup(Constants.WARMUP_TIME) - .timestamp(System.currentTimeMillis()) - .build(); - } - /** * Convert common upstream list list. * 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..db15e335f333 100644 --- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql +++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql @@ -390,7 +390,7 @@ CREATE TABLE IF NOT EXISTS `api` `consume` varchar(255) NOT NULL COMMENT 'consume', `produce` varchar(255) NOT NULL COMMENT 'produce', `version` varchar(255) NOT NULL COMMENT 'api version,for example V0.01', - `rpc_type` varchar(64) NOT NULL COMMENT 'http,dubbo,sofa,tars,websocket,motan,grpc', + `rpc_type` varchar(64) NOT NULL COMMENT 'http,dubbo,sofa,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', @@ -568,7 +568,6 @@ INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('9 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'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) VALUES ('15', 'grpc', 'Proxy', 310,'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}','0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('16', 'redirect', 'HttpProcess', 110,'0'); @@ -671,18 +670,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 ('1529402613199978552', '5', 'headerMaxSize', 'headerMaxSize', 1, 2, 3, '{"defaultValue":"10240","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978553', '5', 'requestMaxSize', 'requestMaxSize', 1, 2, 4, '{"defaultValue":"102400","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978554', '5', 'retryStrategy', 'retryStrategy', 3, 2, 0, '{"required":"0","defaultValue":"current","placeholder":"retryStrategy","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978555', '13', 'upstreamHost', 'host', 2, 1, 0); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978556', '13', 'protocol', 'protocol', 2, 1, 2, '{"defaultValue":"","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978557', '13', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978558', '13', 'weight', 'weight', 1, 1, 3, '{"defaultValue":"50","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978559', '13', 'timestamp', 'startupTime', 1, 1, 3, '{"defaultValue":"0","placeholder":"startup timestamp","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978560', '13', 'warmup', 'warmupTime', 1, 1, 5, '{"defaultValue":"0","placeholder":"warmup time ms)","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978561', '13', 'status', 'status', 3, 1, 6, '{"defaultValue":"true","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978562', '13', 'loadBalance', 'loadStrategy', 3, 2, 0); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978563', '13', 'retry', 'retryCount', 1, 2, 1); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978564', '13', 'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978565', '13', 'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES ('1529402613199978566', '13', 'multiRuleHandle', 'multiRuleHandle', 3, 3, 1); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978567', '15', 'upstreamUrl', 'ip:port', 2, 1, 1, '{"required":"1","placeholder":"","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978568', '15', 'weight', 'weight', 1, 1, 3, '{"defaultValue":"50","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613199978569', '15', 'status', 'status', 3, 1, 6, '{"defaultValue":"true","rule":""}'); @@ -782,10 +769,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 ('1729402613204172865', '30', 'maxActive', 'maxActive', 1, 1, 9, '{"required":"0","defaultValue":"8","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1729402613204172866', '30', 'maxWait', 'maxWait', 3, 1, 10, '{"required":"0","defaultValue":"-1","rule":""}'); INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172867', '30', 'timeoutSeconds', 'timeoutSeconds', 1, 2, 0, '{"required":"0","defaultValue":"60","rule":""}'); -INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES ('1529402613204172868', '13', 'corethreads', 'corethreads', 1, 3, 3, '{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}'); -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":""}'); @@ -1444,7 +1427,6 @@ INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `con INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('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'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822151','649330b6-c2d7-4edc-be8e-8a54df9eb385','15', '{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822152','649330b6-c2d7-4edc-be8e-8a54df9eb385','16', NULL, 110, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterDivideServiceImplTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterDivideServiceImplTest.java index cda0c97b442a..2cad3720aa3e 100644 --- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterDivideServiceImplTest.java +++ b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterDivideServiceImplTest.java @@ -23,7 +23,6 @@ import org.apache.shenyu.admin.service.impl.MetaDataServiceImpl; import org.apache.shenyu.common.dto.convert.rule.impl.DivideRuleHandle; import org.apache.shenyu.common.dto.convert.selector.DivideUpstream; -import org.apache.shenyu.common.dto.convert.selector.TarsUpstream; import org.apache.shenyu.common.enums.RpcTypeEnum; import org.apache.shenyu.common.exception.ShenyuException; import org.apache.shenyu.common.utils.GsonUtils; @@ -108,10 +107,10 @@ public void testBuildHandle() { when(selectorDO.getHandle()).thenReturn(returnStr); doReturn(false).when(shenyuClientRegisterDivideService).doSubmit(any(), any()); String actual = shenyuClientRegisterDivideService.buildHandle(list, selectorDO); - List expectedList = GsonUtils.getInstance().fromCurrentList(expected, TarsUpstream.class); - List actualList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + List expectedList = GsonUtils.getInstance().fromCurrentList(expected, DivideUpstream.class); + List actualList = GsonUtils.getInstance().fromCurrentList(actual, DivideUpstream.class); assertEquals(expectedList, actualList); - List resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + List resultList = GsonUtils.getInstance().fromCurrentList(actual, DivideUpstream.class); assertEquals(resultList.size(), 2); list.clear(); @@ -120,7 +119,7 @@ public void testBuildHandle() { when(selectorDO.getHandle()).thenReturn(returnStr); doReturn(false).when(shenyuClientRegisterDivideService).doSubmit(any(), any()); actual = shenyuClientRegisterDivideService.buildHandle(list, selectorDO); - resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + resultList = GsonUtils.getInstance().fromCurrentList(actual, DivideUpstream.class); assertEquals(resultList.size(), 3); list.clear(); @@ -128,7 +127,7 @@ public void testBuildHandle() { doReturn(false).when(shenyuClientRegisterDivideService).doSubmit(any(), any()); selectorDO = mock(SelectorDO.class); actual = shenyuClientRegisterDivideService.buildHandle(list, selectorDO); - resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + resultList = GsonUtils.getInstance().fromCurrentList(actual, DivideUpstream.class); assertEquals(resultList.size(), 1); } diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImplTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImplTest.java index 7e731fadb8bd..0ee795266b34 100644 --- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImplTest.java +++ b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterGrpcServiceImplTest.java @@ -21,7 +21,7 @@ import org.apache.shenyu.admin.model.entity.MetaDataDO; import org.apache.shenyu.admin.model.entity.SelectorDO; import org.apache.shenyu.admin.service.impl.MetaDataServiceImpl; -import org.apache.shenyu.common.dto.convert.selector.TarsUpstream; +import org.apache.shenyu.common.dto.convert.selector.GrpcUpstream; import org.apache.shenyu.common.enums.RpcTypeEnum; import org.apache.shenyu.common.exception.ShenyuException; import org.apache.shenyu.common.utils.GsonUtils; @@ -106,10 +106,10 @@ public void testBuildHandle() { when(selectorDO.getHandle()).thenReturn(returnStr); doReturn(false).when(shenyuClientRegisterGrpcService).doSubmit(any(), any()); String actual = shenyuClientRegisterGrpcService.buildHandle(list, selectorDO); - List expectedList = GsonUtils.getInstance().fromCurrentList(expected, TarsUpstream.class); - List actualList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + List expectedList = GsonUtils.getInstance().fromCurrentList(expected, GrpcUpstream.class); + List actualList = GsonUtils.getInstance().fromCurrentList(actual, GrpcUpstream.class); assertEquals(expectedList, actualList); - List resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + List resultList = GsonUtils.getInstance().fromCurrentList(actual, GrpcUpstream.class); assertEquals(resultList.size(), 2); list.clear(); @@ -118,7 +118,7 @@ public void testBuildHandle() { when(selectorDO.getHandle()).thenReturn(returnStr); doReturn(false).when(shenyuClientRegisterGrpcService).doSubmit(any(), any()); actual = shenyuClientRegisterGrpcService.buildHandle(list, selectorDO); - resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + resultList = GsonUtils.getInstance().fromCurrentList(actual, GrpcUpstream.class); assertEquals(resultList.size(), 3); list.clear(); @@ -126,7 +126,7 @@ public void testBuildHandle() { doReturn(false).when(shenyuClientRegisterGrpcService).doSubmit(any(), any()); selectorDO = mock(SelectorDO.class); actual = shenyuClientRegisterGrpcService.buildHandle(list, selectorDO); - resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); + resultList = GsonUtils.getInstance().fromCurrentList(actual, GrpcUpstream.class); assertEquals(resultList.size(), 1); } @@ -138,7 +138,7 @@ public void testBuildGrpcUpstreamList() { try { Method testMethod = shenyuClientRegisterGrpcService.getClass().getDeclaredMethod("buildGrpcUpstreamList", List.class); testMethod.setAccessible(true); - List result = (List) testMethod.invoke(shenyuClientRegisterGrpcService, list); + List result = (List) testMethod.invoke(shenyuClientRegisterGrpcService, list); assertEquals(result.size(), 2); } catch (Exception e) { throw new ShenyuException(e.getCause()); diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterTarsServiceImplTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterTarsServiceImplTest.java deleted file mode 100644 index 8b3c264dbead..000000000000 --- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/register/ShenyuClientRegisterTarsServiceImplTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.admin.service.register; - -import org.apache.commons.lang3.StringUtils; -import org.apache.shenyu.admin.model.entity.MetaDataDO; -import org.apache.shenyu.admin.model.entity.SelectorDO; -import org.apache.shenyu.admin.service.impl.MetaDataServiceImpl; -import org.apache.shenyu.common.dto.convert.selector.TarsUpstream; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.common.exception.ShenyuException; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.mockito.junit.jupiter.MockitoSettings; -import org.mockito.quality.Strictness; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -import static org.apache.shenyu.common.constant.Constants.SYS_DEFAULT_NAMESPACE_ID; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -/** - * Test cases for {@link ShenyuClientRegisterTarsServiceImpl}. - */ -@ExtendWith(MockitoExtension.class) -@MockitoSettings(strictness = Strictness.LENIENT) -public final class ShenyuClientRegisterTarsServiceImplTest { - - @InjectMocks - private ShenyuClientRegisterTarsServiceImpl shenyuClientRegisterTarsService; - - @Mock - private MetaDataServiceImpl metaDataService; - - @Test - public void testRpcType() { - assertEquals(RpcTypeEnum.TARS.getName(), shenyuClientRegisterTarsService.rpcType()); - } - - @Test - public void testSelectorHandler() { - MetaDataRegisterDTO metaDataRegisterDTO = MetaDataRegisterDTO.builder().build(); - assertEquals(StringUtils.EMPTY, shenyuClientRegisterTarsService.selectorHandler(metaDataRegisterDTO)); - } - - @Test - public void testRuleHandler() { - assertEquals(StringUtils.EMPTY, shenyuClientRegisterTarsService.ruleHandler()); - } - - @Test - public void testRegisterMetadata() { - MetaDataDO metaDataDO = MetaDataDO.builder().build(); - String serviceName = "metaDataService"; - String methodName = "registerMetadata"; - when(metaDataService.findByServiceNameAndMethodNameAndNamespaceId(any(), any(), any())).thenReturn(metaDataDO); - MetaDataRegisterDTO metaDataDTO = MetaDataRegisterDTO - .builder() - .serviceName(serviceName) - .methodName(methodName) - .namespaceId(SYS_DEFAULT_NAMESPACE_ID) - .build(); - shenyuClientRegisterTarsService.registerMetadata(metaDataDTO); - verify(metaDataService).findByServiceNameAndMethodNameAndNamespaceId(serviceName, methodName, SYS_DEFAULT_NAMESPACE_ID); - verify(metaDataService).saveOrUpdateMetaData(metaDataDO, metaDataDTO); - } - - @Test - public void testBuildHandle() { - shenyuClientRegisterTarsService = spy(shenyuClientRegisterTarsService); - - final String returnStr = "[{upstreamUrl:'localhost:8090',weight:1,warmup:10,status:true,timestamp:1637826588267,\"gray\":false}," - + "{upstreamUrl:'localhost:8091',weight:2,warmup:10,status:true,timestamp:1637826588267,\"gray\":false}]"; - final String expected = "[{\"weight\":1,\"warmup\":10,\"upstreamUrl\":\"localhost:8090\",\"status\":true,\"timestamp\":1637826588267,\"gray\":false}," - + "{\"weight\":2,\"warmup\":10,\"upstreamUrl\":\"localhost:8091\",\"status\":true,\"timestamp\":1637826588267,\"gray\":false}]"; - List list = new ArrayList<>(); - list.add(URIRegisterDTO.builder().appName("test1").rpcType(RpcTypeEnum.TARS.getName()).host("localhost").port(8090).build()); - SelectorDO selectorDO = mock(SelectorDO.class); - when(selectorDO.getHandle()).thenReturn(returnStr); - doReturn(false).when(shenyuClientRegisterTarsService).doSubmit(any(), any()); - String actual = shenyuClientRegisterTarsService.buildHandle(list, selectorDO); - List expectedList = GsonUtils.getInstance().fromCurrentList(expected, TarsUpstream.class); - List actualList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); - assertEquals(expectedList, actualList); - List resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); - assertEquals(resultList.size(), 2); - - list.clear(); - list.add(URIRegisterDTO.builder().appName("test1").rpcType(RpcTypeEnum.TARS.getName()).host("localhost").port(8092).build()); - selectorDO = mock(SelectorDO.class); - when(selectorDO.getHandle()).thenReturn(returnStr); - doReturn(false).when(shenyuClientRegisterTarsService).doSubmit(any(), any()); - actual = shenyuClientRegisterTarsService.buildHandle(list, selectorDO); - resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); - assertEquals(resultList.size(), 3); - - list.clear(); - list.add(URIRegisterDTO.builder().appName("test1").rpcType(RpcTypeEnum.TARS.getName()).host("localhost").port(8090).build()); - doReturn(false).when(shenyuClientRegisterTarsService).doSubmit(any(), any()); - selectorDO = mock(SelectorDO.class); - actual = shenyuClientRegisterTarsService.buildHandle(list, selectorDO); - resultList = GsonUtils.getInstance().fromCurrentList(actual, TarsUpstream.class); - assertEquals(resultList.size(), 1); - } - - @Test - public void testBuildTarsUpstreamList() { - List list = new ArrayList<>(); - list.add(URIRegisterDTO.builder().appName("test1").rpcType(RpcTypeEnum.TARS.getName()).host("localhost").port(8090).build()); - list.add(URIRegisterDTO.builder().appName("test2").rpcType(RpcTypeEnum.TARS.getName()).host("localhost").port(8091).build()); - try { - Method testMethod = shenyuClientRegisterTarsService.getClass().getDeclaredMethod("buildTarsUpstreamList", List.class); - testMethod.setAccessible(true); - List result = (List) testMethod.invoke(shenyuClientRegisterTarsService, list); - assertEquals(result.size(), 2); - } catch (Exception e) { - throw new ShenyuException(e.getCause()); - } - } -} diff --git a/shenyu-bootstrap/pom.xml b/shenyu-bootstrap/pom.xml index abe6c1598f4b..f4d38fd6467f 100644 --- a/shenyu-bootstrap/pom.xml +++ b/shenyu-bootstrap/pom.xml @@ -217,20 +217,6 @@ - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-tars - ${project.version} - - - - com.tencent.tars - tars-client - 1.7.2 - - - org.apache.shenyu diff --git a/shenyu-client/pom.xml b/shenyu-client/pom.xml index 99c44202b153..066994a0ea96 100644 --- a/shenyu-client/pom.xml +++ b/shenyu-client/pom.xml @@ -32,7 +32,6 @@ shenyu-client-mcp shenyu-client-dubbo shenyu-client-sofa - shenyu-client-tars shenyu-client-grpc shenyu-client-motan shenyu-client-websocket diff --git a/shenyu-client/shenyu-client-tars/pom.xml b/shenyu-client/shenyu-client-tars/pom.xml deleted file mode 100644 index 24fa1261f392..000000000000 --- a/shenyu-client/shenyu-client-tars/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-client - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-client-tars - - - - org.apache.shenyu - shenyu-client-core - ${project.version} - - - - com.tencent.tars - tars-spring-boot-starter - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-log4j12 - - - log4j - log4j - - - org.springframework.boot - spring-boot-dependencies - - - com.google.guava - guava - - - provided - - - org.springframework.boot - spring-boot-test - test - - - diff --git a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanEventListener.java b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanEventListener.java deleted file mode 100644 index 59891e1a79e4..000000000000 --- a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/TarsServiceBeanEventListener.java +++ /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. - */ - -package org.apache.shenyu.client.tars; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.shenyu.client.core.client.AbstractContextRefreshedEventListener; -import org.apache.shenyu.client.core.constant.ShenyuClientConstants; -import org.apache.shenyu.client.core.disruptor.ShenyuClientRegisterEventPublisher; -import org.apache.shenyu.client.core.exception.ShenyuClientIllegalArgumentException; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsClient; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsService; -import org.apache.shenyu.client.tars.common.dto.TarsRpcExt; -import org.apache.shenyu.common.enums.ApiHttpMethodEnum; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.common.config.ShenyuClientConfig; -import org.apache.shenyu.register.common.dto.MetaDataRegisterDTO; -import org.apache.shenyu.register.common.dto.URIRegisterDTO; -import org.apache.shenyu.register.common.enums.EventType; -import org.javatuples.Sextet; -import org.springframework.aop.support.AopUtils; -import org.springframework.context.ApplicationContext; - -import org.springframework.core.StandardReflectionParameterNameDiscoverer; -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; -import org.springframework.util.ReflectionUtils; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Properties; -import java.util.stream.Collectors; - -/** - * The Tars ServiceBean EventListener. - */ -public class TarsServiceBeanEventListener extends AbstractContextRefreshedEventListener { - - private final StandardReflectionParameterNameDiscoverer localVariableTableParameterNameDiscoverer = new StandardReflectionParameterNameDiscoverer(); - - private final ShenyuClientRegisterEventPublisher publisher = ShenyuClientRegisterEventPublisher.getInstance(); - - private final String contextPath; - - private final String ipAndPort; - - public TarsServiceBeanEventListener(final ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) { - super(clientConfig, shenyuClientRegisterRepository); - Properties props = clientConfig.getClient().get(getClientName()).getProps(); - String contextPath = props.getProperty(ShenyuClientConstants.CONTEXT_PATH); - String port = props.getProperty(ShenyuClientConstants.PORT); - if (StringUtils.isAnyBlank(contextPath, this.getHost(), port)) { - throw new ShenyuClientIllegalArgumentException("tars client must config the contextPath, ipAndPort"); - } - this.contextPath = contextPath; - this.ipAndPort = this.getHost() + ":" + port; - publisher.start(shenyuClientRegisterRepository); - } - - @Override - protected Sextet buildApiDocSextet(final Method method, final Annotation annotation, final Map beans) { - ShenyuTarsClient shenyuTarsClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuTarsClient.class); - if (Objects.isNull(shenyuTarsClient)) { - return null; - } - String produce = ShenyuClientConstants.MEDIA_TYPE_ALL_VALUE; - String consume = ShenyuClientConstants.MEDIA_TYPE_ALL_VALUE; - String[] values = new String[]{shenyuTarsClient.value()}; - ApiHttpMethodEnum[] apiHttpMethodEnums = new ApiHttpMethodEnum[]{ApiHttpMethodEnum.NOT_HTTP}; - String version = "v0.01"; - return Sextet.with(values, consume, produce, apiHttpMethodEnums, RpcTypeEnum.TARS, version); - } - - @Override - protected Map getBeans(final ApplicationContext context) { - return context.getBeansWithAnnotation(ShenyuTarsService.class); - } - - @Override - protected URIRegisterDTO buildURIRegisterDTO(final ApplicationContext context, - final Map beans, - final String namespaceId) { - return URIRegisterDTO.builder() - .contextPath(this.contextPath) - .appName(this.ipAndPort) - .rpcType(RpcTypeEnum.TARS.getName()) - .eventType(EventType.REGISTER) - .host(this.getHost()) - .port(Integer.parseInt(this.getPort())) - .namespaceId(namespaceId) - .build(); - } - - @Override - protected String getClientName() { - return RpcTypeEnum.TARS.getName(); - } - - @Override - protected String buildApiSuperPath(final Class clazz, @Nullable final ShenyuTarsClient shenyuTarsClient) { - if (Objects.nonNull(shenyuTarsClient) && !StringUtils.isBlank(shenyuTarsClient.path())) { - return shenyuTarsClient.path(); - } - return ""; - } - - @Override - protected Class getAnnotationType() { - return ShenyuTarsClient.class; - } - - @Override - public void handle(final String beanName, final Object bean) { - Class clazz = bean.getClass(); - if (AopUtils.isAopProxy(bean)) { - clazz = AopUtils.getTargetClass(bean); - } - final ShenyuTarsClient beanTarsClient = AnnotatedElementUtils.findMergedAnnotation(clazz, ShenyuTarsClient.class); - final String superPath = buildApiSuperPath(clazz, beanTarsClient); - List namespaceIds = super.getNamespace(); - if (superPath.contains("*") && Objects.nonNull(beanTarsClient)) { - Method[] declaredMethods = ReflectionUtils.getDeclaredMethods(clazz); - for (String namespaceId : namespaceIds) { - for (Method declaredMethod : declaredMethods) { - publisher.publishEvent(buildMetaDataDTO(bean, beanTarsClient, buildApiPath(declaredMethod, superPath, beanTarsClient), clazz, declaredMethod, namespaceId)); - } - } - return; - } - Method[] methods = ReflectionUtils.getUniqueDeclaredMethods(clazz); - for (String namespaceId : namespaceIds) { - for (Method method : methods) { - ShenyuTarsClient shenyuTarsClient = AnnotatedElementUtils.findMergedAnnotation(method, ShenyuTarsClient.class); - if (Objects.nonNull(shenyuTarsClient)) { - publisher.publishEvent(buildMetaDataDTO(bean, shenyuTarsClient, buildApiPath(method, superPath, shenyuTarsClient), clazz, method, namespaceId)); - } - } - } - } - - @Override - public MetaDataRegisterDTO buildMetaDataDTO(final Object bean, - @NonNull final ShenyuTarsClient shenyuTarsClient, - final String path, final Class clazz, - final Method method, final String namespaceId) { - String serviceName = clazz.getAnnotation(ShenyuTarsService.class).serviceName(); - String ipAndPort = this.ipAndPort; - String desc = shenyuTarsClient.desc(); - String configRuleName = shenyuTarsClient.ruleName(); - String ruleName = ("".equals(configRuleName)) ? path : configRuleName; - String methodName = method.getName(); - Class[] parameterTypesClazz = method.getParameterTypes(); - String parameterTypes = Arrays.stream(parameterTypesClazz).map(Class::getName) - .collect(Collectors.joining(",")); - return MetaDataRegisterDTO.builder() - .appName(ipAndPort) - .serviceName(serviceName) - .methodName(methodName) - .contextPath(this.contextPath) - .path(path) - .host(super.getHost()) - .port(Integer.parseInt(this.getPort())) - .ruleName(ruleName) - .pathDesc(desc) - .parameterTypes(parameterTypes) - .rpcType(RpcTypeEnum.TARS.getName()) - .rpcExt(buildRpcExtJson(method)) - .enabled(shenyuTarsClient.enabled()) - .namespaceId(namespaceId) - .build(); - } - - @Override - protected String buildApiPath(final Method method, final String superPath, final ShenyuTarsClient shenyuTarsClient) { - return superPath.contains("*") - ? pathJoin(contextPath, superPath.replace("*", ""), method.getName()) - : pathJoin(contextPath, superPath, shenyuTarsClient.path()); - } - - private TarsRpcExt.RpcExt buildRpcExt(final Method method) { - String[] paramNames = localVariableTableParameterNameDiscoverer.getParameterNames(method); - List> params = new ArrayList<>(); - if (Objects.nonNull(paramNames) && paramNames.length > 0) { - Class[] paramTypes = method.getParameterTypes(); - for (int i = 0; i < paramNames.length; i++) { - params.add(Pair.of(paramTypes[i].getName(), paramNames[i])); - } - } - return new TarsRpcExt.RpcExt(method.getName(), params, method.getReturnType().getName()); - } - - private String buildRpcExtJson(final Method method) { - List list = new ArrayList<>(); - list.add(buildRpcExt(method)); - TarsRpcExt buildList = new TarsRpcExt(list); - return GsonUtils.getInstance().toJson(buildList); - } -} diff --git a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/annotation/ShenyuTarsClient.java b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/annotation/ShenyuTarsClient.java deleted file mode 100644 index d3f6a5af02bb..000000000000 --- a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/annotation/ShenyuTarsClient.java +++ /dev/null @@ -1,72 +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.tars.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 ShenyuTarsClient { - - /** - * Path string. - * - * @return the string - */ - @AliasFor(attribute = "path") - String value() default ""; - - /** - * Path string. - * - * @return the string - */ - @AliasFor(attribute = "value") - String path() default ""; - - /** - * Rule name string. - * - * @return the string - */ - String ruleName() default ""; - - /** - * Desc string. - * - * @return String string - */ - String desc() default ""; - - /** - * Enabled boolean. - * - * @return the boolean - */ - boolean enabled() default true; -} diff --git a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/annotation/ShenyuTarsService.java b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/annotation/ShenyuTarsService.java deleted file mode 100644 index 5d634d5f32fb..000000000000 --- a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/annotation/ShenyuTarsService.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.client.tars.common.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Shenyu tars service annotation. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ShenyuTarsService { - /** - * Service name. - * - * @return the service name - */ - String serviceName(); -} diff --git a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/dto/TarsRpcExt.java b/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/dto/TarsRpcExt.java deleted file mode 100644 index c393c7c4ea64..000000000000 --- a/shenyu-client/shenyu-client-tars/src/main/java/org/apache/shenyu/client/tars/common/dto/TarsRpcExt.java +++ /dev/null @@ -1,168 +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.tars.common.dto; - -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; - -/** - * The type Tars rpc ext. - */ -public class TarsRpcExt { - - /** - * in order to be compatible with the old version, - * we can't change the type of this field. - */ - private List methodInfo; - - /** - * constructor without params. - */ - public TarsRpcExt() { - } - - /** - * constructor with all params. - * - * @param methodInfo methodInfo - */ - public TarsRpcExt(final List methodInfo) { - this.methodInfo = methodInfo; - } - - /** - * get methodInfo. - * - * @return methodInfo - */ - public List getMethodInfo() { - return methodInfo; - } - - /** - * set methodInfo. - * - * @param methodInfo methodInfo - */ - public void setMethodInfo(final List methodInfo) { - this.methodInfo = methodInfo; - } - - @Override - public String toString() { - return "TarsRpcExt{" - + "methodInfo=" + methodInfo - + '}'; - } - - /** - * The type Rpc ext. - */ - public static class RpcExt { - - private String methodName; - - private List> params; - - private String returnType; - - /** - * constructor without params. - */ - public RpcExt() { - } - - /** - * constructor with params. - * - * @param methodName methodName - * @param params params - * @param returnType returnType - */ - public RpcExt(final String methodName, final List> params, final String returnType) { - this.methodName = methodName; - this.params = params; - this.returnType = returnType; - } - - /** - * get methodName. - * - * @return methodName - */ - public String getMethodName() { - return methodName; - } - - /** - * set methodName. - * - * @param methodName methodName - */ - public void setMethodName(final String methodName) { - this.methodName = methodName; - } - - /** - * get params. - * - * @return params. - */ - public List> getParams() { - return params; - } - - /** - * set params. - * - * @param params params - */ - public void setParams(final List> params) { - this.params = params; - } - - /** - * get returnType. - * - * @return returnType - */ - public String getReturnType() { - return returnType; - } - - /** - * set returnType. - * - * @param returnType returnType - */ - public void setReturnType(final String returnType) { - this.returnType = returnType; - } - - @Override - public String toString() { - return "RpcExt{" - + "methodName='" + methodName + '\'' - + ", params=" + params - + ", returnType='" + returnType + '\'' - + '}'; - } - } -} diff --git a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsRpcExtTest.java b/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsRpcExtTest.java deleted file mode 100644 index f30dba8e2d9d..000000000000 --- a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsRpcExtTest.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.client.tars; - -import org.apache.shenyu.client.tars.common.dto.TarsRpcExt; -import org.junit.jupiter.api.Assertions; -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 java.util.ArrayList; -import java.util.List; - -/** - * Test case for {@link TarsRpcExt}. - */ -@ExtendWith(MockitoExtension.class) -@TestMethodOrder(MethodOrderer.Alphanumeric.class) -public class TarsRpcExtTest { - - @Test - public void testTarsRpcExt() { - TarsRpcExt.RpcExt rpcExt = new TarsRpcExt.RpcExt(); - rpcExt.setMethodName("methodName"); - rpcExt.setParams(null); - rpcExt.setReturnType("returnType"); - final List rpcExtList = new ArrayList<>(); - rpcExtList.add(rpcExt); - TarsRpcExt tarsRpcExt = new TarsRpcExt(); - tarsRpcExt.setMethodInfo(rpcExtList); - Assertions.assertNotNull(tarsRpcExt.toString()); - Assertions.assertNotNull(tarsRpcExt.getMethodInfo()); - Assertions.assertNotNull(rpcExt.toString()); - Assertions.assertNotNull(rpcExt.getMethodName()); - Assertions.assertNotNull(rpcExt.getReturnType()); - Assertions.assertNull(rpcExt.getParams()); - } -} - diff --git a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java b/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.java deleted file mode 100644 index 26bacfafa9ea..000000000000 --- a/shenyu-client/shenyu-client-tars/src/test/java/org/apache/shenyu/client/tars/TarsServiceBeanPostProcessorTest.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.client.tars; - -import org.apache.shenyu.client.core.exception.ShenyuClientIllegalArgumentException; -import org.apache.shenyu.client.core.register.ShenyuClientRegisterRepositoryFactory; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsClient; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsService; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.register.client.api.ShenyuClientRegisterRepository; -import org.apache.shenyu.register.client.http.utils.RegisterUtils; -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.junit.Assert; -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.Mock; -import org.mockito.MockedStatic; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.context.ApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Optional; -import java.util.Properties; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.mockStatic; -import static org.mockito.Mockito.when; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.times; - -/** - * Test case for {@link TarsServiceBeanEventListener}. - */ -@ExtendWith(MockitoExtension.class) -@TestMethodOrder(MethodOrderer.Alphanumeric.class) -public final class TarsServiceBeanPostProcessorTest { - private final MockedStatic registerUtilsMockedStatic = mockStatic(RegisterUtils.class); - - private final TarsDemoService tarsDemoService = new TarsDemoService(); - - private final TarsDemoService2 tarsDemoService2 = new TarsDemoService2(); - - private final TarsDemoService3 tarsDemoService3 = new TarsDemoService3(); - - @Mock - private ApplicationContext applicationContext; - - private ContextRefreshedEvent contextRefreshedEvent; - - @BeforeEach - public void init() { - Map results = new LinkedHashMap(); - results.put("tarsDemoService", tarsDemoService); - results.put("tarsDemoService2", tarsDemoService2); - results.put("tarsDemoService3", tarsDemoService3); - when(applicationContext.getBeansWithAnnotation(any())).thenReturn(results); - contextRefreshedEvent = new ContextRefreshedEvent(applicationContext); - - ShenyuClientConfig shenyuClientConfig = mock(ShenyuClientConfig.class); - Assert.assertThrows(ShenyuClientIllegalArgumentException.class, () -> new TarsServiceBeanEventListener(shenyuClientConfig, mock(ShenyuClientRegisterRepository.class))); - } - - @Test - public void testPostProcessAfterInitialization() { - registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token")); - TarsServiceBeanEventListener tarsServiceBeanEventListener = buildTarsServiceBeanEventListener(true); - tarsServiceBeanEventListener.onApplicationEvent(contextRefreshedEvent); - verify(applicationContext, times(2)).getBeansWithAnnotation(any()); - registerUtilsMockedStatic.close(); - } - - @Test - public void testPostProcessNormalBean() { - registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token")); - TarsServiceBeanEventListener tarsServiceBeanEventListener = buildTarsServiceBeanEventListener(false); - tarsServiceBeanEventListener.onApplicationEvent(contextRefreshedEvent); - verify(applicationContext, times(2)).getBeansWithAnnotation(any()); - registerUtilsMockedStatic.close(); - } - - private TarsServiceBeanEventListener buildTarsServiceBeanEventListener(final boolean full) { - Properties properties = new Properties(); - properties.setProperty("contextPath", "/tars"); - properties.setProperty("port", "8080"); - properties.setProperty("host", "localhost"); - properties.setProperty("username", "admin"); - properties.setProperty("password", "123456"); - - ShenyuRegisterCenterConfig mockRegisterCenter = new ShenyuRegisterCenterConfig(); - mockRegisterCenter.setServerLists("http://localhost:58080"); - mockRegisterCenter.setRegisterType("http"); - mockRegisterCenter.setProps(properties); - - ShenyuClientConfig clientConfig = new ShenyuClientConfig(); - ClientPropertiesConfig clientPropertiesConfig = new ClientPropertiesConfig(); - clientPropertiesConfig.setProps(properties); - Map client = new LinkedHashMap<>(); - client.put(RpcTypeEnum.TARS.getName(), clientPropertiesConfig); - clientConfig.setClient(client); - - return new TarsServiceBeanEventListener(clientConfig, ShenyuClientRegisterRepositoryFactory.newInstance(mockRegisterCenter)); - } - - @ShenyuTarsService(serviceName = "testObj") - static class TarsDemoService { - @ShenyuTarsClient("hello") - public String test(final String hello) { - return hello; - } - - @ShenyuTarsClient("hello2/*") - public String test2(final String hello) { - return hello; - } - } - - @ShenyuTarsService(serviceName = "testObj2") - @ShenyuTarsClient("hello2/*") - static class TarsDemoService2 { - public String test(final String hello) { - return hello; - } - } - - @ShenyuTarsService(serviceName = "testObj3") - @ShenyuTarsClient - static class TarsDemoService3 { - public String test(final String hello) { - return hello; - } - } -} 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..bb53d9a42af4 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 @@ -107,11 +107,6 @@ public interface Constants { */ String MOTAN_RPC_RESULT = "motan_rpc_result"; - /** - * The constant TARS_RPC_RESULT_EMPTY. - */ - String TARS_RPC_RESULT_EMPTY = "tars has not return value!"; - /** * The constant MOTAN_RPC_RESULT_EMPTY. */ diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/TarsRegisterConfig.java b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/TarsRegisterConfig.java deleted file mode 100644 index 4b29654d5c9e..000000000000 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/TarsRegisterConfig.java +++ /dev/null @@ -1,145 +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 tars register config. - */ -public class TarsRegisterConfig implements Serializable { - - private static final long serialVersionUID = -1124348422759120146L; - - private String threadpool; - - private Integer corethreads; - - private Integer threads; - - private Integer queues; - - /** - * get threadpool. - * - * @return threadpool - */ - public String getThreadpool() { - return threadpool; - } - - /** - * set threadpool. - * - * @param threadpool threadpool - */ - public void setThreadpool(final String threadpool) { - this.threadpool = threadpool; - } - - /** - * get corethreads. - * - * @return corethreads - */ - public Integer getCorethreads() { - return corethreads; - } - - /** - * set corethreads. - * - * @param corethreads corethreads - */ - public void setCorethreads(final Integer corethreads) { - this.corethreads = corethreads; - } - - /** - * get threads. - * - * @return threads - */ - 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; - } - TarsRegisterConfig that = (TarsRegisterConfig) o; - return 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(threadpool, corethreads, threads, queues); - } - - @Override - public String toString() { - return "TarsRegisterConfig{" - + "threadpool='" - + threadpool - + '\'' - + ", corethreads='" - + corethreads - + '\'' - + ", threads='" - + threads - + '\'' - + ", queues='" - + queues - + '\'' - + '}'; - } -} diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/TarsUpstream.java b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/TarsUpstream.java deleted file mode 100644 index 174f49c7d1ac..000000000000 --- a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/selector/TarsUpstream.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.common.dto.convert.selector; - -import java.util.Objects; - -/** - * this is tars upstream. - */ -public final class TarsUpstream extends CommonUpstream { - - /** - * weight. - */ - private int weight; - - /** - * warmup. - */ - private int warmup; - - /** - * builder constructor. - * - * @param builder builder - */ - private TarsUpstream(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 weight. - * - * @return weight - */ - public int getWeight() { - return weight; - } - - /** - * set weight. - * - * @param weight weight - */ - public void setWeight(final int weight) { - this.weight = weight; - } - - /** - * get warmup. - * - * @return warmup - */ - public int getWarmup() { - return warmup; - } - - /** - * set 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 (Objects.isNull(o) || getClass() != o.getClass()) { - return false; - } - TarsUpstream that = (TarsUpstream) o; - return Objects.equals(getUpstreamHost(), that.getUpstreamHost()) && Objects.equals(getProtocol(), that.getProtocol()) && Objects.equals(getUpstreamUrl(), that.getUpstreamUrl()); - } - - @Override - public int hashCode() { - return Objects.hash(getUpstreamHost(), getProtocol(), getUpstreamUrl()); - } - - @Override - public String toString() { - return "DivideUpstream{" - + "upstreamHost='" - + getUpstreamHost() - + '\'' - + ", protocol='" - + getProtocol() - + '\'' - + ", upstreamUrl='" - + getUpstreamUrl() - + '\'' - + ", weight=" - + weight - + ", status=" - + isStatus() - + ", timestamp=" - + getTimestamp() - + ", warmup=" - + warmup - + '}'; - } - - /** - * 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 TarsUpstream build() { - return new TarsUpstream(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..508e2a2ed1c8 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 @@ -252,11 +252,6 @@ public enum PluginEnum { */ SOFA(310, 0, "sofa"), - /** - * Tars plugin enum. - */ - TARS(310, 0, "tars"), - /** * GPRC plugin enum. */ @@ -370,6 +365,6 @@ public static PluginEnum getPluginEnumByName(final String name) { * @return List string */ public static List getUpstreamNames() { - return Arrays.asList(DIVIDE.name, GRPC.name, TARS.name, SPRING_CLOUD.name, DUBBO.name); + return Arrays.asList(DIVIDE.name, GRPC.name, SPRING_CLOUD.name, DUBBO.name); } } 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..e9d3df886963 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 @@ -43,11 +43,6 @@ public enum RpcTypeEnum { */ SOFA("sofa", true), - /** - * Tars rpc type enum. - */ - TARS("tars", true), - /** * Web socket rpc type enum. */ @@ -127,7 +122,7 @@ public static List acquireSupports() { * @return operator support. */ public static List acquireSupportURIs() { - return Arrays.asList(RpcTypeEnum.GRPC, RpcTypeEnum.HTTP, RpcTypeEnum.TARS, RpcTypeEnum.SPRING_CLOUD, RpcTypeEnum.DUBBO); + return Arrays.asList(RpcTypeEnum.GRPC, RpcTypeEnum.HTTP, RpcTypeEnum.SPRING_CLOUD, RpcTypeEnum.DUBBO); } /** @@ -136,7 +131,7 @@ public static List acquireSupportURIs() { * @return operator support. */ public static List acquireSupportMetadatas() { - return Arrays.asList(RpcTypeEnum.HTTP, RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.SPRING_CLOUD, RpcTypeEnum.SOFA, RpcTypeEnum.TARS, RpcTypeEnum.MOTAN); + return Arrays.asList(RpcTypeEnum.HTTP, RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, RpcTypeEnum.SPRING_CLOUD, RpcTypeEnum.SOFA, RpcTypeEnum.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..e7a30386b1be 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 @@ -40,8 +40,6 @@ public static String rpcTypeAdapter(final String rpcType) { return PluginEnum.SPRING_CLOUD.getName(); case DUBBO: return PluginEnum.DUBBO.getName(); - case TARS: - return PluginEnum.TARS.getName(); case SOFA: return PluginEnum.SOFA.getName(); case WEB_SOCKET: diff --git a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/TarsRegisterConfigTest.java b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/TarsRegisterConfigTest.java deleted file mode 100644 index 644e4ddb5ad2..000000000000 --- a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/TarsRegisterConfigTest.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.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 TarsRegisterConfigTest. - */ -public class TarsRegisterConfigTest { - - @Test - public void testGetterSetter() { - TarsRegisterConfig config = new TarsRegisterConfig(); - config.setCorethreads(10); - config.setThreads(10); - config.setQueues(2); - config.setThreadpool("threadPool"); - - assertThat(config.getCorethreads(), is(10)); - assertThat(config.getThreads(), is(10)); - assertThat(config.getQueues(), is(2)); - assertThat(config.getThreadpool(), is("threadPool")); - } - - @Test - public void testEqualsAndHashCode() { - TarsRegisterConfig config1 = new TarsRegisterConfig(); - TarsRegisterConfig config2 = new TarsRegisterConfig(); - - assertThat(ImmutableSet.of(config1, config2), hasSize(1)); - } - -} diff --git a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/selector/TarsUpstreamTest.java b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/selector/TarsUpstreamTest.java deleted file mode 100644 index d9059dd27eda..000000000000 --- a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/selector/TarsUpstreamTest.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.selector; - -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 TarsUpstream. - */ -public class TarsUpstreamTest { - - @Test - public void testBuilderAndGetterSetter() { - TarsUpstream upstream = TarsUpstream.builder().protocol("protocol").upstreamHost("host").upstreamUrl("url") - .status(true).warmup(50).timestamp(1650549243L).build(); - - upstream.setWeight(50); - upstream.setWarmup(100); - - assertThat(upstream.getWeight(), is(50)); - assertThat(upstream.getWarmup(), is(100)); - } - - @Test - public void testEqualsAndHashCode() { - TarsUpstream upstream1 = TarsUpstream.builder().protocol("protocol").upstreamHost("host").upstreamUrl("url") - .status(true).warmup(50).timestamp(1650549243L).build(); - TarsUpstream upstream2 = TarsUpstream.builder().protocol("protocol").upstreamHost("host").upstreamUrl("url") - .status(true).warmup(50).timestamp(1650549243L).build(); - - assertThat(ImmutableSet.of(upstream1, upstream2), 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..764c58ffdb41 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 @@ -90,7 +90,6 @@ public void testGetCode() { "modifyResponse, 220", "dubbo, 310", "sofa, 310", - "tars, 310", "grpc, 310", "motan, 310", "cryptorResponse, 410", 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..211967c8d767 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 @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -37,7 +38,6 @@ public void testGetName() { 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()); } @@ -48,7 +48,6 @@ public void testSupport() { assertTrue(RpcTypeEnum.HTTP.getSupport()); assertTrue(RpcTypeEnum.MOTAN.getSupport()); assertTrue(RpcTypeEnum.SOFA.getSupport()); - assertTrue(RpcTypeEnum.TARS.getSupport()); assertTrue(RpcTypeEnum.WEB_SOCKET.getSupport()); } @@ -75,7 +74,6 @@ public void testAcquireSupportURIs() { List rpcTypeEnumList = RpcTypeEnum.acquireSupportURIs(); assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.GRPC)); assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.HTTP)); - assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.TARS)); } @Test @@ -84,11 +82,17 @@ public void testAcquireSupportMetadatas() { assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.DUBBO)); assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.GRPC)); assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.SOFA)); - assertTrue(rpcTypeEnumList.contains(RpcTypeEnum.TARS)); } @Test public void testGetRpcTypeEnumByNameInvalid() { assertThrows(ShenyuException.class, () -> RpcTypeEnum.acquireByName("InvalidName")); } + + @Test + public void testRemovedTarsSupport() { + assertFalse(Arrays.stream(RpcTypeEnum.values()).map(RpcTypeEnum::name).anyMatch("TARS"::equals)); + assertFalse(RpcTypeEnum.acquireSupportURIs().stream().map(RpcTypeEnum::name).anyMatch("TARS"::equals)); + assertFalse(RpcTypeEnum.acquireSupportMetadatas().stream().map(RpcTypeEnum::name).anyMatch("TARS"::equals)); + } } 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..595e8de43eca 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, Sofa 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..fdcbc6ab073b 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE @@ -654,9 +654,6 @@ The text of each license is also included at licenses/LICENSE-[project].txt. jakarta.xml.bind-api 4.0.2: https://github.com/eclipse-ee4j/jaxb-api, BSD 3-Clause protobuf-java 3.25.5: https://github.com/protocolbuffers/protobuf/, BSD 3-Clause protobuf-java-util 3.21.7: https://github.com/protocolbuffers/protobuf/, BSD 3-Clause - tars-client 1.7.2: https://github.com/TarsCloud/Tars/tars-client, BSD 3-Clause - tars-context 1.7.2: https://github.com/TarsCloud/Tars/tars-context, BSD 3-Clause - tars-net 1.7.2: https://github.com/TarsCloud/Tars/tars-net, BSD 3-Clause zstd-jni 1.5.6-3: https://github.com/luben/zstd-jni, BSD 2-Clause zstd-jni 1.5.6-4: https://github.com/luben/zstd-jni, BSD 2-Clause reflections 0.9.11: https://mvnrepository.com/artifact/org.reflections/reflections/0.9.11, BSD 2-Clause 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..595e8de43eca 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, Sofa 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/licenses/LICENSE-tars.txt b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-tars.txt deleted file mode 100644 index 9e195b163c5b..000000000000 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/licenses/LICENSE-tars.txt +++ /dev/null @@ -1,32 +0,0 @@ -tars License ---------------- - -BSD 3-Clause License - -Copyright (c) 2020, THE TARS FOUNDATION -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..1d7e214f338b 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 @@ -46,7 +46,6 @@ public enum Plugin { SENTINEL("sentinel", 10), SOFA("sofa", 11), RESILIENCE4J("resilience4j", 12), - TARS("tars", 13), CONTEXT_PATH("contextPath", 14), GRPC("grpc", 15), REDIRECT("redirect", 16), diff --git a/shenyu-examples/pom.xml b/shenyu-examples/pom.xml index 1718fadd4d61..b0a64419d496 100644 --- a/shenyu-examples/pom.xml +++ b/shenyu-examples/pom.xml @@ -50,7 +50,6 @@ shenyu-examples-springcloud shenyu-examples-eureka shenyu-examples-sofa - shenyu-examples-tars shenyu-examples-grpc shenyu-examples-motan shenyu-examples-plugin diff --git a/shenyu-examples/shenyu-examples-tars/README.md b/shenyu-examples/shenyu-examples-tars/README.md deleted file mode 100644 index 2596bcba6a6e..000000000000 --- a/shenyu-examples/shenyu-examples-tars/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Shenyu Example Tars -*** -## Run -1.set vm options : - -```text --Dconfig=D:\Code\Java\shenyu\shenyu-examples\shenyu-examples-tars\src\main\resources\ShenyuExampleServer.ShenyuExampleApp.config.conf -``` - -2.run ShenyuTestTarsApplication diff --git a/shenyu-examples/shenyu-examples-tars/pom.xml b/shenyu-examples/shenyu-examples-tars/pom.xml deleted file mode 100644 index de0c37ac35b7..000000000000 --- a/shenyu-examples/shenyu-examples-tars/pom.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-examples - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-examples-tars - - - - org.springframework.boot - spring-boot-starter - - - - org.springframework.boot - spring-boot-starter-web - - - - org.apache.shenyu - shenyu-examples-common - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-client-tars - ${project.version} - - - - - - - - - - - - - com.tencent.tars - tars-spring-boot-starter - 1.7.2 - - - org.springframework.boot - spring-boot-dependencies - - - - - - - - - com.tencent.tars - tars-maven-plugin - 1.7.2 - - - - - ${basedir}/src/main/resources/test.tars - - - UTF-8 - - true - - UTF-8 - - ${basedir}/src/main/java - - org.apache.shenyu.examples.tars.servant. - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - - conf/ - - - - - - org.springframework.boot - spring-boot-maven-plugin - - org.apache.shenyu.examples.tars.ShenyuTestTarsApplication - - - - - repackage - - - - - - - diff --git a/shenyu-examples/shenyu-examples-tars/src/main/http/tars-test-api.http b/shenyu-examples/shenyu-examples-tars/src/main/http/tars-test-api.http deleted file mode 100644 index 665445e741c4..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/http/tars-test-api.http +++ /dev/null @@ -1,37 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - -### shengyu getway proxy hello -GET http://localhost:9195/tars/hello -Accept: application/json -Content-Type: application/json - -{ - "no": 123, - "name": "order" -} - -### shengyu getway proxy helloInt -GET http://localhost:9195/tars/helloInt -Accept: application/json -Content-Type: application/json - -{ - "no": 123, - "name": "order" -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/ShenyuTestTarsApplication.java b/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/ShenyuTestTarsApplication.java deleted file mode 100644 index 9a9262172f30..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/ShenyuTestTarsApplication.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.tars; - -import com.qq.tars.spring.annotation.EnableTarsServer; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * ShenyuTestTarsApplication. - */ -@SpringBootApplication -@EnableTarsServer -public class ShenyuTestTarsApplication { - - /** - * main. - * - * @param args args - */ - public static void main(final String[] args) { - SpringApplication.run(ShenyuTestTarsApplication.class, args); - } - -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/HelloServant.java b/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/HelloServant.java deleted file mode 100644 index 38d22eba396d..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/HelloServant.java +++ /dev/null @@ -1,46 +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. - */ -// ********************************************************************** -// This file was generated by a TARS parser! -// TARS version 1.7.2. -// ********************************************************************** - -package org.apache.shenyu.examples.tars.servant.testapp; - -import com.qq.tars.protocol.annotation.Servant; -import com.qq.tars.protocol.tars.annotation.TarsMethodParameter; - -@Servant -public interface HelloServant { - - /** - * Test hello for tar. - * @param no a param with name no - * @param name a param with name name - * @return result - */ - String hello(@TarsMethodParameter(name = "no") int no, @TarsMethodParameter(name = "name") String name); - - /** - * Test hello int for tar. - * @param no a param with name no - * @param name a param with name name - * @return result - */ - int helloInt(@TarsMethodParameter(name = "no") int no, @TarsMethodParameter(name = "name") String name); - -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/OrderServant.java b/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/OrderServant.java deleted file mode 100644 index d843d12ca7b8..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/OrderServant.java +++ /dev/null @@ -1,46 +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. - */ -// ********************************************************************** -// This file was generated by a TARS parser! -// TARS version 1.7.2. -// ********************************************************************** - -package org.apache.shenyu.examples.tars.servant.testapp; - -import com.qq.tars.protocol.annotation.Servant; -import com.qq.tars.protocol.tars.annotation.TarsMethodParameter; - -@Servant -public interface OrderServant { - - /** - * Test hello for tar. - * @param no a param with name no - * @param name a param with name name - * @return result - */ - String hello(@TarsMethodParameter(name = "no") int no, @TarsMethodParameter(name = "name") String name); - - /** - * Test hello int for tar. - * @param no a param with name no - * @param name a param with name name - * @return result - */ - int helloInt(@TarsMethodParameter(name = "no") int no, @TarsMethodParameter(name = "name") String name); - -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/UserServant.java b/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/UserServant.java deleted file mode 100644 index 07c8c00b75c6..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/UserServant.java +++ /dev/null @@ -1,46 +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. - */ -// ********************************************************************** -// This file was generated by a TARS parser! -// TARS version 1.7.2. -// ********************************************************************** - -package org.apache.shenyu.examples.tars.servant.testapp; - -import com.qq.tars.protocol.annotation.Servant; -import com.qq.tars.protocol.tars.annotation.TarsMethodParameter; - -@Servant -public interface UserServant { - - /** - * Test hello for tar. - * @param no a param with name no - * @param name a param with name name - * @return result - */ - String hello(@TarsMethodParameter(name = "no") int no, @TarsMethodParameter(name = "name") String name); - - /** - * Test hello int for tar. - * @param no a param with name no - * @param name a param with name name - * @return result - */ - int helloInt(@TarsMethodParameter(name = "no") int no, @TarsMethodParameter(name = "name") String name); - -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/HelloServantImpl.java b/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/HelloServantImpl.java deleted file mode 100644 index 42c16b5383dd..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/HelloServantImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.examples.tars.servant.testapp.impl; - -import com.qq.tars.spring.annotation.TarsServant; -import org.apache.shenyu.client.apidocs.annotations.ApiDoc; -import org.apache.shenyu.client.apidocs.annotations.ApiModule; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsClient; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsService; -import org.apache.shenyu.examples.common.aop.Log; -import org.apache.shenyu.examples.tars.servant.testapp.HelloServant; - -@TarsServant("HelloObj") -@ShenyuTarsService(serviceName = "ShenyuExampleServer.ShenyuExampleApp.HelloObj") -@ApiModule(value = "HelloObj") -public class HelloServantImpl implements HelloServant { - - @Override - @ShenyuTarsClient("/hello") - @ApiDoc(desc = "hello") - public String hello(final int no, final String name) { - return String.format("hello no=%s, name=%s, time=%s", no, name, System.currentTimeMillis()); - } - - @Log - @Override - @ShenyuTarsClient("/helloInt") - @ApiDoc(desc = "helloInt") - public int helloInt(final int no, final String name) { - return 1; - } -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/OrderServantImpl.java b/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/OrderServantImpl.java deleted file mode 100644 index f39a711a6557..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/OrderServantImpl.java +++ /dev/null @@ -1,46 +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.tars.servant.testapp.impl; - -import com.qq.tars.spring.annotation.TarsServant; -import org.apache.shenyu.client.apidocs.annotations.ApiDoc; -import org.apache.shenyu.client.apidocs.annotations.ApiModule; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsClient; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsService; -import org.apache.shenyu.examples.tars.servant.testapp.OrderServant; - -@TarsServant("OrderObj") -@ShenyuTarsClient("/order") -@ShenyuTarsService(serviceName = "ShenyuExampleServer.ShenyuExampleApp.OrderObj") -@ApiModule(value = "order") -public class OrderServantImpl implements OrderServant { - - @Override - @ShenyuTarsClient("/hello") - @ApiDoc(desc = "hello") - public String hello(final int no, final String name) { - return String.format("hello no=%s, name=%s, time=%s", no, name, System.currentTimeMillis()); - } - - @Override - @ShenyuTarsClient("/helloInt") - @ApiDoc(desc = "helloInt") - public int helloInt(final int no, final String name) { - return 1; - } -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/UserServantImpl.java b/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/UserServantImpl.java deleted file mode 100644 index f204d77d066c..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/java/org/apache/shenyu/examples/tars/servant/testapp/impl/UserServantImpl.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.examples.tars.servant.testapp.impl; - -import com.qq.tars.spring.annotation.TarsServant; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsClient; -import org.apache.shenyu.client.tars.common.annotation.ShenyuTarsService; -import org.apache.shenyu.examples.tars.servant.testapp.UserServant; - -@TarsServant("UserObj") -@ShenyuTarsClient("/user/**") -@ShenyuTarsService(serviceName = "ShenyuExampleServer.ShenyuExampleApp.UserObj") -public class UserServantImpl implements UserServant { - - @Override - public String hello(final int no, final String name) { - return String.format("hello no=%s, name=%s, time=%s", no, name, System.currentTimeMillis()); - } - - @Override - public int helloInt(final int no, final String name) { - return 1; - } -} diff --git a/shenyu-examples/shenyu-examples-tars/src/main/resources/ShenyuExampleServer.ShenyuExampleApp.config.conf b/shenyu-examples/shenyu-examples-tars/src/main/resources/ShenyuExampleServer.ShenyuExampleApp.config.conf deleted file mode 100644 index e96e6eb947f6..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/resources/ShenyuExampleServer.ShenyuExampleApp.config.conf +++ /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. -# - - - - enableset=n - setdivision=NULL - - node=tars.tarsnode.ServerObj@tcp -h 192.168.41.103 -p 19386 -t 60000 - lognum=10 - logLevel=DEBUG - deactivating-timeout=3000 - app=ShenyuExampleServer - server=ShenyuExampleApp - localip=192.168.41.103 - local=tcp -h 127.0.0.1 -p 21715 -t 3000 - basepath=/usr/local/app/tars/tarsnode/data/ShenyuExampleServer.ShenyuExampleApp/bin/ - datapath=/usr/local/app/tars/tarsnode/data/ShenyuExampleServer.ShenyuExampleApp/data/ - logpath=/usr/local/app/tars/app_log/ - loglevel=DEBUG - logsize=15M - log=tars.tarslog.LogObj - config=tars.tarsconfig.ConfigObj - notify=tars.tarsnotify.NotifyObj - classpath=/usr/local/app/tars/tarsnode/data/ShenyuExampleServer.ShenyuExampleApp/bin//conf:/usr/local/app/tars/tarsnode/data/ShenyuExampleServer.ShenyuExampleApp/bin//WEB-INF/classes:/usr/local/app/tars/tarsnode/data/ShenyuExampleServer.ShenyuExampleApp/bin//WEB-INF/lib - jvmparams=-Dcom.sun.management.jmxremote.ssl\=false -Dcom.sun.management.jmxremote.authenticate\=false -Xms2g -Xmx2g -Xmn1g -Xss1024k -XX:CMSInitiatingOccupancyFraction\=60 -XX:+CMSParallelRemarkEnabled -XX:+CMSScavengeBeforeRemark -verbosegc -XX:+PrintGCDetails -XX:ErrorFile\=/usr/local/app/tars/app_log/ShenyuExampleServer/ShenyuExampleApp/jvm_error.log - sessiontimeout=120000 - sessioncheckinterval=60000 - tcpnodelay=true - udpbuffersize=8192 - charsetname=UTF-8 - backupfiles=conf - packageFormat=jar - mainclass=-jar /usr/local/app/tars/tarsnode/data/ShenyuExampleServer.ShenyuExampleApp/bin/ShenyuExampleServer.ShenyuExampleApp.jar - - allow - endpoint=tcp -h 192.168.41.103 -p 21715 -t 60000 - handlegroup=ShenyuExampleServer.ShenyuExampleApp.HelloObjAdapter - maxconns=100000 - protocol=tars - queuecap=50000 - queuetimeout=20000 - servant=ShenyuExampleServer.ShenyuExampleApp.HelloObj - threads=5 - - - allow - endpoint=tcp -h 192.168.41.103 -p 21716 -t 60000 - handlegroup=ShenyuExampleServer.ShenyuExampleApp.OrderObjAdapter - maxconns=100000 - protocol=tars - queuecap=50000 - queuetimeout=20000 - servant=ShenyuExampleServer.ShenyuExampleApp.OrderObj - threads=5 - - - allow - endpoint=tcp -h 192.168.41.103 -p 21717 -t 60000 - handlegroup=ShenyuExampleServer.ShenyuExampleApp.UserObjAdapter - maxconns=100000 - protocol=tars - queuecap=50000 - queuetimeout=20000 - servant=ShenyuExampleServer.ShenyuExampleApp.UserObj - threads=5 - - - - asyncthread=3 - locator=tars.tarsregistry.QueryObj@tcp -h 192.168.41.103 -p 17890 - sync-invoke-timeout=20000 - async-invoke-timeout=20000 - refresh-endpoint-interval=60000 - stat=tars.tarsstat.StatObj - property=tars.tarsproperty.PropertyObj - report-interval=60000 - modulename=ShenyuExampleServer.ShenyuExampleApp - sample-rate=100000 - max-sample-count=50 - - - diff --git a/shenyu-examples/shenyu-examples-tars/src/main/resources/application.yml b/shenyu-examples/shenyu-examples-tars/src/main/resources/application.yml deleted file mode 100644 index 9a481f6bfeec..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/resources/application.yml +++ /dev/null @@ -1,45 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -server: - port: 55290 - servlet: - context-path: / - address: 0.0.0.0 - -spring: - application: - name: tars-test - -logging: - level: - root: info - org.apache.shenyu: debug - -shenyu: - namespace: 649330b6-c2d7-4edc-be8e-8a54df9eb385 - register: - registerType: http - serverLists: http://localhost:9095 - props: - username: admin - password: 123456 - client: - tars: - props: - contextPath: /tars - appName: tars - port: 21715 - host: 192.168.41.103 diff --git a/shenyu-examples/shenyu-examples-tars/src/main/resources/test.tars b/shenyu-examples/shenyu-examples-tars/src/main/resources/test.tars deleted file mode 100644 index d7927f1bbbe3..000000000000 --- a/shenyu-examples/shenyu-examples-tars/src/main/resources/test.tars +++ /dev/null @@ -1,35 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -module TestApp -{ - interface Hello - { - string hello(int no, string name); - int helloInt(int no, string name); - }; - interface Order - { - string hello(int no, string name); - int helloInt(int no, string name); - }; - interface User - { - string hello(int no, string name); - int helloInt(int no, string name); - }; -}; diff --git a/shenyu-integrated-test/pom.xml b/shenyu-integrated-test/pom.xml index 46da401efc69..0742d2871906 100644 --- a/shenyu-integrated-test/pom.xml +++ b/shenyu-integrated-test/pom.xml @@ -60,7 +60,6 @@ 4.1.2 2.9.0 4.9.3 - 1.7.2 3.4.0 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..7eeadf8f948b 100644 --- a/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/common/IngressConstants.java +++ b/shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/common/IngressConstants.java @@ -81,31 +81,31 @@ public class IngressConstants { // The configuration key to specify parameter types for the Dubbo plugin, in string public static final String PLUGIN_DUBBO_PARAMENT_TYPE = "shenyu.apache.org/plugin-dubbo-parament-type"; - // The configuration key to specify the Tars path for the plugin, in string + // The configuration key to specify whether to use the Motan plugin, in string public static final String PLUGIN_MOTAN_ENABLED = "shenyu.apache.org/plugin-motan-enabled"; - // The configuration key to specify the Tars path for the plugin, in string + // The configuration key to specify the Motan context path for the plugin, in string public static final String PLUGIN_MOTAN_CONTEXT_PATH = "shenyu.apache.org/plugin-motan-context-path"; - // The configuration key to specify the Tars path for the plugin, in string + // The configuration key to specify the Motan app name for the plugin, in string public static final String PLUGIN_MOTAN_APP_NAME = "shenyu.apache.org/plugin-motan-app-name"; - // The configuration key to specify the Tars method name for the plugin, in string + // The configuration key to specify the Motan method name for the plugin, in string public static final String PLUGIN_MOTAN_METHOD_NAME = "shenyu.apache.org/plugin-motan-method-name"; - // The configuration key to specify the Tars path for the plugin, in string + // The configuration key to specify the Motan path for the plugin, in string public static final String PLUGIN_MOTAN_PATH = "shenyu.apache.org/plugin-motan-path"; - // The configuration key to specify the Tars service name for the plugin, in string + // The configuration key to specify the Motan service name for the plugin, in string public static final String PLUGIN_MOTAN_SREVICE_NAME = "shenyu.apache.org/plugin-motan-service-name"; - // The configuration key to specify the Tars RPC type for the plugin, in string + // The configuration key to specify the Motan RPC type for the plugin, in string public static final String PLUGIN_MOTAN_RPC_TYPE = "shenyu.apache.org/plugin-motan-rpc-type"; - // The configuration key to specify the Tars parameter types for the plugin, in string + // The configuration key to specify the Motan parameter types for the plugin, in string public static final String PLUGIN_MOTAN_PARAMS_TYPE = "shenyu.apache.org/plugin-motan-params-type"; - // The configuration key to specify additional RPC extension for the Tars plugin, in string + // The configuration key to specify additional RPC extension for the Motan plugin, in string public static final String PLUGIN_MOTAN_RPC_EXPAND = "shenyu.apache.org/plugin-motan-rpc-expand"; //Determining whether to use the WebSocket plugin, in String 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..7bdea9e42786 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 @@ -92,16 +92,6 @@ public enum ShenyuResultEnum { */ 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. - */ - TARS_HAVE_BODY_PARAM(433, "Tars must have body param, please enter the JSON format in the body!"), - - /** - * Tars invoke shenyu result enum. - */ - TARS_INVOKE(434, "Tars invoke error!"), - /** * Grpc 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..d68ac437356a 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml @@ -32,7 +32,6 @@ 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..f308d1124656 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.SOFA); } } diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/pom.xml b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/pom.xml deleted file mode 100644 index 50877f5ae0fa..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-plugin-rpc - 2.7.1-SNAPSHOT - - 4.0.0 - - shenyu-plugin-tars - - - - net.bytebuddy - byte-buddy - ${bytebuddy.version} - - - - com.tencent.tars - tars-spring-boot-starter - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-log4j12 - - - log4j - log4j - - - org.springframework.boot - spring-boot-dependencies - - - com.google.guava - guava - - - provided - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/TarsPlugin.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/TarsPlugin.java deleted file mode 100644 index 01593e07f75c..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/TarsPlugin.java +++ /dev/null @@ -1,134 +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.tars; - -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.ResultEnum; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.common.exception.ShenyuException; -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.tars.cache.ApplicationConfigCache; -import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrxList; -import org.apache.shenyu.plugin.tars.util.PrxInfoUtil; -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.lang.reflect.Method; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ThreadLocalRandom; - -/** - * The tars plugin. - */ -public class TarsPlugin extends AbstractShenyuPlugin { - - private static final Logger LOG = LoggerFactory.getLogger(TarsPlugin.class); - - @Override - protected String getRawPath(final ServerWebExchange exchange) { - return RequestUrlUtils.getRewrittenRawPath(exchange); - } - - @Override - @SuppressWarnings({"unchecked", "rawtypes"}) - protected Mono doExecute(final ServerWebExchange exchange, final ShenyuPluginChain chain, final SelectorData selector, final RuleData rule) { - String body = 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(body)) { - exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); - Object error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.TARS_HAVE_BODY_PARAM); - return WebFluxResultUtils.result(exchange, error); - } - TarsInvokePrxList tarsInvokePrxList = ApplicationConfigCache.getInstance().get(metaData.getPath()); - int index = ThreadLocalRandom.current().nextInt(tarsInvokePrxList.getTarsInvokePrxList().size()); - Object prx = tarsInvokePrxList.getTarsInvokePrxList().get(index).getInvokePrx(); - Method method = tarsInvokePrxList.getMethod(); - CompletableFuture future; - try { - future = (CompletableFuture) method - .invoke(prx, PrxInfoUtil.getParamArray(tarsInvokePrxList.getParamTypes(), tarsInvokePrxList.getParamNames(), body)); - } catch (Exception e) { - LOG.error("Invoke tars error", e); - exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); - Object error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.TARS_INVOKE); - return WebFluxResultUtils.result(exchange, error); - } - return Mono.fromFuture(future.thenApply(ret -> { - Object result = ret; - if (Objects.isNull(result)) { - result = Constants.TARS_RPC_RESULT_EMPTY; - } - exchange.getAttributes().put(Constants.RPC_RESULT, result); - exchange.getAttributes().put(Constants.CLIENT_RESPONSE_RESULT_TYPE, ResultEnum.SUCCESS.getName()); - return result; - })).onErrorMap(m -> new ShenyuException("failed to invoke tars")).then(chain.execute(exchange)); - } - - @Override - public int getOrder() { - return PluginEnum.TARS.getCode(); - } - - @Override - public String named() { - return PluginEnum.TARS.getName(); - } - - @Override - public boolean skip(final ServerWebExchange exchange) { - return skipExcept(exchange, RpcTypeEnum.TARS); - } - - @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); - } - - 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-tars/src/main/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCache.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCache.java deleted file mode 100644 index 1422da5d0c15..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCache.java +++ /dev/null @@ -1,450 +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.tars.cache; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.qq.tars.client.Communicator; -import com.qq.tars.client.CommunicatorConfig; -import com.qq.tars.client.CommunicatorFactory; -import com.qq.tars.protocol.annotation.Servant; -import net.bytebuddy.ByteBuddy; -import net.bytebuddy.description.annotation.AnnotationDescription; -import net.bytebuddy.description.modifier.Visibility; -import net.bytebuddy.dynamic.DynamicType; -import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.IterableUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.shenyu.common.concurrent.ShenyuThreadFactory; -import org.apache.shenyu.common.concurrent.ShenyuThreadPoolExecutor; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.plugin.TarsRegisterConfig; -import org.apache.shenyu.common.dto.convert.selector.TarsUpstream; -import org.apache.shenyu.common.exception.ShenyuException; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.plugin.api.utils.SpringBeanUtils; -import org.apache.shenyu.plugin.tars.exception.ShenyuTarsPluginException; -import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrx; -import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrxList; -import org.apache.shenyu.plugin.tars.util.PrxInfoUtil; -import org.apache.shenyu.plugin.tars.util.ReturnValueResolver; -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.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.concurrent.ConcurrentHashMap; -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.concurrent.locks.ReentrantLock; -import java.util.stream.Collectors; - -/** - * Tars config cache. - */ -public final class ApplicationConfigCache { - - private static final Logger LOG = LoggerFactory.getLogger(ApplicationConfigCache.class); - - private static final ReentrantLock LOCK = new ReentrantLock(); - - private final LoadingCache cache = CacheBuilder.newBuilder() - .maximumSize(Constants.CACHE_MAX_COUNT) - .build(new CacheLoader<>() { - @NonNull - @Override - public TarsInvokePrxList load(@NonNull final String key) { - return new TarsInvokePrxList(null, null, null); - } - }); - - private final ConcurrentHashMap> ctxPathCache = new ConcurrentHashMap<>(); - - private final ConcurrentHashMap> prxClassCache = new ConcurrentHashMap<>(); - - private final ConcurrentHashMap prxParamCache = new ConcurrentHashMap<>(); - - private final ConcurrentHashMap> refreshUpstreamCache = new ConcurrentHashMap<>(); - - private Communicator communicator; - - private final ThreadFactory factory = ShenyuThreadFactory.create("shenyu-tars", true); - - private ThreadPoolExecutor threadPool; - - private ApplicationConfigCache() { - communicator = CommunicatorFactory.getInstance().getCommunicator(CommunicatorConfig.getDefault()); - } - - /** - * Init. - * - * @param tarsRegisterConfig the tars register config - */ - public void init(final TarsRegisterConfig tarsRegisterConfig) { - if (StringUtils.isEmpty(tarsRegisterConfig.getThreadpool())) { - CommunicatorConfig communicatorConfig = CommunicatorConfig.getDefault(); - Optional.ofNullable(tarsRegisterConfig.getCorethreads()).ifPresent(communicatorConfig::setCorePoolSize); - Optional.ofNullable(tarsRegisterConfig.getThreads()).ifPresent(communicatorConfig::setMaxPoolSize); - Optional.ofNullable(tarsRegisterConfig.getQueues()).ifPresent(communicatorConfig::setQueueSize); - communicator = CommunicatorFactory.getInstance().getCommunicator(communicatorConfig); - } else { - initThreadPool(tarsRegisterConfig); - Optional.ofNullable(threadPool).ifPresent(this::setCommunicatorThreadPool); - } - } - - /** - * init thread pool. - */ - private void initThreadPool(final TarsRegisterConfig 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: - } - } - - /** - * Set communicator thread pool. - */ - private void setCommunicatorThreadPool(final ThreadPoolExecutor threadPool) { - Field field = ReflectionUtils.findField(Communicator.class, "threadPoolExecutor"); - ReflectionUtils.makeAccessible(field); - ReflectionUtils.setField(field, communicator, threadPool); - } - - /** - * Get reference config. - * - * @param path path - * @return the reference config - */ - public TarsInvokePrxList get(final String path) { - try { - return cache.get(path); - } catch (ExecutionException e) { - throw new ShenyuTarsPluginException(e.getCause()); - } - } - - /** - * Init prx.
- * Try to load the meta information defined by meta data to the local cache.
- * eg: class definition, all method definition params,context path.
- * - * @param metaData metaData - */ - public void initPrx(final MetaData metaData) { - while (true) { - Class prxClass = prxClassCache.get(metaData.getPath()); - try { - if (Objects.isNull(prxClass)) { - // Spin's Attempt to Load - tryLockedLoadMetaData(metaData); - } else { - if (Objects.nonNull(metaData.getContextPath()) && Objects.nonNull(refreshUpstreamCache.get(metaData.getContextPath()))) { - refreshTarsInvokePrxList(metaData, refreshUpstreamCache.get(metaData.getContextPath())); - } - break; - } - } catch (Exception e) { - LOG.error("ShenyuTarsPluginInitializeException: init tars ref ex:{}", e.getMessage()); - break; - } - } - } - - /** - * Try to load once, if it fails, it will give up.
- * add class cache to {@link #prxClassCache}.
- * add method params cache to {@link #prxParamCache}.
- * add paths cache to {@link #ctxPathCache}.
- * - * @param metaData metaData - * @throws ClassNotFoundException meta data class definition not found - * @see ReentrantLock - */ - private void tryLockedLoadMetaData(final MetaData metaData) throws ClassNotFoundException { - Objects.requireNonNull(LOCK); - if (LOCK.tryLock()) { - try { - if (StringUtils.isEmpty(metaData.getRpcExt())) { - throw new ShenyuTarsPluginException("ShenyuTarsPluginInitializeException: can't init prx with empty ext string"); - } - Class prxClazz = buildClassDefinition(metaData); - prxClassCache.put(metaData.getPath(), prxClazz); - List paths = ctxPathCache.getOrDefault(metaData.getContextPath(), new ArrayList<>()); - if (!IterableUtils.matchesAny(paths, p -> p.getPath().equals(metaData.getPath()))) { - paths.add(metaData); - } - ctxPathCache.put(metaData.getContextPath(), paths); - } finally { - LOCK.unlock(); - } - } - } - - /** - * build target class definition. - * - * @param metaData metadata - * @return class definition - * @throws ClassNotFoundException meta data class definition not found - */ - private Class buildClassDefinition(final MetaData metaData) throws ClassNotFoundException { - String clazzName = PrxInfoUtil.getPrxName(metaData); - DynamicType.Builder classDefinition = new ByteBuddy().makeInterface().name(clazzName); - TarsParamExtInfo tarsParamExtInfo = GsonUtils.getInstance().fromJson(metaData.getRpcExt(), TarsParamExtInfo.class); - for (MethodInfo methodInfo : tarsParamExtInfo.getMethodInfo()) { - DynamicType.Builder.MethodDefinition.ParameterDefinition definition = - classDefinition.defineMethod(PrxInfoUtil.getMethodName(methodInfo.methodName), - ReturnValueResolver.getCallBackType(PrxInfoUtil.getParamClass(methodInfo.getReturnType())), - Visibility.PUBLIC); - if (CollectionUtils.isNotEmpty(methodInfo.getParams())) { - Class[] paramTypes = new Class[methodInfo.getParams().size()]; - String[] paramNames = new String[methodInfo.getParams().size()]; - for (int i = 0; i < methodInfo.getParams().size(); i++) { - Pair pair = methodInfo.getParams().get(i); - paramTypes[i] = PrxInfoUtil.getParamClass(pair.getKey()); - paramNames[i] = pair.getValue(); - definition = definition.withParameter(paramTypes[i], paramNames[i]); - prxParamCache.put(getClassMethodKey(clazzName, methodInfo.getMethodName()), new TarsParamInfo(paramTypes, paramNames)); - } - classDefinition = definition.withoutCode(); - } - } - return classDefinition.annotateType(AnnotationDescription.Builder.ofType(Servant.class).build()) - .make() - .load(Servant.class.getClassLoader(), ClassLoadingStrategy.Default.INJECTION) - .getLoaded(); - - } - - /** - * Get param info key. - * - * @param className className - * @param methodName methodName - * @return the key - */ - public static String getClassMethodKey(final String className, final String methodName) { - return String.join("_", className, methodName); - } - - /** - * Gets instance. - * - * @return the instance - */ - public static ApplicationConfigCache getInstance() { - return ApplicationConfigCacheInstance.INSTANCE; - } - - /** - * initPrxClass. - * - * @param selectorData selectorData - */ - public void initPrxClass(final SelectorData selectorData) { - try { - final List upstreamList = GsonUtils.getInstance().fromList(selectorData.getHandle(), TarsUpstream.class); - if (CollectionUtils.isEmpty(upstreamList)) { - invalidate(selectorData.getName()); - return; - } - refreshUpstreamCache.put(selectorData.getName(), upstreamList); - List metaDataList = ctxPathCache.getOrDefault(selectorData.getName(), new ArrayList<>()); - for (MetaData metaData : metaDataList) { - refreshTarsInvokePrxList(metaData, upstreamList); - } - } catch (ExecutionException | NoSuchMethodException e) { - throw new ShenyuException(e.getCause()); - } - } - - /** - * refresh metaData path upstream url. - * - * @param metaData metaData - * @param upstreamList upstream list - */ - private void refreshTarsInvokePrxList(final MetaData metaData, final List upstreamList) throws NoSuchMethodException, ExecutionException { - Class prxClass = prxClassCache.get(metaData.getPath()); - if (Objects.isNull(prxClass)) { - return; - } - TarsInvokePrxList tarsInvokePrxList = cache.get(metaData.getPath()); - tarsInvokePrxList.getTarsInvokePrxList().clear(); - if (Objects.isNull(tarsInvokePrxList.getMethod())) { - TarsParamInfo tarsParamInfo = prxParamCache.get(getClassMethodKey(prxClass.getName(), metaData.getMethodName())); - Object prx = communicator.stringToProxy(prxClass, PrxInfoUtil.getObjectName(upstreamList.get(0).getUpstreamUrl(), metaData.getServiceName())); - Method method = prx.getClass().getDeclaredMethod( - PrxInfoUtil.getMethodName(metaData.getMethodName()), tarsParamInfo.getParamTypes()); - tarsInvokePrxList.setMethod(method); - tarsInvokePrxList.setParamTypes(tarsParamInfo.getParamTypes()); - tarsInvokePrxList.setParamNames(tarsParamInfo.getParamNames()); - } - tarsInvokePrxList.getTarsInvokePrxList().addAll(upstreamList.stream().map(upstream -> { - Object strProxy = communicator.stringToProxy(prxClass, PrxInfoUtil.getObjectName(upstream.getUpstreamUrl(), metaData.getServiceName())); - return new TarsInvokePrx(strProxy, upstream.getUpstreamUrl()); - }).collect(Collectors.toList())); - } - - /** - * invalidate. - * - * @param contextPath context path - */ - public void invalidate(final String contextPath) { - List metaDataList = ctxPathCache.getOrDefault(contextPath, new ArrayList<>()); - metaDataList.forEach(metaData -> cache.invalidate(metaData.getPath())); - } - - /** - * The type Application config cache instance. - */ - static final class ApplicationConfigCacheInstance { - /** - * The Instance. - */ - static final ApplicationConfigCache INSTANCE = new ApplicationConfigCache(); - - private ApplicationConfigCacheInstance() { - - } - } - - /** - * The type Tars param ext info. - */ - static class MethodInfo { - - private String methodName; - - private List> params; - - private String returnType; - - public String getMethodName() { - return methodName; - } - - public void setMethodName(final String methodName) { - this.methodName = methodName; - } - - public List> getParams() { - return params; - } - - public void setParams(final List> params) { - this.params = params; - } - - public String getReturnType() { - return returnType; - } - - public void setReturnType(final String returnType) { - this.returnType = returnType; - } - } - - /** - * The type Tars param ext info. - */ - static class TarsParamExtInfo { - - private List methodInfo; - - public List getMethodInfo() { - return methodInfo; - } - - public void setMethodInfo(final List methodInfo) { - this.methodInfo = methodInfo; - } - } - - /** - * The type Tars param ext info. - */ - static class TarsParamInfo { - - private Class[] paramTypes; - - private String[] paramNames; - - TarsParamInfo(final Class[] paramTypes, final String[] paramNames) { - this.paramTypes = paramTypes; - this.paramNames = paramNames; - } - - public Class[] getParamTypes() { - return paramTypes; - } - - public void setParamTypes(final Class[] paramTypes) { - this.paramTypes = paramTypes; - } - - public String[] getParamNames() { - return paramNames; - } - - public void setParamNames(final String[] paramNames) { - this.paramNames = paramNames; - } - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/context/TarsShenyuContextDecorator.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/context/TarsShenyuContextDecorator.java deleted file mode 100644 index 28efb4dfdeba..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/context/TarsShenyuContextDecorator.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.tars.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 Tars shenyu context decorator. - */ -public class TarsShenyuContextDecorator 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.TARS.getName()); - return shenyuContext; - } - - @Override - public String rpcType() { - return RpcTypeEnum.TARS.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/exception/ShenyuTarsPluginException.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/exception/ShenyuTarsPluginException.java deleted file mode 100644 index 4f3bb82d7aba..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/exception/ShenyuTarsPluginException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.tars.exception; - -import org.apache.shenyu.common.exception.ShenyuException; - -/** - * ShenyuTarsPluginException. - */ -public class ShenyuTarsPluginException extends ShenyuException { - - public ShenyuTarsPluginException(final Throwable e) { - super(e); - } - - public ShenyuTarsPluginException(final String message) { - super(message); - } - - public ShenyuTarsPluginException(final String message, final Throwable throwable) { - super(message, throwable); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandler.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandler.java deleted file mode 100644 index 418e0f2c94c9..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandler.java +++ /dev/null @@ -1,73 +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.tars.handler; - -import com.google.common.collect.Maps; -import org.apache.commons.collections4.CollectionUtils; -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.tars.cache.ApplicationConfigCache; -import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrx; - -import java.util.List; -import java.util.Objects; -import java.util.concurrent.ConcurrentMap; -import java.util.stream.Collectors; - -/** - * The tars metadata handler. - */ -public class TarsMetaDataHandler implements MetaDataHandler { - - private static final ConcurrentMap META_DATA = Maps.newConcurrentMap(); - - @Override - public void handle(final MetaData metaData) { - metaData.updateContextPath(); - MetaData metaExist = META_DATA.get(metaData.getPath()); - List prxList = ApplicationConfigCache.getInstance() - .get(metaData.getPath()).getTarsInvokePrxList(); - boolean exist = prxList.stream().anyMatch(tarsInvokePrx -> tarsInvokePrx.getHost().equals(metaData.getAppName())); - if (!exist) { - ApplicationConfigCache.getInstance().initPrx(metaData); - } - if (Objects.isNull(metaExist)) { - META_DATA.put(metaData.getPath(), metaData); - } - } - - @Override - public void remove(final MetaData metaData) { - metaData.updateContextPath(); - List prxList = ApplicationConfigCache.getInstance() - .get(metaData.getPath()).getTarsInvokePrxList(); - List removePrxList = prxList.stream() - .filter(tarsInvokePrx -> tarsInvokePrx.getHost().equals(metaData.getAppName())) - .collect(Collectors.toList()); - prxList.removeAll(removePrxList); - if (CollectionUtils.isEmpty(prxList)) { - META_DATA.remove(metaData.getPath()); - } - } - - @Override - public String rpcType() { - return RpcTypeEnum.TARS.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsPluginDataHandler.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsPluginDataHandler.java deleted file mode 100644 index 606e7179a32b..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/handler/TarsPluginDataHandler.java +++ /dev/null @@ -1,72 +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.tars.handler; - -import org.apache.shenyu.common.dto.PluginData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.plugin.TarsRegisterConfig; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.common.utils.Singleton; -import org.apache.shenyu.plugin.base.handler.PluginDataHandler; -import org.apache.shenyu.plugin.tars.cache.ApplicationConfigCache; - -import java.util.Objects; - -/** - * The type tars plugin data handler. - */ -public class TarsPluginDataHandler implements PluginDataHandler { - - @Override - public void handlerPlugin(final PluginData pluginData) { - if (Objects.nonNull(pluginData) && Boolean.TRUE.equals(pluginData.getEnabled())) { - TarsRegisterConfig tarsRegisterConfig = GsonUtils.getInstance().fromJson(pluginData.getConfig(), TarsRegisterConfig.class); - TarsRegisterConfig exist = Singleton.INST.get(TarsRegisterConfig.class); - if (Objects.isNull(tarsRegisterConfig)) { - return; - } - if (Objects.isNull(exist) || !tarsRegisterConfig.equals(exist)) { - // If it is null, cache it - ApplicationConfigCache.getInstance().init(tarsRegisterConfig); - } - Singleton.INST.single(TarsRegisterConfig.class, tarsRegisterConfig); - } - } - - @Override - public String pluginNamed() { - return PluginEnum.TARS.getName(); - } - - @Override - public void handlerSelector(final SelectorData selectorData) { - if (Objects.isNull(selectorData.getName())) { - return; - } - ApplicationConfigCache.getInstance().initPrxClass(selectorData); - } - - @Override - public void removeSelector(final SelectorData selectorData) { - if (Objects.isNull(selectorData.getName())) { - return; - } - ApplicationConfigCache.getInstance().invalidate(selectorData.getName()); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/proxy/TarsInvokePrx.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/proxy/TarsInvokePrx.java deleted file mode 100644 index 9a7a32156bec..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/proxy/TarsInvokePrx.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.tars.proxy; - -/** - * Tars path invoke metadata. - */ -public class TarsInvokePrx { - - private Object invokePrx; - - private String host; - - /** - * Instantiates a new Tars invoke prx. - */ - public TarsInvokePrx() { - } - - /** - * Instantiates a new Tars invoke prx. - * - * @param invokePrx the invoke prx - * @param host the host - */ - public TarsInvokePrx(final Object invokePrx, final String host) { - this.invokePrx = invokePrx; - this.host = host; - } - - /** - * Gets invoke prx. - * - * @return the invoke prx - */ - public Object getInvokePrx() { - return invokePrx; - } - - /** - * Sets invoke prx. - * - * @param invokePrx the invoke prx - */ - public void setInvokePrx(final Object invokePrx) { - this.invokePrx = invokePrx; - } - - /** - * Gets host. - * - * @return the host - */ - public String getHost() { - return host; - } - - /** - * Sets host. - * - * @param host the host - */ - public void setHost(final String host) { - this.host = host; - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/proxy/TarsInvokePrxList.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/proxy/TarsInvokePrxList.java deleted file mode 100644 index 0699cd560319..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/proxy/TarsInvokePrxList.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.plugin.tars.proxy; - -import java.lang.reflect.Method; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * Tars path invoke metadata. - */ -public class TarsInvokePrxList { - - private final List tarsInvokePrxList; - - private Method method; - - private Class[] paramTypes; - - private String[] paramNames; - - /** - * Instantiates a new Tars invoke prx list. - */ - public TarsInvokePrxList() { - tarsInvokePrxList = new CopyOnWriteArrayList<>(); - } - - /** - * Instantiates a new Tars invoke prx list. - * - * @param method the method - * @param paramTypes the param types - * @param paramNames the param names - */ - public TarsInvokePrxList(final Method method, - final Class[] paramTypes, - final String[] paramNames) { - this.tarsInvokePrxList = new CopyOnWriteArrayList<>(); - this.method = method; - this.paramTypes = paramTypes; - this.paramNames = paramNames; - } - - /** - * Gets tars invoke prx list. - * - * @return the tars invoke prx list - */ - public List getTarsInvokePrxList() { - return tarsInvokePrxList; - } - - /** - * Sets tars invoke prx list. - * - * @param tarsInvokePrxList the tars invoke prx list - */ - public void addTarsInvokePrxList(final List tarsInvokePrxList) { - this.tarsInvokePrxList.addAll(tarsInvokePrxList); - } - - /** - * Gets method. - * - * @return the method - */ - public Method getMethod() { - return method; - } - - /** - * Sets method. - * - * @param method the method - */ - public void setMethod(final Method method) { - this.method = method; - } - - /** - * Get param types class [ ]. - * - * @return the class [ ] - */ - public Class[] getParamTypes() { - return paramTypes; - } - - /** - * Sets param types. - * - * @param paramTypes the param types - */ - public void setParamTypes(final Class[] paramTypes) { - this.paramTypes = paramTypes; - } - - /** - * Get param names string [ ]. - * - * @return the string [ ] - */ - public String[] getParamNames() { - return paramNames; - } - - /** - * Sets param names. - * - * @param paramNames the param names - */ - public void setParamNames(final String[] paramNames) { - this.paramNames = paramNames; - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/util/PrxInfoUtil.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/util/PrxInfoUtil.java deleted file mode 100644 index 1441959fb1e4..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/util/PrxInfoUtil.java +++ /dev/null @@ -1,180 +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.tars.util; - -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.common.utils.ParamCheckUtils; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - -/** - * Proxy info util. - */ -public final class PrxInfoUtil { - - private static final Map PRIMITIVE_TYPE; - - static { - PRIMITIVE_TYPE = new HashMap<>(); - PRIMITIVE_TYPE.put("int", new PrimitiveType(int.class, o -> { - if (o instanceof String) { - return Integer.valueOf((String) o); - } - return ((Long) o).intValue(); - })); - PRIMITIVE_TYPE.put("double", new PrimitiveType(double.class, o -> { - if (o instanceof String) { - return Double.valueOf((String) o); - } - return o; - })); - PRIMITIVE_TYPE.put("long", new PrimitiveType(long.class, o -> { - if (o instanceof String) { - return Long.valueOf((String) o); - } - return o; - })); - PRIMITIVE_TYPE.put("short", new PrimitiveType(short.class, o -> { - if (o instanceof String) { - return Short.valueOf((String) o); - } - return ((Long) o).shortValue(); - })); - PRIMITIVE_TYPE.put("byte", new PrimitiveType(byte.class, o -> { - if (o instanceof String) { - return Byte.valueOf((String) o); - } - return ((Long) o).byteValue(); - })); - PRIMITIVE_TYPE.put("boolean", new PrimitiveType(boolean.class, o -> { - if (o instanceof String) { - return Byte.valueOf((String) o); - } - return o; - })); - PRIMITIVE_TYPE.put("char", new PrimitiveType(char.class, o -> { - if (o instanceof String) { - return String.valueOf(o).charAt(0); - } - return o; - })); - PRIMITIVE_TYPE.put("float", new PrimitiveType(float.class, o -> { - if (o instanceof String) { - return Float.valueOf((String) o); - } - return ((Double) o).floatValue(); - })); - } - - private PrxInfoUtil() { - } - - /** - * Get class type by name. - * - * @param className className - * @return the type to invoke - * @throws ClassNotFoundException ClassNotFoundException - */ - public static Class getParamClass(final String className) throws ClassNotFoundException { - if (PRIMITIVE_TYPE.containsKey(className)) { - return PRIMITIVE_TYPE.get(className).getClazz(); - } else { - return Class.forName(className); - } - } - - /** - * Get proxy class name to get tars proxy. - * - * @param metaData metaData - * @return className - */ - public static String getPrxName(final MetaData metaData) { - return metaData.getPath().replace("/", "") + metaData.getMethodName() + "Prx"; - } - - /** - * Get methodName to get tars proxy. - * - * @param methodName methodName - * @return methodName - */ - public static String getMethodName(final String methodName) { - return "promise_" + methodName; - } - - /** - * Get objectName to get tars proxy. - * - * @param upstreamUrl upstream url - * @param serviceName service name - * @return objectName - */ - public static String getObjectName(final String upstreamUrl, final String serviceName) { - String[] ipAndPort = upstreamUrl.split(":"); - return serviceName + "@tcp -h " + ipAndPort[0] + " -p " + ipAndPort[1]; - } - - /** - * Get param to invoke tars server. - * - * @param paramTypes paramTypes - * @param paramNames paramNames - * @param body body - * @return the param to invoke - */ - public static Object[] getParamArray(final Class[] paramTypes, final String[] paramNames, final String body) { - Map bodyMap = GsonUtils.getInstance().convertToMap(body); - ParamCheckUtils.checkParamsLength(bodyMap.size(), paramNames.length); - Object[] param = new Object[paramNames.length]; - for (int i = 0; i < paramNames.length; i++) { - String paramName = paramNames[i]; - Class paramType = paramTypes[i]; - if (PRIMITIVE_TYPE.containsKey(paramType.getName())) { - param[i] = PRIMITIVE_TYPE.get(paramType.getName()).getFunc().apply(bodyMap.get(paramName)); - } else { - param[i] = bodyMap.get(paramName); - } - } - return param; - } - - static class PrimitiveType { - - private final Class clazz; - - private final Function func; - - PrimitiveType(final Class clazz, final Function func) { - this.clazz = clazz; - this.func = func; - } - - public Class getClazz() { - return clazz; - } - - public Function getFunc() { - return func; - } - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/util/ReturnValueResolver.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/util/ReturnValueResolver.java deleted file mode 100644 index 983dafe40101..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/util/ReturnValueResolver.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.tars.util; - -import com.google.common.reflect.TypeParameter; -import com.google.common.reflect.TypeToken; - -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * The tars return value type resolver. - */ -public final class ReturnValueResolver { - - @SuppressWarnings("rawtypes") - private static final Map WRAPPER_TYPE_MAP; - - static { - WRAPPER_TYPE_MAP = new HashMap<>(); - WRAPPER_TYPE_MAP.put(int.class, Integer.class); - WRAPPER_TYPE_MAP.put(byte.class, Byte.class); - WRAPPER_TYPE_MAP.put(char.class, Character.class); - WRAPPER_TYPE_MAP.put(boolean.class, Boolean.class); - WRAPPER_TYPE_MAP.put(double.class, Double.class); - WRAPPER_TYPE_MAP.put(float.class, Float.class); - WRAPPER_TYPE_MAP.put(long.class, Long.class); - WRAPPER_TYPE_MAP.put(short.class, Short.class); - } - - private ReturnValueResolver() { - } - - /** - * Get return type. - * - * @param T - * @param clazz clazz - * @return the type - */ - @SuppressWarnings("all") - public static Type getCallBackType(final Class clazz) { - return new TypeToken>() { } - .where(new TypeParameter() { }, TypeToken.of(WRAPPER_TYPE_MAP.getOrDefault(clazz, clazz))) - .getType(); - } - -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/TarsPluginTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/TarsPluginTest.java deleted file mode 100644 index 33bcff297269..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/TarsPluginTest.java +++ /dev/null @@ -1,167 +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.tars; - -import org.apache.shenyu.common.concurrent.ShenyuThreadFactory; -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.tars.cache.ApplicationConfigCache; -import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrxList; -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 java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * Test case for {@link TarsPlugin}. - */ -@ExtendWith(MockitoExtension.class) -@MockitoSettings(strictness = Strictness.LENIENT) -public class TarsPluginTest { - - @Mock - private ShenyuPluginChain chain; - - private MetaData metaData; - - private ServerWebExchange exchange; - - private TarsPlugin tarsPluginUnderTest; - - @BeforeEach - public void setUp() { - ConfigurableApplicationContext applicationContext = mock(ConfigurableApplicationContext.class); - when(applicationContext.getBean(ShenyuResult.class)).thenReturn(new DefaultShenyuResult()); - SpringBeanUtils springBeanUtils = SpringBeanUtils.getInstance(); - springBeanUtils.setApplicationContext(applicationContext); - metaData = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path", RpcTypeEnum.TARS.getName(), "serviceName", "method1", - "parameterTypes", "{\"methodInfo\":[{\"methodName\":\"method1\",\"params\":" - + "[{\"left\":\"java.lang.String\",\"right\":\"param1\"},{\"left\":\"java.lang.String\"," - + "\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}", false, Constants.SYS_DEFAULT_NAMESPACE_ID); - ApplicationConfigCache.getInstance().initPrx(metaData); - exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); - tarsPluginUnderTest = new TarsPlugin(); - } - - @Test - public void testTarsPluginWithEmptyBody() { - 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()); - RuleData data = mock(RuleData.class); - SelectorData selectorData = mock(SelectorData.class); - StepVerifier.create(tarsPluginUnderTest.doExecute(exchange, chain, selectorData, data)).expectSubscription().verifyComplete(); - } - - @Test - public void testTarsPluginWithEmptyMetaData() { - ShenyuContext context = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, context); - metaData.setServiceName(""); - exchange.getAttributes().put(Constants.META_DATA, metaData); - when(chain.execute(exchange)).thenReturn(Mono.empty()); - RuleData data = mock(RuleData.class); - SelectorData selectorData = mock(SelectorData.class); - StepVerifier.create(tarsPluginUnderTest.doExecute(exchange, chain, selectorData, data)).expectSubscription().verifyComplete(); - } - - @Test - public void testTarsPluginWithArgumentTypeMissMatch() { - ShenyuContext context = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, context); - exchange.getAttributes().put(Constants.META_DATA, metaData); - exchange.getAttributes().put(Constants.PARAM_TRANSFORM, "{\"param1\":1,\"param2\":2}"); - when(chain.execute(exchange)).thenReturn(Mono.empty()); - RuleData data = mock(RuleData.class); - SelectorData selectorData = mock(SelectorData.class); - assertThrows(IllegalArgumentException.class, () -> StepVerifier.create(tarsPluginUnderTest.doExecute(exchange, chain, selectorData, data)).expectSubscription().verifyComplete()); - } - - @Test - public void testTarsPluginNormal() throws InvocationTargetException, IllegalAccessException { - ShenyuContext context = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, context); - exchange.getAttributes().put(Constants.META_DATA, metaData); - exchange.getAttributes().put(Constants.PARAM_TRANSFORM, "{\"param1\":\"1\",\"param2\":\"1\"}"); - when(chain.execute(exchange)).thenReturn(Mono.empty()); - RuleData data = mock(RuleData.class); - SelectorData selectorData = mock(SelectorData.class); - TarsInvokePrxList tarsInvokePrxList = ApplicationConfigCache.getInstance().get(metaData.getPath()); - Method method = mock(Method.class); - ExecutorService executorService = Executors.newFixedThreadPool(1, - ShenyuThreadFactory.create("long-polling", true)); - CompletableFuture stringCompletableFuture = CompletableFuture.supplyAsync(() -> "", executorService); - when(method.invoke(any(), any())).thenReturn(stringCompletableFuture); - tarsInvokePrxList.setMethod(method); - assertThrows(IllegalArgumentException.class, () -> StepVerifier.create(tarsPluginUnderTest.doExecute(exchange, chain, selectorData, data)).expectSubscription().verifyComplete()); - } - - @Test - public void testGetOrder() { - int result = tarsPluginUnderTest.getOrder(); - assertEquals(PluginEnum.TARS.getCode(), result); - } - - @Test - public void testNamed() { - String result = tarsPluginUnderTest.named(); - assertEquals(PluginEnum.TARS.getName(), result); - } - - @Test - public void testSkip() { - ShenyuContext context = mock(ShenyuContext.class); - when(context.getRpcType()).thenReturn(RpcTypeEnum.TARS.getName()); - exchange.getAttributes().put(Constants.CONTEXT, context); - boolean result = tarsPluginUnderTest.skip(exchange); - assertFalse(result); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCacheTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCacheTest.java deleted file mode 100644 index cbf228627eaf..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCacheTest.java +++ /dev/null @@ -1,147 +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.tars.cache; - -import com.qq.tars.protocol.annotation.Servant; -import org.apache.shenyu.common.concurrent.ShenyuThreadFactory; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.apache.shenyu.common.enums.RpcTypeEnum; -import org.apache.shenyu.plugin.tars.proxy.TarsInvokePrxList; -import org.apache.shenyu.plugin.tars.util.PrxInfoUtil; -import org.assertj.core.util.Lists; -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 java.util.Arrays; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Test case for {@link ApplicationConfigCache}. - */ -@ExtendWith(MockitoExtension.class) -public final class ApplicationConfigCacheTest { - - private ApplicationConfigCache applicationConfigCacheUnderTest; - - @BeforeEach - public void setUp() { - applicationConfigCacheUnderTest = ApplicationConfigCache.getInstance(); - } - - @Test - public void testGet() throws ClassNotFoundException { - final String rpcExt = "{\"methodInfo\":[{\"methodName\":\"method1\",\"params\":" - + "[{\"left\":\"int\",\"right\":\"param1\"},{\"left\":\"java.lang.Integer\"," - + "\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}"; - - final MetaData metaData = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path5", RpcTypeEnum.TARS.getName(), "serviceName5", "method1", - "parameterTypes", rpcExt, false, Constants.SYS_DEFAULT_NAMESPACE_ID); - - assertThrows(NullPointerException.class, () -> { - applicationConfigCacheUnderTest.initPrx(metaData); - final TarsInvokePrxList result = applicationConfigCacheUnderTest.get("path5"); - assertNotNull(result); - assertEquals("promise_method1", result.getMethod().getName()); - assertEquals(2, result.getParamTypes().length); - assertEquals(2, result.getParamNames().length); - Class prxClazz = Class.forName(PrxInfoUtil.getPrxName(metaData)); - assertTrue(Arrays.stream(prxClazz.getAnnotations()).anyMatch(annotation -> annotation instanceof Servant)); - - }); - } - - @Test - public void testConcurrentInitPrx() { - final String rpcExt1 = "{\"methodInfo\":[{\"methodName\":\"method1\",\"params\":" - + "[{\"left\":\"int\",\"right\":\"param1\"},{\"left\":\"java.lang.Integer\"," - + "\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}"; - final String rpcExt2 = "{\"methodInfo\":[{\"methodName\":\"method2\",\"params\":" - + "[{\"left\":\"int\",\"right\":\"param1\"},{\"left\":\"java.lang.Integer\"," - + "\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}"; - final String rpcExt3 = "{\"methodInfo\":[{\"methodName\":\"method3\",\"params\":" - + "[{\"left\":\"int\",\"right\":\"param1\"},{\"left\":\"java.lang.Integer\"," - + "\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}"; - final String rpcExt4 = "{\"methodInfo\":[{\"methodName\":\"method4\",\"params\":" - + "[{\"left\":\"int\",\"right\":\"param1\"},{\"left\":\"java.lang.Integer\"," - + "\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}"; - - final MetaData metaData1 = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path1", RpcTypeEnum.TARS.getName(), "serviceName1", "method1", - "parameterTypes", rpcExt1, false, Constants.SYS_DEFAULT_NAMESPACE_ID); - final MetaData metaData2 = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path2", RpcTypeEnum.TARS.getName(), "serviceName2", "method2", - "parameterTypes", rpcExt2, false, Constants.SYS_DEFAULT_NAMESPACE_ID); - final MetaData metaData3 = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path3", RpcTypeEnum.TARS.getName(), "serviceName3", "method3", - "parameterTypes", rpcExt3, false, Constants.SYS_DEFAULT_NAMESPACE_ID); - final MetaData metaData4 = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path4", RpcTypeEnum.TARS.getName(), "serviceName4", "method4", - "parameterTypes", rpcExt4, false, Constants.SYS_DEFAULT_NAMESPACE_ID); - List metaDataList = Lists.list(metaData1, metaData2, metaData3, metaData4); - assertThrows(NullPointerException.class, () -> { - ExecutorService executorService = Executors.newFixedThreadPool(4, - ShenyuThreadFactory.create("ApplicationConfigCache-tars-initPrx", false)); - CountDownLatch countDownLatch = new CountDownLatch(4); - metaDataList.forEach(metaData -> executorService.execute(() -> { - applicationConfigCacheUnderTest.initPrx(metaData); - countDownLatch.countDown(); - })); - countDownLatch.await(); - assertEquals("promise_method1", applicationConfigCacheUnderTest.get("path1").getMethod().getName()); - assertEquals("promise_method2", applicationConfigCacheUnderTest.get("path2").getMethod().getName()); - assertEquals("promise_method3", applicationConfigCacheUnderTest.get("path3").getMethod().getName()); - assertEquals("promise_method4", applicationConfigCacheUnderTest.get("path4").getMethod().getName()); - }); - } - - @Test - public void testInitPrx() { - final MetaData metaData = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path6", RpcTypeEnum.TARS.getName(), "serviceName6", "method1", - "parameterTypes", "{\"methodInfo\":[{\"methodName\":\"method1\",\"params\":[{\"left\":\"int\",\"right\":\"param1\"}," - + "{\"left\":\"java.lang.Integer\",\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}", false, Constants.SYS_DEFAULT_NAMESPACE_ID); - assertThrows(NullPointerException.class, () -> { - applicationConfigCacheUnderTest.initPrx(metaData); - final TarsInvokePrxList result = applicationConfigCacheUnderTest.get("path6"); - assertEquals("promise_method1", result.getMethod().getName()); - }); - } - - @Test - public void testGetClassMethodKey() { - assertEquals("className_methodName", ApplicationConfigCache.getClassMethodKey("className", "methodName")); - } - - @Test - public void testGetInstance() { - final ApplicationConfigCache result = ApplicationConfigCache.getInstance(); - assertNotNull(result); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandlerTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandlerTest.java deleted file mode 100644 index 3377e785b114..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsMetaDataHandlerTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.tars.handler; - -import org.apache.shenyu.common.constant.Constants; -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 org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; - -/** - * Test case for {@link org.apache.shenyu.plugin.tars.handler.TarsMetaDataHandler}. - */ -@ExtendWith(MockitoExtension.class) -public class TarsMetaDataHandlerTest { - - private TarsMetaDataHandler tarsMetaDataHandler; - - private MetaData metaData; - - @BeforeEach - public void setUp() { - metaData = new MetaData("id", "127.0.0.1:8080", "contextPath", - "path", RpcTypeEnum.TARS.getName(), "serviceName", "method1", - "parameterTypes", "{\"methodInfo\":[{\"methodName\":\"method1\",\"params\":[{\"left\":\"int\",\"right\":\"param1\"}," - + "{\"left\":\"java.lang.Integer\",\"right\":\"param2\"}],\"returnType\":\"java.lang.String\"}]}", false, Constants.SYS_DEFAULT_NAMESPACE_ID); - tarsMetaDataHandler = new TarsMetaDataHandler(); - } - - @Test - public void testOnSubscribe() { - tarsMetaDataHandler.handle(metaData); - /** - * test for cache; - */ - tarsMetaDataHandler.handle(metaData); - } - - @Test - public void testUnSubscribe() { - tarsMetaDataHandler.remove(metaData); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsPluginDataHandlerTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsPluginDataHandlerTest.java deleted file mode 100644 index a9791f1eafe5..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/handler/TarsPluginDataHandlerTest.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.tars.handler; - -import org.apache.shenyu.common.dto.PluginData; -import org.apache.shenyu.common.dto.convert.plugin.TarsRegisterConfig; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.Singleton; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -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.assertTrue; - -/** - * Test case for {@link TarsPluginDataHandler}. - */ -@ExtendWith(MockitoExtension.class) -public final class TarsPluginDataHandlerTest { - - private TarsPluginDataHandler tarsPluginDataHandlerUnderTest; - - @BeforeEach - public void setUp() { - tarsPluginDataHandlerUnderTest = new TarsPluginDataHandler(); - } - - @Test - public void testHandlerPlugin() { - final PluginData pluginData = new PluginData("id", "name", "{\"threadpool\":\"cached\",\"corethreads\":1,\"threads\":2,\"queues\":3}", "0", true, null); - tarsPluginDataHandlerUnderTest.handlerPlugin(pluginData); - assertTrue(pluginData.getName().endsWith("name")); - TarsRegisterConfig config = Singleton.INST.get(TarsRegisterConfig.class); - Assertions.assertEquals(config.getThreadpool(), "cached"); - Assertions.assertEquals(config.getCorethreads(), 1); - Assertions.assertEquals(config.getThreads(), 2); - Assertions.assertEquals(config.getQueues(), 3); - } - - @Test - public void testPluginNamed() { - final String result = tarsPluginDataHandlerUnderTest.pluginNamed(); - assertEquals(PluginEnum.TARS.getName(), result); - } -} diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/util/PrxInfoUtilTest.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/util/PrxInfoUtilTest.java deleted file mode 100644 index 431756bf4d59..000000000000 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/test/java/org/apache/shenyu/plugin/tars/util/PrxInfoUtilTest.java +++ /dev/null @@ -1,80 +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.tars.util; - -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.MetaData; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - -/** - * Test case for {@link PrxInfoUtil}. - */ -@ExtendWith(MockitoExtension.class) -public class PrxInfoUtilTest { - - @Test - public void testGetParamClass() throws Exception { - assertEquals(int.class, PrxInfoUtil.getParamClass("int")); - assertEquals(long.class, PrxInfoUtil.getParamClass("long")); - assertEquals(short.class, PrxInfoUtil.getParamClass("short")); - assertEquals(byte.class, PrxInfoUtil.getParamClass("byte")); - assertEquals(boolean.class, PrxInfoUtil.getParamClass("boolean")); - assertEquals(char.class, PrxInfoUtil.getParamClass("char")); - assertEquals(float.class, PrxInfoUtil.getParamClass("float")); - assertEquals(Integer.class, PrxInfoUtil.getParamClass("java.lang.Integer")); - } - - @Test - public void testGetParamClassThrowsClassNotFoundException() throws Exception { - assertThrows(ClassNotFoundException.class, () -> PrxInfoUtil.getParamClass("className")); - } - - @Test - public void testGetPrxName() { - final MetaData metaData = new MetaData("id", "appName", "contextPath", "/path", - "rpcType", "serviceName", "methodName", "parameterTypes", - "rpcExt", false, Constants.SYS_DEFAULT_NAMESPACE_ID); - final String result = PrxInfoUtil.getPrxName(metaData); - assertEquals("pathmethodNamePrx", result); - } - - @Test - public void testGetMethodName() { - assertEquals("promise_methodName", PrxInfoUtil.getMethodName("methodName")); - } - - @Test - public void testGetObjectName() { - final String result = PrxInfoUtil.getObjectName("127.0.0.1:8080", "serviceName"); - assertEquals("serviceName@tcp -h 127.0.0.1 -p 8080", result); - } - - @Test - public void testGetParamArray() { - assertArrayEquals(new Object[]{11, Double.valueOf("1.321321312"), Long.valueOf("131231312"), Short.valueOf("11"), Byte.valueOf("0"), false, 'a', 1.321321312F}, - PrxInfoUtil.getParamArray(new Class[]{int.class, double.class, long.class, short.class, byte.class, boolean.class, char.class, float.class}, - new String[]{"int", "double", "long", "short", "byte", "boolean", "char", "float"}, - "{\"int\":11,\"double\":1.321321312,\"long\":131231312,\"short\":11,\"byte\":0,\"boolean\":false,\"char\":'a',\"float\":1.321321312}")); - } -} 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..4d39db908ccb 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 @@ -106,7 +106,6 @@ public boolean skip(final ServerWebExchange exchange) { return skipExcept(exchange, RpcTypeEnum.DUBBO, RpcTypeEnum.GRPC, - RpcTypeEnum.TARS, RpcTypeEnum.MOTAN, RpcTypeEnum.SOFA); } diff --git a/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/RPCMessageWriter.java b/shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/RPCMessageWriter.java index 8af525397baa..863b23259bf4 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 @@ -58,6 +58,6 @@ public Mono writeWith(final ServerWebExchange exchange, final ShenyuPlugin @Override public List supportTypes() { return Lists.newArrayList(RpcTypeEnum.DUBBO.getName(), RpcTypeEnum.SOFA.getName(), - RpcTypeEnum.GRPC.getName(), RpcTypeEnum.MOTAN.getName(), RpcTypeEnum.TARS.getName()); + RpcTypeEnum.GRPC.getName(), RpcTypeEnum.MOTAN.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..5c9c0c4bbfba 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 @@ -67,7 +67,6 @@ public void setup() { writerMap.put(RpcTypeEnum.SOFA.getName(), messageWriter); writerMap.put(RpcTypeEnum.GRPC.getName(), messageWriter); writerMap.put(RpcTypeEnum.MOTAN.getName(), messageWriter); - writerMap.put(RpcTypeEnum.TARS.getName(), messageWriter); responsePlugin = new ResponsePlugin(writerMap); } @@ -87,9 +86,6 @@ public void testExecute() { ServerWebExchange motanExchange = generateServerWebExchange(RpcTypeEnum.MOTAN.getName()); StepVerifier.create(responsePlugin.execute(motanExchange, chain)).expectSubscription().verifyComplete(); - - ServerWebExchange tarsExchange = generateServerWebExchange(RpcTypeEnum.TARS.getName()); - StepVerifier.create(responsePlugin.execute(tarsExchange, chain)).expectSubscription().verifyComplete(); } @Test 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..a3bd45b48a85 100644 --- a/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/dto/ApiDocRegisterDTO.java +++ b/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/dto/ApiDocRegisterDTO.java @@ -60,7 +60,7 @@ public class ApiDocRegisterDTO implements DataTypeParent { private String version; /** - * http,dubbo,sofa,tars,websocket,motan,grpc. + * http,dubbo,sofa,websocket,motan,grpc. */ private String rpcType; diff --git a/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/enums/RegisterTypeEnum.java b/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/enums/RegisterTypeEnum.java index 4af1c7c3bca2..cca34bdada2d 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 @@ -37,11 +37,6 @@ public enum RegisterTypeEnum { */ SOFA("sofa"), - /** - * Tars rpc type enum. - */ - TARS("tars"), - /** * Motan 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..436b31aec1cd 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 @@ -30,7 +30,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 shenyu-spring-boot-starter-client-common diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/pom.xml deleted file mode 100644 index e306f46ac04c..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-spring-boot-starter-client - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-spring-boot-starter-client-tars - - - - org.apache.shenyu - shenyu-client-tars - ${project.version} - - - - org.apache.shenyu - shenyu-spring-boot-starter-client-common - ${project.version} - - - diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfiguration.java deleted file mode 100644 index 1e1861fbb02b..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfiguration.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.tars; - -import org.apache.shenyu.client.tars.TarsServiceBeanEventListener; -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; - -/** - * Tars type client bean postprocessor. - */ -@Configuration -@ImportAutoConfiguration(ShenyuClientCommonBeanConfiguration.class) -@ConditionalOnProperty(value = "shenyu.register.enabled", matchIfMissing = true, havingValue = "true") -public class ShenyuTarsClientConfiguration { - - static { - VersionUtils.checkDuplicate(ShenyuTarsClientConfiguration.class); - } - - /** - * Tars service bean post processor. - * - * @param clientConfig the client config - * @param shenyuClientRegisterRepository the shenyuClientRegisterRepository - * @return the tars service bean post processor - */ - @Bean - public TarsServiceBeanEventListener tarsServiceBeanEventListener(final ShenyuClientConfig clientConfig, final ShenyuClientRegisterRepository shenyuClientRegisterRepository) { - return new TarsServiceBeanEventListener(clientConfig, shenyuClientRegisterRepository); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/resources/META-INF/spring.factories b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 60a0ce17cd9f..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/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.tars.ShenyuTarsClientConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/resources/META-INF/spring.provides b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/main/resources/META-INF/spring.provides deleted file mode 100644 index 3a6464fbd1f2..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/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-tars diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/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-tars/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index e145b17edc5f..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/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.tars.ShenyuTarsClientConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/test/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/test/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfigurationTest.java deleted file mode 100644 index 41d8eb879370..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-tars/src/test/java/org/apache/shenyu/springboot/starter/client/tars/ShenyuTarsClientConfigurationTest.java +++ /dev/null @@ -1,73 +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.tars; - -import org.apache.shenyu.client.tars.TarsServiceBeanEventListener; -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.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mockStatic; - -/** - * Test case for {@link ShenyuTarsClientConfiguration}. - */ -@Configuration -@EnableConfigurationProperties -public class ShenyuTarsClientConfigurationTest { - - private ApplicationContextRunner applicationContextRunner; - - @BeforeEach - public void before() { - applicationContextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(ShenyuTarsClientConfiguration.class)) - .withBean(ShenyuTarsClientConfigurationTest.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.tars.props[contextPath]=/tars", - "shenyu.client.tars.props[appName]=tars", - "shenyu.client.tars.props[host]=127.0.0.1", - "shenyu.client.tars.props[port]=21715" - ); - } - - @Test - public void testTarsServiceBeanPostProcessor() { - MockedStatic registerUtilsMockedStatic = mockStatic(RegisterUtils.class); - registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.ofNullable("token")); - applicationContextRunner.run(context -> { - TarsServiceBeanEventListener listener = context.getBean("tarsServiceBeanEventListener", TarsServiceBeanEventListener.class); - assertNotNull(listener); - }); - 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..974bfd7c335f 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 @@ -39,7 +39,6 @@ shenyu-spring-boot-starter-plugin-sofa shenyu-spring-boot-starter-plugin-motan shenyu-spring-boot-starter-plugin-resilience4j - shenyu-spring-boot-starter-plugin-tars shenyu-spring-boot-starter-plugin-context-path shenyu-spring-boot-starter-plugin-grpc shenyu-spring-boot-starter-plugin-redirect diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/pom.xml deleted file mode 100644 index 7e3518684d17..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin - 2.7.1-SNAPSHOT - - 4.0.0 - shenyu-spring-boot-starter-plugin-tars - - - - org.apache.shenyu - shenyu-plugin-tars - ${project.version} - - - diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfiguration.java deleted file mode 100644 index 0f4de58e45cb..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfiguration.java +++ /dev/null @@ -1,80 +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.tars; - -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.tars.TarsPlugin; -import org.apache.shenyu.plugin.tars.context.TarsShenyuContextDecorator; -import org.apache.shenyu.plugin.tars.handler.TarsPluginDataHandler; -import org.apache.shenyu.plugin.tars.handler.TarsMetaDataHandler; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * The type tars plugin configuration. - */ -@Configuration -@ConditionalOnClass(TarsPlugin.class) -@ConditionalOnProperty(value = {"shenyu.plugins.tars.enabled"}, havingValue = "true", matchIfMissing = true) -public class TarsPluginConfiguration { - - /** - * Tars plugin. - * - * @return the tars plugin - */ - @Bean - public ShenyuPlugin tarsPlugin() { - return new TarsPlugin(); - } - - /** - * Tars meta data handler. - * - * @return the meta data handler - */ - @Bean - public MetaDataHandler tarsMetaDataHandler() { - return new TarsMetaDataHandler(); - } - - /** - * Tars plugin data handler. - * - * @return the plugin data handler - */ - @Bean - public PluginDataHandler tarsPluginDataHandler() { - return new TarsPluginDataHandler(); - } - - /** - * Tars shenyu context decorator. - * - * @return the shenyu context decorator - */ - @Bean - public ShenyuContextDecorator tarsShenyuContextDecorator() { - return new TarsShenyuContextDecorator(); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/resources/META-INF/spring.factories b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/resources/META-INF/spring.factories deleted file mode 100644 index d56ac7bb07e6..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/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.tars.TarsPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/resources/META-INF/spring.provides b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/main/resources/META-INF/spring.provides deleted file mode 100644 index 0a6c45b8ade3..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/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-tars diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/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-tars/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 88015897055e..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/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.tars.TarsPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/test/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/test/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfigurationTest.java deleted file mode 100644 index 04889d56fbda..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-tars/src/test/java/org/apache/shenyu/springboot/starter/plugin/tars/TarsPluginConfigurationTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.springboot.starter.plugin.tars; - -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.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 TarsPluginConfiguration}. - */ -@Configuration -@EnableConfigurationProperties -public class TarsPluginConfigurationTest { - - private ApplicationContextRunner applicationContextRunner; - - @BeforeEach - public void before() { - applicationContextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(TarsPluginConfiguration.class)) - .withBean(TarsPluginConfigurationTest.class) - .withPropertyValues("debug=true"); - } - - @Test - public void testTarsPlugin() { - applicationContextRunner.run(context -> { - ShenyuPlugin plugin = context.getBean("tarsPlugin", ShenyuPlugin.class); - assertNotNull(plugin); - assertThat(plugin.named()).isEqualTo(PluginEnum.TARS.getName()); - } - ); - } - - @Test - public void testTarsMetaDataHandler() { - applicationContextRunner.run(context -> { - MetaDataHandler handler = context.getBean("tarsMetaDataHandler", MetaDataHandler.class); - assertNotNull(handler); - } - ); - } - - @Test - public void testTarsPluginDataHandler() { - applicationContextRunner.run(context -> { - PluginDataHandler handler = context.getBean("tarsPluginDataHandler", PluginDataHandler.class); - assertNotNull(handler); - } - ); - } - - @Test - public void testTarsShenyuContextDecorator() { - applicationContextRunner.run(context -> { - ShenyuContextDecorator decorator = context.getBean("tarsShenyuContextDecorator", ShenyuContextDecorator.class); - assertNotNull(decorator); - } - ); - } -}