From 9d12ab1efcbdd908eae1a01488b5028f4130e1d1 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 1 Apr 2024 22:35:09 +0800 Subject: [PATCH 1/4] feat: add e2e framework support --- .github/workflows/E2E.yml | 21 +++ .gitignore | 1 + .../dubbo-samples-seata-account/pom.xml | 4 + .../docker-compose.yaml | 70 ++++++++ .../e2e-files/expected.yaml | 1 + .../e2e-files/sqlsh/all.sql | 56 ++++++ .../springboot-dubbo-seata/seata-e2e.yaml | 100 +++++++++++ .../src/main/resources/application.properties | 6 +- .../springboot-dubbo-seata-business/pom.xml | 5 + ...ringbootDubboSeataBusinessApplication.java | 6 +- .../org/apache/seata/e2e/E2EController.java | 47 +++++ .../src/main/resources/application.properties | 5 +- .../seata/service/impl/OrderServiceImpl.java | 2 + .../src/main/resources/application.properties | 6 +- .../src/main/resources/application.properties | 6 +- e2e-test/e2e-test-builder/.gitignore | 38 ++++ e2e-test/e2e-test-builder/pom.xml | 57 ++++++ .../java/org/apache/seata/BuilderMain.java | 19 ++ .../org/apache/seata/builder/E2EBuilder.java | 50 ++++++ .../apache/seata/builder/ImageBuilder.java | 107 +++++++++++ .../apache/seata/builder/SceneBuilder.java | 62 +++++++ .../apache/seata/config/ConfigConstants.java | 14 ++ .../org/apache/seata/config/ConfigReader.java | 24 +++ .../generator/DockerComposeGenerator.java | 56 ++++++ .../generator/DockerFileForJarGenerator.java | 62 +++++++ .../generator/SkyWalkingE2EFileGenerator.java | 52 ++++++ .../java/org/apache/seata/model/Case.java | 34 ++++ .../java/org/apache/seata/model/DependOn.java | 34 ++++ .../org/apache/seata/model/DockerService.java | 118 +++++++++++++ .../org/apache/seata/model/E2EConfig.java | 52 ++++++ .../org/apache/seata/model/E2EWrapper.java | 17 ++ .../java/org/apache/seata/model/Inherit.java | 27 +++ .../java/org/apache/seata/model/Module.java | 61 +++++++ .../java/org/apache/seata/model/Modules.java | 36 ++++ .../java/org/apache/seata/model/Retry.java | 34 ++++ .../java/org/apache/seata/util/Utils.java | 34 ++++ .../src/main/resources/template/at-common | 0 .../main/resources/template/dockercompose.ftl | 167 ++++++++++++++++++ .../resources/template/jar-dockerFile.ftl | 3 + .../resources/template/skywalking-e2e.ftl | 31 ++++ e2e-test/e2e-test-runner/.gitignore | 38 ++++ e2e-test/e2e-test-runner/pom.xml | 21 +++ .../java/org/apache/seata/RunnerMain.java | 20 +++ .../controller/SkyWalkingController.java | 47 +++++ e2e-test/pom.xml | 63 +++++++ 45 files changed, 1700 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/E2E.yml create mode 100644 at-sample/springboot-dubbo-seata/docker-compose.yaml create mode 100644 at-sample/springboot-dubbo-seata/e2e-files/expected.yaml create mode 100644 at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql create mode 100644 at-sample/springboot-dubbo-seata/seata-e2e.yaml create mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java create mode 100644 e2e-test/e2e-test-builder/.gitignore create mode 100644 e2e-test/e2e-test-builder/pom.xml create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java create mode 100644 e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/at-common create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl create mode 100644 e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl create mode 100644 e2e-test/e2e-test-runner/.gitignore create mode 100644 e2e-test/e2e-test-runner/pom.xml create mode 100644 e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java create mode 100644 e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java create mode 100644 e2e-test/pom.xml diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml new file mode 100644 index 000000000..261df6c95 --- /dev/null +++ b/.github/workflows/E2E.yml @@ -0,0 +1,21 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ e2e-demo ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ e2e-demo ] +# +#jobs: \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3c090b4cf..5898d2b47 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ target/ /distribution/lib server/*root.* server/.root.* +tmp/ # system ignore .DS_Store diff --git a/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml b/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml index 3d4f98cf2..ddc278e2c 100644 --- a/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml +++ b/at-sample/dubbo-samples-seata/dubbo-samples-seata-account/pom.xml @@ -57,6 +57,10 @@ io.seata seata-spring-boot-starter + + org.springframework.boot + spring-boot-starter-web + diff --git a/at-sample/springboot-dubbo-seata/docker-compose.yaml b/at-sample/springboot-dubbo-seata/docker-compose.yaml new file mode 100644 index 000000000..163afa922 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/docker-compose.yaml @@ -0,0 +1,70 @@ +version: "3.9" +services: + account: + hostname: account + image: springboot-dubbo-seata-account:0.0.1 + restart: on-failure + depends_on: + - seata-server + - zookeeper + - mysql + business: + hostname: business + image: springboot-dubbo-seata-business:0.0.1 + restart: on-failure + depends_on: + - account + - order + - storage + order: + hostname: order + image: springboot-dubbo-seata-order:0.0.1 + restart: on-failure + depends_on: + - seata-server + - zookeeper + - mysql + storage: + hostname: storage + image: springboot-dubbo-seata-storage:0.0.1 + restart: on-failure + depends_on: + - seata-server + - zookeeper + - mysql + mysql: + hostname: businessmysql + image: mysql:5.7 + volumes: + - ./sqlsh:/docker-entrypoint-initdb.d + restart: always + environment: + MYSQL_ROOT_PASSWORD: 123456 + MYSQL_DATABASE: storage + MYSQL_USER: user + MYSQL_PASSWORD: user + # ports: + # - "3307:3306" + networks: + - host + healthcheck: + test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] + interval: 5s + timeout: 10s + retries: 10 + seata-server: + image: seataio/seata-server:${latest-release-version} + hostname: seata-server + ports: + - "7091:7091" + - "8091:8091" + environment: + - SEATA_PORT=8091 + - STORE_MODE=file + zookeeper: + hostname: zookeeper + image: zookeeper:3.7.1 + + +networks: + host: \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml b/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml new file mode 100644 index 000000000..946b0e70c --- /dev/null +++ b/at-sample/springboot-dubbo-seata/e2e-files/expected.yaml @@ -0,0 +1 @@ +{"res": "success"} \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql b/at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql new file mode 100644 index 000000000..a6974d7f6 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/e2e-files/sqlsh/all.sql @@ -0,0 +1,56 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +CREATE TABLE `account_tbl` +( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` varchar(255) DEFAULT NULL, + `money` int(11) DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE `stock_tbl` +( + `id` int(11) NOT NULL AUTO_INCREMENT, + `commodity_code` varchar(255) DEFAULT NULL, + `count` int(11) DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `commodity_code` (`commodity_code`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE `order_tbl` +( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` varchar(255) DEFAULT NULL, + `commodity_code` varchar(255) DEFAULT NULL, + `count` int(11) DEFAULT '0', + `money` int(11) DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `undo_log` +( + `branch_id` BIGINT NOT NULL COMMENT 'branch transaction id', + `xid` VARCHAR(128) NOT NULL COMMENT 'global transaction id', + `context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as serialization', + `rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info', + `log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense status', + `log_created` DATETIME(6) NOT NULL COMMENT 'create datetime', + `log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime', + UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`) + ) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT ='AT transaction mode undo table'; +ALTER TABLE `undo_log` ADD INDEX `ix_log_created` (`log_created`); \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/seata-e2e.yaml b/at-sample/springboot-dubbo-seata/seata-e2e.yaml new file mode 100644 index 000000000..800d82183 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/seata-e2e.yaml @@ -0,0 +1,100 @@ +e2e: + scene_name: at-springboot-dubbo-seata + # 后期考虑扩展成通用基础设施一键配置 + inherit: + name: at-common + # retry config + retry: + max: 5 + interval: 10s + total_timeout: 20m + # 多服务配置, 有一个test模块用于触发测试,其余皆为provider + modules: + # 划分为不同的模块后续可以做功能扩展 + consumers: + # docker service name + - name: springboot-dubbo-seata-business + # 这里可以加一些插件实现不同功能 + # docker service 下的参数,这样写是为了方便后续扩展解耦 + docker_service: + network_mode: host + restart: on-failure + container_name: test + depends_on: + springboot-dubbo-seata-account: + condition: service_started + springboot-dubbo-seata-storage: + condition: service_started + springboot-dubbo-seata-order: + condition: service_started + providers: + - name: springboot-dubbo-seata-account + docker_service: + network_mode: host + restart: on-failure + depends_on: + zookeeper: + condition: service_healthy + mysql: + condition: service_healthy + - name: springboot-dubbo-seata-order + docker_service: + network_mode: host + restart: on-failure + depends_on: + zookeeper: + condition: service_healthy + mysql: + condition: service_healthy + - name: springboot-dubbo-seata-storage + docker_service: + network_mode: host + restart: on-failure + depends_on: + zookeeper: + condition: service_healthy + mysql: + condition: service_healthy + infrastructures: + - name: mysql + docker_service: + image: mysql:5.7 + ports: + - "3307:3306" + volumes: + - ./e2e-files/sqlsh:/docker-entrypoint-initdb.d + restart: always + environment: + MYSQL_ROOT_PASSWORD: 123456 + MYSQL_DATABASE: seata + MYSQL_USER: user + MYSQL_PASSWORD: 123456 + healthcheck: + test: '[ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]' + interval: 5s + timeout: 10s + retries: 10 + - name: seata-server + docker_service: + image: seataio/seata-server:2.0.0 + ports: + - "7091:7091" + - "8091:8091" + environment: + SEATA_PORT: 8091 + STORE_MODE: file + - name: zookeeper + docker_service: + image: zookeeper:3.5.7 + ports: + - "2181:2181" + healthcheck: + test: '[ "CMD", "echo", "ruok", "|", "nc", "localhost", "2181", "|", "grep", "imok" ]' + interval: 30s + timeout: 10s + retries: 3 + + cases: + - name: normal test + invoke: 'docker exec test curl http://127.0.0.1:9991/testCreate' + verify: './e2e-files/expected.yaml' \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties index c89f20f95..5a53776dc 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties @@ -1,12 +1,12 @@ spring.application.name=springboot-dubbo-seata-account spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?userSSL=false&useUnicode=true&characterEncoding=UTF8 -spring.datasource.username=root +spring.datasource.url=jdbc:mysql://127.0.0.1:3307/seata??useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-account seata.tx-service-group=my_test_tx_group dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=28801 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml index 5e9168528..89a4b1765 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/pom.xml @@ -97,6 +97,11 @@ springboot-dubbo-seata-common 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java index 22cd54d86..133d57271 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/SpringbootDubboSeataBusinessApplication.java @@ -31,9 +31,9 @@ public class SpringbootDubboSeataBusinessApplication implements BeanFactoryAware public static void main(String[] args) throws Exception { SpringApplication.run(SpringbootDubboSeataBusinessApplication.class, args); - BusinessService businessService = BEAN_FACTORY.getBean(BusinessService.class); - - businessService.purchase("U100001", "C00321", 2); +// BusinessService businessService = BEAN_FACTORY.getBean(BusinessService.class); +// +// businessService.purchase("U100001", "C00321", 2); } @Override diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java new file mode 100644 index 000000000..83e179d80 --- /dev/null +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/java/org/apache/seata/e2e/E2EController.java @@ -0,0 +1,47 @@ +package org.apache.seata.e2e; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.seata.service.BusinessService; +import org.apache.seata.service.OrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.yaml.snakeyaml.Yaml; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +@RestController +public class E2EController { + @Autowired + private BusinessService businessService; + + @GetMapping("testCreate") + public void testCreate(HttpServletResponse response) throws IOException { + Map res = new HashMap<>(); + // 设置响应类型 + response.setContentType("text/yaml"); + response.setCharacterEncoding("UTF-8"); + + Yaml yaml = new Yaml(); + try { + businessService.purchase("U100001", "C00321", 2); + } catch (Exception e) { + e.printStackTrace(); + res.put("res", "failed"); + String yamlStr = yaml.dump(res); + response.getWriter().write(yamlStr); + return; + } + res.put("res", "success"); + String yamlStr = yaml.dump(res); + response.getWriter().write(yamlStr); + } +} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties index 4dc07526d..f220ff15b 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties @@ -3,6 +3,7 @@ seata.application-id=springboot-dubbo-seata-business seata.tx-service-group=my_test_tx_group dubbo.application.qos-enable=false dubbo.scan.base-packages=org.apache.seata -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.protocol.name=dubbo -dubbo.protocol.port=20883 \ No newline at end of file +dubbo.protocol.port=20883 +server.port=9991 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java index d0617e3ba..4babcb4a5 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/java/org/apache/seata/service/impl/OrderServiceImpl.java @@ -26,12 +26,14 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; +import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.sql.PreparedStatement; import java.util.Objects; @DubboService +@Component public class OrderServiceImpl implements OrderService { private static final Logger LOGGER = LoggerFactory.getLogger(OrderService.class); diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties index e192de12e..defe4d30a 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties @@ -1,12 +1,12 @@ spring.application.name=springboot-dubbo-seata-order spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?userSSL=false&useUnicode=true&characterEncoding=UTF8 -spring.datasource.username=root +spring.datasource.url=jdbc:mysql://127.0.0.1:3307/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-order seata.tx-service-group=my_test_tx_group dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20883 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties index 33e291f1b..b726b7fa7 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties @@ -1,12 +1,12 @@ spring.application.name=springboot-dubbo-seata-storage spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?userSSL=false&useUnicode=true&characterEncoding=UTF8 -spring.datasource.username=root +spring.datasource.url=jdbc:mysql://127.0.0.1:3307/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-storage seata.tx-service-group=my_test_tx_group dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://localhost:2181 +dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20882 \ No newline at end of file diff --git a/e2e-test/e2e-test-builder/.gitignore b/e2e-test/e2e-test-builder/.gitignore new file mode 100644 index 000000000..5ff6309b7 --- /dev/null +++ b/e2e-test/e2e-test-builder/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/e2e-test/e2e-test-builder/pom.xml b/e2e-test/e2e-test-builder/pom.xml new file mode 100644 index 000000000..01b3a38d8 --- /dev/null +++ b/e2e-test/e2e-test-builder/pom.xml @@ -0,0 +1,57 @@ + + 4.0.0 + + org.apache.seata + e2e-test + 2.0.0 + + org.apache.seata + e2e-test-builder + 2.0.0 + e2e-test-builder + + + + org.yaml + snakeyaml + + + org.freemarker + freemarker + + + org.slf4j + slf4j-api + + + ch.qos.logback + logback-classic + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + log4j-over-slf4j + + + commons-io + commons-io + 2.11.0 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java new file mode 100644 index 000000000..2cb9e9148 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java @@ -0,0 +1,19 @@ +package org.apache.seata; + +import org.apache.seata.builder.E2EBuilder; + +import java.io.IOException; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class BuilderMain { + public static void main(String[] args) throws IOException, InterruptedException { + E2EBuilder e2EBuilder = new E2EBuilder(); + e2EBuilder.setRootPath("./"); + if (args != null && args.length == 1) { + e2EBuilder.setRootPath(args[1]); + } + e2EBuilder.buildSeataE2ETest(); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java new file mode 100644 index 000000000..5009d5a36 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java @@ -0,0 +1,50 @@ +package org.apache.seata.builder; + +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.config.ConfigReader; +import org.apache.seata.model.E2EConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class E2EBuilder { + private String rootPath; + private static final Logger LOGGER = LoggerFactory.getLogger(E2EBuilder.class); + + public String getRootPath() { + return rootPath; + } + + public void setRootPath(String rootPath) { + this.rootPath = rootPath; + } + + public void buildSeataE2ETest() throws IOException, InterruptedException { + File root = new File(rootPath); + searchAndBuild(root); + } + + private void searchAndBuild(File dir) throws IOException, InterruptedException { + File[] files = dir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isDirectory()) { + searchAndBuild(file); + File configFile = new File(file, ConfigConstants.SEATA_E2E_FILE); + if (configFile.exists()) { + E2EConfig e2EConfig = ConfigReader.readConfig(configFile); + ImageBuilder imageBuilder = new ImageBuilder(); + imageBuilder.BuildImage(e2EConfig, file); + SceneBuilder sceneBuilder = new SceneBuilder(); + sceneBuilder.buildScene(e2EConfig, file); + } + } + } + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java new file mode 100644 index 000000000..69700e6b6 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java @@ -0,0 +1,107 @@ +package org.apache.seata.builder; + +import org.apache.seata.generator.DockerFileForJarGenerator; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.apache.seata.util.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.List; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class ImageBuilder { + private static final Logger LOGGER = LoggerFactory.getLogger(ImageBuilder.class); + + public void BuildImage(E2EConfig e2EConfig, File moduleDir) throws IOException, InterruptedException { + int exitCode = packageMavenParentModule(moduleDir); + if (exitCode == 0) { + buildDockerImage(moduleDir, e2EConfig); + } + } + + private int packageMavenParentModule(File moduleDir) throws IOException, InterruptedException { + LOGGER.info("Packaging Maven module: " + moduleDir.getPath()); + ProcessBuilder builder = new ProcessBuilder(); + builder.directory(moduleDir); + builder.command("mvn.cmd", "clean", "package"); + Process process = builder.start(); + Utils.printProcessLog(LOGGER, process); + int exitCode = process.waitFor(); + LOGGER.info(String.format("Maven module %s packaging finished with exit code %d", moduleDir, exitCode)); + return exitCode; + } + + private void buildDockerImage(File parentModuleDir, E2EConfig e2EConfig) throws IOException, InterruptedException { + LOGGER.info("Building Docker image for maven parent module: " + parentModuleDir.getPath()); + File[] files = parentModuleDir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isDirectory()) { + if (copyJarInMavenChildModule(file, e2EConfig) == null) { + LOGGER.warn("Copying jar in Maven child module failed: " + file.getPath()); + } + } + } + } + prepareDockerfile(e2EConfig); + runDockerBuild(e2EConfig); + } + + private void runDockerBuild(E2EConfig e2EConfig) throws IOException, InterruptedException { + LOGGER.info(String.format("Building Docker image for scene %s", e2EConfig.getScene_name())); + String tmpDir = ConfigConstants.IMAGE_DIR; + File composeDir = new File(tmpDir); + List modules = new ArrayList<>(); + modules.addAll(e2EConfig.getModules().getConsumers()); + modules.addAll(e2EConfig.getModules().getProviders()); + for (Module module : modules) { + String moduleComposeDir = new File(composeDir, e2EConfig.getScene_name() + "-" + + module.getName()).getAbsolutePath(); + ProcessBuilder builder = new ProcessBuilder(); + builder.directory(new File(moduleComposeDir)); + builder.command("docker", "build", "-t", String.format("%s:%s", module.getName(), "0.0.1"), "."); + Process process = builder.start(); + Utils.printProcessLog(LOGGER, process); + int exitCode = process.waitFor(); + if (exitCode != 0) { + LOGGER.warn(String.format("Docker image for module %s build failed with exit code %d", module.getName(), exitCode)); + } + } + } + + private void prepareDockerfile(E2EConfig e2EConfig) { + LOGGER.info(String.format("Generating Dockerfile for scene %s", e2EConfig.getScene_name())); + DockerFileForJarGenerator generator = new DockerFileForJarGenerator(); + generator.generateDockerFiles(e2EConfig); + } + + private File copyJarInMavenChildModule(File moduleDir, E2EConfig e2EConfig) throws IOException { + LOGGER.info("Copying jar in Maven child module: " + moduleDir.getPath()); + File targetDir = new File(moduleDir, "target"); + if (targetDir.exists() && targetDir.isDirectory()) { + File[] files = targetDir.listFiles((dir, name) -> name.endsWith(".jar")); + if (files != null && files.length == 1) { + Path dir = Paths.get(ConfigConstants.IMAGE_DIR, e2EConfig.getScene_name() + "-" + + moduleDir.getName()); + Files.createDirectories(dir); + Path destPath = Paths.get(dir.toAbsolutePath().toString(), moduleDir.getName() + ".jar"); + Files.copy(files[0].toPath(), destPath, StandardCopyOption.REPLACE_EXISTING); + LOGGER.info("Copying jar in Maven child module success" + moduleDir.getPath()); + return destPath.toFile(); + } + return null; + } + return null; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java new file mode 100644 index 000000000..ea46bd319 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/SceneBuilder.java @@ -0,0 +1,62 @@ +package org.apache.seata.builder; + +import org.apache.commons.io.file.PathUtils; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.generator.DockerComposeGenerator; +import org.apache.seata.generator.SkyWalkingE2EFileGenerator; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + +import static org.apache.seata.config.ConfigConstants.E2E_FILES; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class SceneBuilder { + private static final Logger LOGGER = LoggerFactory.getLogger(SceneBuilder.class); + + public void buildScene(E2EConfig e2EConfig, File file) throws IOException { + initE2EConfigForSceneBuild(e2EConfig); + Path sceneDir = Paths.get(ConfigConstants.SCENE_DIR, e2EConfig.getScene_name()); + Files.createDirectories(sceneDir); + copyE2EResource(file, sceneDir); + generateTestFiles(e2EConfig, sceneDir); + } + + private void initE2EConfigForSceneBuild(E2EConfig e2EConfig) { + for (Module provider : e2EConfig.getModules().getProviders()) { + provider.getDocker_service().setImage( + provider.getName() + ":" + ConfigConstants.IMAGE_VERSION); + } + for (Module consumer : e2EConfig.getModules().getConsumers()) { + consumer.getDocker_service().setImage( + consumer.getName() + ":" + ConfigConstants.IMAGE_VERSION); + } + } + + private void generateTestFiles(E2EConfig e2EConfig, Path sceneDir) { + DockerComposeGenerator dockerComposeGenerator = new DockerComposeGenerator(); + dockerComposeGenerator.generateDockerComposeFile(e2EConfig, sceneDir.toFile()); + SkyWalkingE2EFileGenerator skyWalkingE2EFileGenerator = new SkyWalkingE2EFileGenerator(); + skyWalkingE2EFileGenerator.generateSkyWalkingE2EFile(e2EConfig, sceneDir.toFile()); + } + + private void copyE2EResource(File file, Path sceneDir) throws IOException { + File[] resources = file.listFiles((tempFile) -> E2E_FILES.equals(tempFile.getName())); + if (resources == null || resources.length != 1) { + LOGGER.error(String.format("find e2e-files in file: %s", file)); + throw new RuntimeException("e2e-files not found"); + } + PathUtils.copyDirectory(resources[0].toPath(), Paths.get(sceneDir.toString(), E2E_FILES), + StandardCopyOption.REPLACE_EXISTING); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java new file mode 100644 index 000000000..069c7ca7c --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigConstants.java @@ -0,0 +1,14 @@ +package org.apache.seata.config; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class ConfigConstants { + public static final String IMAGE_DIR = "tmp/images"; + public static final String SCENE_DIR = "tmp/scene-test"; + public static final String SEATA_E2E_FILE = "seata-e2e.yaml"; + public static final String E2E_FILES = "e2e-files"; + public static final String COMPOSE_FILE = "docker-compose.yaml"; + public static final String SKY_WALKING_E2E_FILE = "e2e.yaml"; + public static final String IMAGE_VERSION = "0.0.1"; +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java new file mode 100644 index 000000000..dceddaa48 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/config/ConfigReader.java @@ -0,0 +1,24 @@ +package org.apache.seata.config; + +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.E2EWrapper; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.Constructor; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Paths; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class ConfigReader { + public static E2EConfig readConfig(File configFile) throws IOException { + Yaml yaml = new Yaml(new Constructor(E2EWrapper.class)); + E2EWrapper e2EWrapper = new E2EWrapper(); + InputStream inputStream = Files.newInputStream(configFile.toPath()); + // 从YAML文件读取数据并转换为Java对象 + e2EWrapper = yaml.load(inputStream); + return e2EWrapper.getE2e(); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java new file mode 100644 index 000000000..4a1def83f --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerComposeGenerator.java @@ -0,0 +1,56 @@ +package org.apache.seata.generator; + +import freemarker.template.Configuration; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.apache.seata.model.Modules; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.apache.seata.config.ConfigConstants.COMPOSE_FILE; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DockerComposeGenerator { + private static final Logger LOGGER = LoggerFactory.getLogger(DockerComposeGenerator.class); + private final Configuration cfg; + + public DockerComposeGenerator() { + cfg = new Configuration(Configuration.VERSION_2_3_28); + try { + cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/template"); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setLogTemplateExceptions(false); + cfg.setWrapUncheckedExceptions(true); + cfg.setNumberFormat("computer"); + } catch (Exception e) { + // never to do this + } + } + + public void generateDockerComposeFile(E2EConfig e2EConfig, File file) { + try { + Modules modules = e2EConfig.getModules(); + Map map = new HashMap<>(); + map.put("modules", modules); + cfg.getTemplate("dockercompose.ftl") + .process(map, new FileWriter(new File(file, COMPOSE_FILE))); + } catch (TemplateException | IOException e) { + LOGGER.error(String.format("generate docker-compose file for %s fail", e2EConfig.getScene_name() + + "-" + e2EConfig.getScene_name()), e); + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java new file mode 100644 index 000000000..5645ddcd6 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/DockerFileForJarGenerator.java @@ -0,0 +1,62 @@ +package org.apache.seata.generator; + +import freemarker.template.Configuration; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.apache.seata.model.Module; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DockerFileForJarGenerator { + private static final Logger LOGGER = LoggerFactory.getLogger(DockerFileForJarGenerator.class); + private final Configuration cfg; + + public DockerFileForJarGenerator() { + cfg = new Configuration(Configuration.VERSION_2_3_28); + try { + cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/template"); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setLogTemplateExceptions(false); + cfg.setWrapUncheckedExceptions(true); + cfg.setNumberFormat("computer"); + } catch (Exception e) { + // never to do this + } + } + + public void generateDockerFiles(E2EConfig e2EConfig) { + String tmpDir = ConfigConstants.IMAGE_DIR; + File composeDir = new File(tmpDir); + List modules = new ArrayList<>(); + modules.addAll(e2EConfig.getModules().getConsumers()); + modules.addAll(e2EConfig.getModules().getProviders()); + for (Module module : modules) { + String moduleComposeDir = new File(composeDir, e2EConfig.getScene_name() + "-" + + module.getName()).getAbsolutePath(); + try { + Map props = new HashMap<>(); + props.put("sourceJar", module.getName() + ".jar"); +// props.put("port", module.getPort()); + cfg.getTemplate("jar-dockerFile.ftl") + .process(props, new FileWriter(new File(moduleComposeDir, "Dockerfile"))); + } catch (TemplateException | IOException e) { + LOGGER.error(String.format("generate docker file %s fail", e2EConfig.getScene_name() + + "-" + module.getName()), e); + } + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java new file mode 100644 index 000000000..14724a086 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/generator/SkyWalkingE2EFileGenerator.java @@ -0,0 +1,52 @@ +package org.apache.seata.generator; + +import freemarker.template.Configuration; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.model.E2EConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import static org.apache.seata.config.ConfigConstants.COMPOSE_FILE; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class SkyWalkingE2EFileGenerator { + private static final Logger LOGGER = LoggerFactory.getLogger(SkyWalkingE2EFileGenerator.class); + private final Configuration cfg; + + public SkyWalkingE2EFileGenerator() { + cfg = new Configuration(Configuration.VERSION_2_3_28); + try { + cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "/template"); + cfg.setDefaultEncoding("UTF-8"); + cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + cfg.setLogTemplateExceptions(false); + cfg.setWrapUncheckedExceptions(true); + cfg.setNumberFormat("computer"); + } catch (Exception e) { + // never to do this + } + } + + public void generateSkyWalkingE2EFile(E2EConfig e2EConfig, File file) { + try { + Map map = new HashMap<>(); + map.put("retry", e2EConfig.getRetry()); + map.put("cases", e2EConfig.getCases()); + cfg.getTemplate("skywalking-e2e.ftl") + .process(map, new FileWriter(new File(file, ConfigConstants.SKY_WALKING_E2E_FILE))); + } catch (TemplateException | IOException e) { + LOGGER.error(String.format("generate SkyWalking e2e test file for %s fail", e2EConfig.getScene_name() + + "-" + e2EConfig.getScene_name()), e); + } + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java new file mode 100644 index 000000000..d9280da6b --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Case.java @@ -0,0 +1,34 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Case { + private String name; + private String invoke; + private String verify; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getInvoke() { + return invoke; + } + + public void setInvoke(String invoke) { + this.invoke = invoke; + } + + public String getVerify() { + return verify; + } + + public void setVerify(String verify) { + this.verify = verify; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java new file mode 100644 index 000000000..8b1ef8dc9 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DependOn.java @@ -0,0 +1,34 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DependOn { + private String restart; + private String condition; + private String required; + + public String getRestart() { + return restart; + } + + public void setRestart(String restart) { + this.restart = restart; + } + + public String getCondition() { + return condition; + } + + public void setCondition(String condition) { + this.condition = condition; + } + + public String getRequired() { + return required; + } + + public void setRequired(String required) { + this.required = required; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java new file mode 100644 index 000000000..44e3609ca --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/DockerService.java @@ -0,0 +1,118 @@ +package org.apache.seata.model; + +import java.util.List; +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class DockerService { + private String name; + private String image; + private String networks; + private String network_mode; + private String hostname; + private String restart; + private List ports; + private Map healthcheck; + private Map depends_on; + private Map environment; + private List volumes; + private String container_name; + + public String getContainer_name() { + return container_name; + } + + public void setContainer_name(String container_name) { + this.container_name = container_name; + } + + public String getNetwork_mode() { + return network_mode; + } + + public void setNetwork_mode(String network_mode) { + this.network_mode = network_mode; + } + + public String getNetworks() { + return networks; + } + + public void setNetworks(String networks) { + this.networks = networks; + } + + public String getRestart() { + return restart; + } + + public void setRestart(String restart) { + this.restart = restart; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public List getPorts() { + return ports; + } + + public void setPorts(List ports) { + this.ports = ports; + } + + public Map getHealthcheck() { + return healthcheck; + } + + public void setHealthcheck(Map healthcheck) { + this.healthcheck = healthcheck; + } + + public Map getDepends_on() { + return depends_on; + } + + public void setDepends_on(Map depends_on) { + this.depends_on = depends_on; + } + + public Map getEnvironment() { + return environment; + } + + public void setEnvironment(Map environment) { + this.environment = environment; + } + + public List getVolumes() { + return volumes; + } + + public void setVolumes(List volumes) { + this.volumes = volumes; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java new file mode 100644 index 000000000..d4e4a0b17 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EConfig.java @@ -0,0 +1,52 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class E2EConfig { + private Inherit inherit; + private String scene_name; + private Retry retry; + private Modules modules; + private Case[] cases; + + public Case[] getCases() { + return cases; + } + + public void setCases(Case[] cases) { + this.cases = cases; + } + + public Inherit getInherit() { + return inherit; + } + + public void setInherit(Inherit inherit) { + this.inherit = inherit; + } + + public String getScene_name() { + return scene_name; + } + + public void setScene_name(String scene_name) { + this.scene_name = scene_name; + } + + public Retry getRetry() { + return retry; + } + + public void setRetry(Retry retry) { + this.retry = retry; + } + + public Modules getModules() { + return modules; + } + + public void setModules(Modules modules) { + this.modules = modules; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java new file mode 100644 index 000000000..c3dd36018 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/E2EWrapper.java @@ -0,0 +1,17 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class E2EWrapper { + private E2EConfig e2e; + + // Getters and Setters + public E2EConfig getE2e() { + return e2e; + } + + public void setE2e(E2EConfig e2e) { + this.e2e = e2e; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java new file mode 100644 index 000000000..7188140af --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Inherit.java @@ -0,0 +1,27 @@ +package org.apache.seata.model; + +import java.util.Map; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Inherit { + private String name; + private Map props; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Map getProps() { + return props; + } + + public void setProps(Map props) { + this.props = props; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java new file mode 100644 index 000000000..af8ed5e14 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Module.java @@ -0,0 +1,61 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Module { + private String name; + private String dir; + private String invoke; + private String port; + private String expect; + private DockerService docker_service; + + public String getExpect() { + return expect; + } + + public void setExpect(String expect) { + this.expect = expect; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public DockerService getDocker_service() { + return docker_service; + } + + public void setDocker_service(DockerService docker_service) { + this.docker_service = docker_service; + } + + public String getDir() { + return dir; + } + + public void setDir(String dir) { + this.dir = dir; + } + + public String getInvoke() { + return invoke; + } + + public void setInvoke(String invoke) { + this.invoke = invoke; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java new file mode 100644 index 000000000..ee2ca370f --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Modules.java @@ -0,0 +1,36 @@ +package org.apache.seata.model; + +import java.util.List; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Modules { + private List consumers; + private List providers; + private List infrastructures; + + public List getInfrastructures() { + return infrastructures; + } + + public void setInfrastructures(List infrastructures) { + this.infrastructures = infrastructures; + } + + public List getConsumers() { + return consumers; + } + + public void setConsumers(List consumers) { + this.consumers = consumers; + } + + public List getProviders() { + return providers; + } + + public void setProviders(List providers) { + this.providers = providers; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java new file mode 100644 index 000000000..cb7383f8f --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/model/Retry.java @@ -0,0 +1,34 @@ +package org.apache.seata.model; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Retry { + private int max; + private String interval ; + private String total_timeout; + + public String getTotal_timeout() { + return total_timeout; + } + + public void setTotal_timeout(String total_timeout) { + this.total_timeout = total_timeout; + } + + public int getMax() { + return max; + } + + public void setMax(int max) { + this.max = max; + } + + public String getInterval() { + return interval; + } + + public void setInterval(String interval) { + this.interval = interval; + } +} diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java new file mode 100644 index 000000000..f2f13f6bc --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java @@ -0,0 +1,34 @@ +package org.apache.seata.util; + +import org.slf4j.Logger; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class Utils { + public static void printProcessLog(Logger LOGGER, Process process) { + ExecutorService executor = Executors.newFixedThreadPool(2); + + // 分别为标准输出和错误输出创建并启动线程 + executor.submit(() -> printStream(LOGGER, process.getInputStream(), false)); + executor.submit(() -> printStream(LOGGER, process.getErrorStream(), true)); + + executor.shutdown(); + } + + private static void printStream(Logger LOGGER, InputStream inputStream, boolean isError) { + new BufferedReader(new InputStreamReader(inputStream)).lines().forEach(line -> { + if (isError) { + LOGGER.warn(line); + } else { + LOGGER.info(line); + } + }); + } +} diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/at-common b/e2e-test/e2e-test-builder/src/main/resources/template/at-common new file mode 100644 index 000000000..e69de29bb diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl new file mode 100644 index 000000000..2fdc58012 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/resources/template/dockercompose.ftl @@ -0,0 +1,167 @@ +version: "3.9" +services: +<#list modules.consumers as service> + ${service.name}: + <#if service.docker_service.image?has_content> + image: ${service.docker_service.image} + + <#if service.docker_service.networks?has_content> + networks: ${service.docker_service.networks} + + <#if service.docker_service.network_mode?has_content> + network_mode: ${service.docker_service.network_mode} + + <#if service.docker_service.hostname?has_content> + hostname: ${service.docker_service.hostname} + + <#if service.docker_service.restart??> + restart: ${service.docker_service.restart} + + <#if service.docker_service.build?has_content> + build: ${service.docker_service.build} + + <#if service.docker_service.container_name?has_content> + container_name: ${service.docker_service.container_name} + + <#if service.docker_service.volumes??> + volumes: + <#list service.docker_service.volumes as volume> + - ${volume} + + + <#if service.docker_service.environment??> + environment: + <#list service.docker_service.environment as key,value> + ${key}: ${value} + + + <#if service.docker_service.ports??> + ports: + <#list service.docker_service.ports as port> + - ${port} + + + <#if service.docker_service.depends_on??> + depends_on: + <#list service.docker_service.depends_on?keys as key> + ${key}: + condition: ${service.docker_service.depends_on[key].condition} + + + <#if service.docker_service.healthcheck??> + healthcheck: + <#list service.docker_service.healthcheck as key,value> + ${key}: ${value} + + + +<#list modules.providers as service> + ${service.name}: + <#if service.docker_service.image?has_content> + image: ${service.docker_service.image} + + <#if service.docker_service.networks?has_content> + networks: ${service.docker_service.networks} + + <#if service.docker_service.network_mode?has_content> + network_mode: ${service.docker_service.network_mode} + + <#if service.docker_service.hostname?has_content> + hostname: ${service.docker_service.hostname} + + <#if service.docker_service.restart??> + restart: ${service.docker_service.restart} + + <#if service.docker_service.build?has_content> + build: ${service.docker_service.build} + + <#if service.docker_service.container_name?has_content> + container_name: ${service.docker_service.container_name} + + <#if service.docker_service.volumes??> + volumes: + <#list service.docker_service.volumes as volume> + - ${volume} + + + <#if service.docker_service.environment??> + environment: + <#list service.docker_service.environment as key,value> + ${key}: ${value} + + + <#if service.docker_service.ports??> + ports: + <#list service.docker_service.ports as port> + - ${port} + + + <#if service.docker_service.depends_on??> + depends_on: + <#list service.docker_service.depends_on?keys as key> + ${key}: + condition: ${service.docker_service.depends_on[key].condition} + + + <#if service.docker_service.healthcheck??> + healthcheck: + <#list service.docker_service.healthcheck as key,value> + ${key}: ${value} + + + +<#list modules.infrastructures as service> + ${service.name}: + <#if service.docker_service.image?has_content> + image: ${service.docker_service.image} + + <#if service.docker_service.networks?has_content> + networks: ${service.docker_service.networks} + + <#if service.docker_service.network_mode?has_content> + network_mode: ${service.docker_service.network_mode} + + <#if service.docker_service.hostname?has_content> + hostname: ${service.docker_service.hostname} + + <#if service.docker_service.restart??> + restart: ${service.docker_service.restart} + + <#if service.docker_service.build?has_content> + build: ${service.docker_service.build} + + <#if service.docker_service.container_name?has_content> + container_name: ${service.docker_service.container_name} + + <#if service.docker_service.volumes??> + volumes: + <#list service.docker_service.volumes as volume> + - ${volume} + + + <#if service.docker_service.environment??> + environment: + <#list service.docker_service.environment as key,value> + ${key}: ${value} + + + <#if service.docker_service.ports??> + ports: + <#list service.docker_service.ports as port> + - ${port} + + + <#if service.docker_service.depends_on??> + depends_on: + <#list service.docker_service.depends_on?keys as key> + ${key}: + condition: ${service.docker_service.depends_on[key].condition} + + + <#if service.docker_service.healthcheck??> + healthcheck: + <#list service.docker_service.healthcheck as key,value> + ${key}: ${value} + + + diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl new file mode 100644 index 000000000..75d032f6e --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/resources/template/jar-dockerFile.ftl @@ -0,0 +1,3 @@ +FROM java:8 +COPY ${sourceJar} /app.jar +ENTRYPOINT ["java","-jar","/app.jar"] \ No newline at end of file diff --git a/e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl b/e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl new file mode 100644 index 000000000..5a0ad2821 --- /dev/null +++ b/e2e-test/e2e-test-builder/src/main/resources/template/skywalking-e2e.ftl @@ -0,0 +1,31 @@ +setup: + env: compose + # Run a httpbin container, which can return YAML data + file: docker-compose.yaml + timeout: ${retry.total_timeout} + +cleanup: + # always never success failure + on: always + +verify: + # verify with retry strategy + retry: + # max retry count + count: ${retry.max} + # the interval between two attempts, e.g. 10s, 1m. + interval: ${retry.interval} + + # when a case fails, whether to stop verifying other cases. This property defaults to true. + fail-fast: false + # Whether to verify cases concurrently. This property defaults to false. + concurrency: false + + cases: + <#if cases??> + <#list cases as case> + - name: ${case.name} + query: ${case.invoke} + expected: ${case.verify} + + diff --git a/e2e-test/e2e-test-runner/.gitignore b/e2e-test/e2e-test-runner/.gitignore new file mode 100644 index 000000000..5ff6309b7 --- /dev/null +++ b/e2e-test/e2e-test-runner/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/e2e-test/e2e-test-runner/pom.xml b/e2e-test/e2e-test-runner/pom.xml new file mode 100644 index 000000000..b0fb7c194 --- /dev/null +++ b/e2e-test/e2e-test-runner/pom.xml @@ -0,0 +1,21 @@ + + 4.0.0 + + org.apache.seata + e2e-test + 2.0.0 + + org.apache.seata + e2e-test-runner + 2.0.0 + e2e-test-runner + + + + org.apache.seata + e2e-test-builder + 2.0.0 + + + diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java new file mode 100644 index 000000000..a57a72ff2 --- /dev/null +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java @@ -0,0 +1,20 @@ +package org.apache.seata; + +import org.apache.seata.config.ConfigConstants; +import org.apache.seata.controller.SkyWalkingController; + +import java.io.IOException; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class RunnerMain { + public static void main(String[] args) throws IOException, InterruptedException { + SkyWalkingController skyWalkingController = new SkyWalkingController(); + skyWalkingController.setE2eDir(ConfigConstants.SCENE_DIR); + if (args != null && args.length == 1) { + skyWalkingController.setE2eDir(args[1]); + } + skyWalkingController.runE2ETests(); + } +} diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java new file mode 100644 index 000000000..ec70cf0a5 --- /dev/null +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java @@ -0,0 +1,47 @@ +package org.apache.seata.controller; + +import org.apache.seata.generator.DockerComposeGenerator; +import org.apache.seata.util.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; + +/** + * @author jingliu_xiong@foxmail.com + */ +public class SkyWalkingController { + private static final Logger LOGGER = LoggerFactory.getLogger(SkyWalkingController.class); + private String e2eDir; + + public String getE2eDir() { + return e2eDir; + } + + public void setE2eDir(String e2eDir) { + this.e2eDir = e2eDir; + } + + public void runE2ETests() { + File e2eDir = new File(this.e2eDir); + for (File file : e2eDir.listFiles()) { + if (file.isDirectory()) { + LOGGER.info("Running Seate e2e test by SkyWalking-E2E: " + file.getName()); + try { + ProcessBuilder builder = new ProcessBuilder(); + builder.directory(file); + builder.command("e2e", "run"); + Process process = builder.start(); + int exitCode = process.waitFor(); + if (exitCode != 0) { + LOGGER.warn(String.format(" Seate e2e test %s by SkyWalking-E2E fail with exit code %d", + file.getName(), exitCode)); + } + Utils.printProcessLog(LOGGER, process); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml new file mode 100644 index 000000000..09ba9da29 --- /dev/null +++ b/e2e-test/pom.xml @@ -0,0 +1,63 @@ + + 4.0.0 + org.apache.seata + e2e-test + 2.0.0 + pom + e2e-test + + e2e-test-builder + e2e-test-runner + + + + + + com.github.docker-java + docker-java-core + 3.2.7 + + + com.github.docker-java + docker-java-transport-httpclient5 + 3.2.7 + + + org.yaml + snakeyaml + 1.32 + + + org.freemarker + freemarker + 2.3.28 + + + org.slf4j + slf4j-api + 1.7.32 + + + ch.qos.logback + logback-classic + 1.2.9 + + + org.slf4j + jcl-over-slf4j + 1.7.32 + + + org.slf4j + log4j-over-slf4j + 1.7.32 + + + commons-io + commons-io + 2.11.0 + + + + From 72c8307985766e6966a89262819b7d2895f70202 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 1 Apr 2024 22:42:42 +0800 Subject: [PATCH 2/4] fix: del compose file --- .../docker-compose.yaml | 70 ------------------- 1 file changed, 70 deletions(-) delete mode 100644 at-sample/springboot-dubbo-seata/docker-compose.yaml diff --git a/at-sample/springboot-dubbo-seata/docker-compose.yaml b/at-sample/springboot-dubbo-seata/docker-compose.yaml deleted file mode 100644 index 163afa922..000000000 --- a/at-sample/springboot-dubbo-seata/docker-compose.yaml +++ /dev/null @@ -1,70 +0,0 @@ -version: "3.9" -services: - account: - hostname: account - image: springboot-dubbo-seata-account:0.0.1 - restart: on-failure - depends_on: - - seata-server - - zookeeper - - mysql - business: - hostname: business - image: springboot-dubbo-seata-business:0.0.1 - restart: on-failure - depends_on: - - account - - order - - storage - order: - hostname: order - image: springboot-dubbo-seata-order:0.0.1 - restart: on-failure - depends_on: - - seata-server - - zookeeper - - mysql - storage: - hostname: storage - image: springboot-dubbo-seata-storage:0.0.1 - restart: on-failure - depends_on: - - seata-server - - zookeeper - - mysql - mysql: - hostname: businessmysql - image: mysql:5.7 - volumes: - - ./sqlsh:/docker-entrypoint-initdb.d - restart: always - environment: - MYSQL_ROOT_PASSWORD: 123456 - MYSQL_DATABASE: storage - MYSQL_USER: user - MYSQL_PASSWORD: user - # ports: - # - "3307:3306" - networks: - - host - healthcheck: - test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] - interval: 5s - timeout: 10s - retries: 10 - seata-server: - image: seataio/seata-server:${latest-release-version} - hostname: seata-server - ports: - - "7091:7091" - - "8091:8091" - environment: - - SEATA_PORT=8091 - - STORE_MODE=file - zookeeper: - hostname: zookeeper - image: zookeeper:3.7.1 - - -networks: - host: \ No newline at end of file From f0a37f3184de19786f02b1286f1e8ed1036fb96d Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 8 Apr 2024 23:05:42 +0800 Subject: [PATCH 3/4] feat: add e2e framework sh --- e2e-test/e2e-test-builder/pom.xml | 23 ++++++++++++ .../java/org/apache/seata/BuilderMain.java | 2 +- .../org/apache/seata/builder/E2EBuilder.java | 1 - .../apache/seata/builder/ImageBuilder.java | 7 +++- .../java/org/apache/seata/util/Utils.java | 3 +- e2e-test/e2e-test-runner/pom.xml | 36 +++++++++++++++++++ .../java/org/apache/seata/RunnerMain.java | 2 +- .../controller/SkyWalkingController.java | 3 +- e2e-test/pom.xml | 1 + e2e-test/scripts/prepare-test.sh | 15 ++++++++ e2e-test/scripts/prepare_skywalkingE2E.sh | 1 + e2e-test/scripts/test-run.sh | 17 +++++++++ 12 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 e2e-test/scripts/prepare-test.sh create mode 100644 e2e-test/scripts/prepare_skywalkingE2E.sh create mode 100644 e2e-test/scripts/test-run.sh diff --git a/e2e-test/e2e-test-builder/pom.xml b/e2e-test/e2e-test-builder/pom.xml index 01b3a38d8..7f822a381 100644 --- a/e2e-test/e2e-test-builder/pom.xml +++ b/e2e-test/e2e-test-builder/pom.xml @@ -52,6 +52,29 @@ 8 + + maven-assembly-plugin + 3.3.0 + + + jar-with-dependencies + + + + org.apache.seata.BuilderMain + + + + + + make-assembly + package + + single + + + + diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java index 2cb9e9148..9599d3489 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/BuilderMain.java @@ -12,7 +12,7 @@ public static void main(String[] args) throws IOException, InterruptedException E2EBuilder e2EBuilder = new E2EBuilder(); e2EBuilder.setRootPath("./"); if (args != null && args.length == 1) { - e2EBuilder.setRootPath(args[1]); + e2EBuilder.setRootPath(args[0]); } e2EBuilder.buildSeataE2ETest(); } diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java index 5009d5a36..7e02ee654 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/E2EBuilder.java @@ -14,7 +14,6 @@ */ public class E2EBuilder { private String rootPath; - private static final Logger LOGGER = LoggerFactory.getLogger(E2EBuilder.class); public String getRootPath() { return rootPath; diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java index 69700e6b6..7f14179f4 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/builder/ImageBuilder.java @@ -34,7 +34,12 @@ private int packageMavenParentModule(File moduleDir) throws IOException, Interru LOGGER.info("Packaging Maven module: " + moduleDir.getPath()); ProcessBuilder builder = new ProcessBuilder(); builder.directory(moduleDir); - builder.command("mvn.cmd", "clean", "package"); +// builder.command("mvn.cmd", "clean", "package"); + if (System.getProperty("os.name").contains("Windows")) { + builder.command("mvn.cmd", "clean", "package"); + } else { + builder.command("mvn", "clean", "package"); + } Process process = builder.start(); Utils.printProcessLog(LOGGER, process); int exitCode = process.waitFor(); diff --git a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java index f2f13f6bc..770a35126 100644 --- a/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java +++ b/e2e-test/e2e-test-builder/src/main/java/org/apache/seata/util/Utils.java @@ -14,8 +14,7 @@ public class Utils { public static void printProcessLog(Logger LOGGER, Process process) { ExecutorService executor = Executors.newFixedThreadPool(2); - - // 分别为标准输出和错误输出创建并启动线程 + executor.submit(() -> printStream(LOGGER, process.getInputStream(), false)); executor.submit(() -> printStream(LOGGER, process.getErrorStream(), true)); diff --git a/e2e-test/e2e-test-runner/pom.xml b/e2e-test/e2e-test-runner/pom.xml index b0fb7c194..7c8ba2fe1 100644 --- a/e2e-test/e2e-test-runner/pom.xml +++ b/e2e-test/e2e-test-runner/pom.xml @@ -18,4 +18,40 @@ 2.0.0 + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + maven-assembly-plugin + 3.3.0 + + + jar-with-dependencies + + + + org.apache.seata.RunnerMain + + + + + + make-assembly + package + + single + + + + + + diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java index a57a72ff2..6a9aea075 100644 --- a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/RunnerMain.java @@ -13,7 +13,7 @@ public static void main(String[] args) throws IOException, InterruptedException SkyWalkingController skyWalkingController = new SkyWalkingController(); skyWalkingController.setE2eDir(ConfigConstants.SCENE_DIR); if (args != null && args.length == 1) { - skyWalkingController.setE2eDir(args[1]); + skyWalkingController.setE2eDir(args[0]); } skyWalkingController.runE2ETests(); } diff --git a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java index ec70cf0a5..57ff428d9 100644 --- a/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java +++ b/e2e-test/e2e-test-runner/src/main/java/org/apache/seata/controller/SkyWalkingController.java @@ -1,6 +1,5 @@ package org.apache.seata.controller; -import org.apache.seata.generator.DockerComposeGenerator; import org.apache.seata.util.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,12 +31,12 @@ public void runE2ETests() { builder.directory(file); builder.command("e2e", "run"); Process process = builder.start(); + Utils.printProcessLog(LOGGER, process); int exitCode = process.waitFor(); if (exitCode != 0) { LOGGER.warn(String.format(" Seate e2e test %s by SkyWalking-E2E fail with exit code %d", file.getName(), exitCode)); } - Utils.printProcessLog(LOGGER, process); } catch (Exception e) { e.printStackTrace(); } diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index 09ba9da29..b963a0633 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -60,4 +60,5 @@ + diff --git a/e2e-test/scripts/prepare-test.sh b/e2e-test/scripts/prepare-test.sh new file mode 100644 index 000000000..5b5f14775 --- /dev/null +++ b/e2e-test/scripts/prepare-test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_DIR="$(dirname "$DIR")" +PROJECT_DIR="$(dirname "$(dirname "$DIR")")" +cd $TEST_DIR/e2e-test-builder +mvn clean install -DskipTests +result=$? +if [ $result -ne 0 ]; then + echo "Build seata e2e-test-builder failure" + exit $result +fi +cd $PROJECT_DIR +cp $TEST_DIR/e2e-test-builder/target/e2e-test-builder-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-builder.jar +java -jar ./e2e-test-builder.jar ./ \ No newline at end of file diff --git a/e2e-test/scripts/prepare_skywalkingE2E.sh b/e2e-test/scripts/prepare_skywalkingE2E.sh new file mode 100644 index 000000000..43a8d282a --- /dev/null +++ b/e2e-test/scripts/prepare_skywalkingE2E.sh @@ -0,0 +1 @@ +go install github.com/apache/skywalking-infra-e2e/cmd/e2e@latest \ No newline at end of file diff --git a/e2e-test/scripts/test-run.sh b/e2e-test/scripts/test-run.sh new file mode 100644 index 000000000..9f1110a6d --- /dev/null +++ b/e2e-test/scripts/test-run.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_DIR="$(dirname "$DIR")" +PROJECT_DIR="$(dirname "$(dirname "$DIR")")" +cd $TEST_DIR +mvn clean package -DskipTests +cd $TEST_DIR/e2e-test-runner +mvn clean package -DskipTests +result=$? +if [ $result -ne 0 ]; then + echo "Build seata e2e-test-runner failure" + exit $result +fi +cd $PROJECT_DIR +cp $TEST_DIR/e2e-test-runner/target/e2e-test-runner-*-jar-with-dependencies.jar $PROJECT_DIR/e2e-test-runner.jar +java -jar ./e2e-test-runner.jar ./tmp/scene-test \ No newline at end of file From 6223ce671972eb46d836a627cd045b25111d79e8 Mon Sep 17 00:00:00 2001 From: Jingliu Xiong <928124786@qq.com> Date: Mon, 15 Apr 2024 22:49:03 +0800 Subject: [PATCH 4/4] feat: add e2e demo in network --- .github/workflows/E2E.yml | 46 ++++++- .../springboot-dubbo-seata/seata-e2e.yaml | 43 ++++-- .../src/main/resources/application.properties | 9 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- .../src/main/resources/application.properties | 7 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- .../src/main/resources/application.properties | 9 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- .../src/main/resources/application.properties | 9 +- .../src/main/resources/file.conf | 126 ------------------ .../src/main/resources/registry.conf | 124 ----------------- 14 files changed, 100 insertions(+), 1023 deletions(-) delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf delete mode 100644 at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf diff --git a/.github/workflows/E2E.yml b/.github/workflows/E2E.yml index 261df6c95..4c1d346c1 100644 --- a/.github/workflows/E2E.yml +++ b/.github/workflows/E2E.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: "E2E Test" on: push: @@ -18,4 +18,46 @@ on: # The branches below must be a subset of the branches above branches: [ e2e-demo ] # -#jobs: \ No newline at end of file +jobs: + prepareE2EFramework: + name: E2E Test Prepare + runs-on: ubuntu-latest + steps: + - name: Clone skywalking e2e repository + run: git clone https://github.com/apache/skywalking-infra-e2e.git skywalking-infra-e2e + + - name: Navigate to cloned repository + run: cd skywalking-infra-e2e + + - name: Set up Go 1.18 + uses: actions/setup-go@v4 + with: + go-version: 1.18 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Build e2e framework + run: make linux + + - name: Set current path as environment variable + run: | + echo "export CURRENT_PATH=$(pwd)" >> $GITHUB_ENV + + prepareE2ETest: + name: Prepare E2E Test + runs-on: ubuntu-latest + steps: + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 8 + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Run e2e tests + run: | + cd e2e-test/scripts && bash prepare-test.sh \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/seata-e2e.yaml b/at-sample/springboot-dubbo-seata/seata-e2e.yaml index 800d82183..7facb8b37 100644 --- a/at-sample/springboot-dubbo-seata/seata-e2e.yaml +++ b/at-sample/springboot-dubbo-seata/seata-e2e.yaml @@ -1,8 +1,5 @@ e2e: scene_name: at-springboot-dubbo-seata - # 后期考虑扩展成通用基础设施一键配置 - inherit: - name: at-common # retry config retry: max: 5 @@ -17,7 +14,7 @@ e2e: # 这里可以加一些插件实现不同功能 # docker service 下的参数,这样写是为了方便后续扩展解耦 docker_service: - network_mode: host + hostname: springboot-dubbo-seata-business restart: on-failure container_name: test depends_on: @@ -27,40 +24,56 @@ e2e: condition: service_started springboot-dubbo-seata-order: condition: service_started + environment: + zookeeper.address: zookeeper + seata.address: seata providers: - name: springboot-dubbo-seata-account docker_service: - network_mode: host + hostname: springboot-dubbo-seata-account restart: on-failure depends_on: zookeeper: condition: service_healthy mysql: condition: service_healthy + environment: + zookeeper.address: zookeeper + mysql.address: mysqlAddress + seata.address: seata - name: springboot-dubbo-seata-order docker_service: - network_mode: host + hostname: springboot-dubbo-seata-order restart: on-failure depends_on: zookeeper: condition: service_healthy mysql: condition: service_healthy + environment: + zookeeper.address: zookeeper + mysql.address: mysqlAddress + seata.address: seata - name: springboot-dubbo-seata-storage docker_service: - network_mode: host + hostname: springboot-dubbo-seata-order restart: on-failure depends_on: zookeeper: condition: service_healthy mysql: condition: service_healthy + environment: + zookeeper.address: zookeeper + mysql.address: mysqlAddress + seata.address: seata infrastructures: - name: mysql docker_service: + hostname: mysqlAddress image: mysql:5.7 - ports: - - "3307:3306" +# ports: +# - "3307:3306" volumes: - ./e2e-files/sqlsh:/docker-entrypoint-initdb.d restart: always @@ -76,18 +89,20 @@ e2e: retries: 10 - name: seata-server docker_service: + hostname: seata image: seataio/seata-server:2.0.0 - ports: - - "7091:7091" - - "8091:8091" +# ports: +# - "7091:7091" +# - "8091:8091" environment: SEATA_PORT: 8091 STORE_MODE: file - name: zookeeper docker_service: + hostname: zookeeper image: zookeeper:3.5.7 - ports: - - "2181:2181" +# ports: +# - "2181:2181" healthcheck: test: '[ "CMD", "echo", "ruok", "|", "nc", "localhost", "2181", "|", "grep", "imok" ]' interval: 30s diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties index 5a53776dc..8593a4839 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/application.properties @@ -1,12 +1,17 @@ spring.application.name=springboot-dubbo-seata-account spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3307/seata??useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata??useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-account seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://127.0.0.1:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=28801 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-account/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties index f220ff15b..32fc1f64e 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/application.properties @@ -1,9 +1,14 @@ spring.application.name=springboot-dubbo-seata-business seata.application-id=springboot-dubbo-seata-business seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.application.qos-enable=false dubbo.scan.base-packages=org.apache.seata -dubbo.registry.address=zookeeper://127.0.0.1:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20883 server.port=9991 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-business/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties index defe4d30a..cf7aa9ad4 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/application.properties @@ -1,12 +1,17 @@ spring.application.name=springboot-dubbo-seata-order spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3307/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-order seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://127.0.0.1:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20883 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-order/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties index b726b7fa7..48ce97f5f 100644 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties +++ b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/application.properties @@ -1,12 +1,17 @@ spring.application.name=springboot-dubbo-seata-storage spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3307/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=user spring.datasource.password=123456 seata.application-id=springboot-dubbo-seata-storage seata.tx-service-group=my_test_tx_group +seata.enabled=true +seata.service.vgroup-mapping.my_test_tx_group=default +seata.service.grouplist.default=${seata.address:127.0.0.1}:8091 +seata.registry.type=file +seata.config.type=file dubbo.scan.base-packages=org.apache.seata dubbo.application.qos-enable=false -dubbo.registry.address=zookeeper://127.0.0.1:2181 +dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:2181 dubbo.protocol.name=dubbo dubbo.protocol.port=20882 \ No newline at end of file diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf deleted file mode 100644 index e426f6661..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/file.conf +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -transport { - # tcp, unix-domain-socket - type = "TCP" - #NIO, NATIVE - server = "NIO" - #enable heartbeat - heartbeat = true - # the tm client batch send request enable - enableTmClientBatchSendRequest = false - # the rm client batch send request enable - enableRmClientBatchSendRequest = true - # the rm client rpc request timeout - rpcRmRequestTimeout = 2000 - # the tm client rpc request timeout - rpcTmRequestTimeout = 30000 - # the rm client rpc request timeout - rpcRmRequestTimeout = 15000 - #thread factory for netty - threadFactory { - bossThreadPrefix = "NettyBoss" - workerThreadPrefix = "NettyServerNIOWorker" - serverExecutorThread-prefix = "NettyServerBizHandler" - shareBossWorker = false - clientSelectorThreadPrefix = "NettyClientSelector" - clientSelectorThreadSize = 1 - clientWorkerThreadPrefix = "NettyClientWorkerThread" - # netty boss thread size - bossThreadSize = 1 - #auto default pin or 8 - workerThreadSize = "default" - } - shutdown { - # when destroy server, wait seconds - wait = 3 - } - serialization = "seata" - compressor = "none" -} -service { - #transaction service group mapping - vgroupMapping.my_test_tx_group = "default" - #only support when registry.type=file, please don't set multiple addresses - default.grouplist = "127.0.0.1:8091" - #degrade, current not support - enableDegrade = false - #disable seata - disableGlobalTransaction = false -} - -client { - rm { - asyncCommitBufferLimit = 10000 - lock { - retryInterval = 10 - retryTimes = 30 - retryPolicyBranchRollbackOnConflict = true - } - reportRetryCount = 5 - tableMetaCheckEnable = false - tableMetaCheckerInterval = 60000 - reportSuccessEnable = false - sagaBranchRegisterEnable = false - sagaJsonParser = "fastjson" - sagaRetryPersistModeUpdate = false - sagaCompensatePersistModeUpdate = false - tccActionInterceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - sqlParserType = "druid" - branchExecutionTimeoutXA = 60000 - connectionTwoPhaseHoldTimeoutXA = 10000 - } - tm { - commitRetryCount = 5 - rollbackRetryCount = 5 - defaultGlobalTransactionTimeout = 60000 - degradeCheck = false - degradeCheckPeriod = 2000 - degradeCheckAllowTimes = 10 - interceptorOrder = -2147482648 #Ordered.HIGHEST_PRECEDENCE + 1000 - } - undo { - dataValidation = true - onlyCareUpdateColumns = true - logSerialization = "jackson" - logTable = "undo_log" - compress { - enable = true - # allow zip, gzip, deflater, lz4, bzip2, zstd default is zip - type = zip - # if rollback info size > threshold, then will be compress - # allow k m g t - threshold = 64k - } - } - loadBalance { - type = "XID" - virtualNodes = 10 - } -} -log { - exceptionRate = 100 -} -tcc { - fence { - # tcc fence log table name - logTableName = tcc_fence_log - # tcc fence log clean period - cleanPeriod = 1h - } -} diff --git a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf b/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf deleted file mode 100644 index a105dc3e8..000000000 --- a/at-sample/springboot-dubbo-seata/springboot-dubbo-seata-storage/src/main/resources/registry.conf +++ /dev/null @@ -1,124 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -registry { - # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa、custom - type = "file" - - nacos { - application = "seata-server" - serverAddr = "127.0.0.1:8848" - group = "SEATA_GROUP" - namespace = "" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - ##if use Nacos naming meta-data for SLB service registry, specify nacos address pattern rules here - #slbPattern = "" - } - eureka { - serviceUrl = "http://localhost:8761/eureka" - weight = "1" - } - redis { - serverAddr = "localhost:6379" - db = "0" - password = "" - timeout = "0" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - } - consul { - serverAddr = "127.0.0.1:8500" - aclToken = "" - } - etcd3 { - serverAddr = "http://localhost:2379" - } - sofa { - serverAddr = "127.0.0.1:9603" - region = "DEFAULT_ZONE" - datacenter = "DefaultDataCenter" - group = "SEATA_GROUP" - addressWaitTime = "3000" - } - file { - name = "file.conf" - } - custom { - name = "" - } -} - -config { - # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig、custom - type = "file" - raft { - metadata-max-age-ms = 30000 - serverAddr = "127.0.0.1:8848" - } - nacos { - serverAddr = "127.0.0.1:8848" - namespace = "" - group = "SEATA_GROUP" - username = "" - password = "" - contextPath = "" - ##if use MSE Nacos with auth, mutex with username/password attribute - #accessKey = "" - #secretKey = "" - dataId = "seata.properties" - } - consul { - serverAddr = "127.0.0.1:8500" - key = "seata.properties" - aclToken = "" - } - apollo { - appId = "seata-server" - apolloMeta = "http://192.168.1.204:8801" - namespace = "application" - apolloAccesskeySecret = "" - cluster = "" - } - zk { - serverAddr = "127.0.0.1:2181" - sessionTimeout = 6000 - connectTimeout = 2000 - username = "" - password = "" - nodePath = "/seata/seata.properties" - } - etcd3 { - serverAddr = "http://localhost:2379" - key = "seata.properties" - } - file { - name = "file.conf" - } - custom { - name = "" - } -}