diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbe72c2c069..cd974187de5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,20 +28,27 @@ jobs: # step 3 - name: "Print maven version" run: ./mvnw -version - # step 4 - - name: "Build with Maven" + # step 4.1 + - name: "Test, Check style, Check license with Maven and Java8" + if: matrix.java == '8' + run: | + ./mvnw -T 4C clean test \ + -Dcheckstyle.skip=false -Dlicense.skip=false \ + -Dmaven.git-commit-id.skip=true \ + -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; + # step 4.2 + - name: "Test with Maven and Java${{ matrix.java }}" + if: matrix.java != '8' run: | - if [ "${{ matrix.java }}" == "8" ]; then - ./mvnw -T 4C clean test -Dcheckstyle.skip=false -Dlicense.skip=false -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; - elif [ "${{ matrix.java }}" == "17" ]; then - ./mvnw -T 4C clean test -Dcheckstyle.skip=true -Dlicense.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; - fi + ./mvnw -T 4C clean test \ + -Dmaven.git-commit-id.skip=true \ + -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; # step 5 - name: "Codecov" if: matrix.java == '8' uses: codecov/codecov-action@v3.1.4 - # job 2: Test on 'arm64v8/ubuntu' OS. + # job 2: Build on 'arm64v8/ubuntu' OS (Skip tests). build_arm64-binary: runs-on: ubuntu-latest if: ${{ github.event_name == 'push' && (github.ref_name == 'develop' || github.ref_name == 'snapshot' || github.ref_name == '2.x') }} @@ -56,11 +63,15 @@ jobs: id: qemu uses: docker/setup-qemu-action@v3 # step 3 - - name: "Build arm-binary" + - name: "Build with Maven on 'arm64v8/ubuntu:20.04' OS (Skip tests)" run: | docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ arm64v8/ubuntu:20.04 \ bash -exc 'apt-get update -y && \ apt-get install maven -y && \ mvn -version && \ - mvn -Prelease-seata -DskipTests clean install -U' + mvn clean install \ + -Prelease-seata \ + -DskipTests \ + -Dmaven.git-commit-id.skip=true \ + -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' diff --git a/.github/workflows/test-druid.yml b/.github/workflows/test-druid.yml index edd145a062b..f004c41db81 100644 --- a/.github/workflows/test-druid.yml +++ b/.github/workflows/test-druid.yml @@ -11,8 +11,8 @@ jobs: strategy: fail-fast: false matrix: - java: [ 8, 11, 17, 21 ] druid: [ + 1.2.20, 1.2.19, #1.2.18, # Unit test triggered a bug in Druid, see the commit https://github.com/alibaba/druid/commit/6c493f852852fb287ed5fd31ee16c27ead0ea5cf #1.2.17, # Unit test triggered a bug in Druid, see the commit https://github.com/alibaba/druid/commit/6c493f852852fb287ed5fd31ee16c27ead0ea5cf @@ -50,15 +50,14 @@ jobs: uses: actions/setup-java@v3.12.0 with: distribution: 'zulu' - java-version: ${{ matrix.java }} + java-version: 8 # step 3 - name: "Print maven version" run: ./mvnw -version # step 4 - - name: "Test with Maven" + - name: "Test with Maven and Druid ${{ matrix.druid }}" run: | - if [ "${{ matrix.java }}" == "8" ]; then - ./mvnw -T 4C clean test -Ddruid.version=${{ matrix.druid }} -Dcheckstyle.skip=false -Dlicense.skip=false -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; - else - ./mvnw -T 4C clean test -Ddruid.version=${{ matrix.druid }} -Dcheckstyle.skip=true -Dlicense.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; - fi + ./mvnw -T 4C clean test \ + -Ddruid.version=${{ matrix.druid }} \ + -Dmaven.git-commit-id.skip=true \ + -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; diff --git a/.github/workflows/test-os.yml b/.github/workflows/test-os.yml deleted file mode 100644 index cc63cb0e6fa..00000000000 --- a/.github/workflows/test-os.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: "test-os" - -on: - push: - branches: [ test*, "*.*.*" ] - -jobs: - test-arm64: - name: "test-arm64" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - springboot: [ - 2.7.17 -Dspring-framework.version=5.3.30, - 2.6.15 -Dspring-framework.version=5.3.27, - 2.5.15 -Dspring-framework.version=5.3.27, - 2.4.13 -Dspring-framework.version=5.3.13, - 2.3.12.RELEASE -Dspring-framework.version=5.2.15.RELEASE, - 2.2.13.RELEASE -Dspring-framework.version=5.2.12.RELEASE, - #2.1.18.RELEASE, - #2.0.9.RELEASE, - #1.5.22.RELEASE, - #1.4.7.RELEASE, - #1.3.8.RELEASE, - #1.2.8.RELEASE, - #1.1.12.RELEASE, - #1.0.2.RELEASE - ] - steps: - # step 1 - - name: "Checkout" - uses: actions/checkout@v3 - # step 2 - - name: "Set up QEMU" - id: qemu - uses: docker/setup-qemu-action@v3 - # step 3 - - name: "Install 'arm64v8/ubuntu' OS" - run: | - docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ - arm64v8/ubuntu:20.04 \ - bash -exc 'apt-get update -y && \ - apt-get install maven -y' - # step 4 - - name: "Print maven version" - run: ./mvnw -version - # step 5 - - name: "test-arm64" - run: | - ./mvnw -T 4C clean test -Dspring-boot.version=${{ matrix.springboot }} -Dcheckstyle.skip=true -Dlicense.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 071c9214776..feda1f93072 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,26 +8,25 @@ jobs: # job 1 test: name: "test" - runs-on: ubuntu-latest + runs-on: "${{ matrix.os }}-latest" strategy: fail-fast: false matrix: java: [ 8, 11, 17, 21 ] + os: [ + ubuntu, + macos, + windows, # Skip tests, because too many errors in unit-test. + ] springboot: [ - 2.7.17 -Dspring-framework.version=5.3.30, - 2.6.15 -Dspring-framework.version=5.3.27, - 2.5.15 -Dspring-framework.version=5.3.27, - 2.4.13 -Dspring-framework.version=5.3.13, - 2.3.12.RELEASE -Dspring-framework.version=5.2.15.RELEASE, - 2.2.13.RELEASE -Dspring-framework.version=5.2.12.RELEASE, + 2.7.18 -D spring-framework.version=5.3.31, + 2.6.15 -D spring-framework.version=5.3.27, + 2.5.15 -D spring-framework.version=5.3.27, + 2.4.13 -D spring-framework.version=5.3.13, + 2.3.12.RELEASE -D spring-framework.version=5.2.15.RELEASE, + 2.2.13.RELEASE -D spring-framework.version=5.2.12.RELEASE, #2.1.18.RELEASE, #2.0.9.RELEASE, - #1.5.22.RELEASE, - #1.4.7.RELEASE, - #1.3.8.RELEASE, - #1.2.8.RELEASE, - #1.1.12.RELEASE, - #1.0.2.RELEASE ] steps: # step 1 @@ -40,29 +39,40 @@ jobs: distribution: 'zulu' java-version: ${{ matrix.java }} # step 3 - - name: "Print maven version" - run: ./mvnw -version - # step 4 - - name: "Test with Maven" - # https://docs.github.com/cn/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context + ## step 3.1: for Ubuntu and MacOS + - name: "Test with Maven on '${{ matrix.os }}' OS" + if: matrix.os != 'windows' run: | - if [ "${{ matrix.java }}" == "8" ]; then - ./mvnw -T 4C clean test -Dspring-boot.version=${{ matrix.springboot }} -Dcheckstyle.skip=false -Dlicense.skip=false -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; - else - ./mvnw -T 4C clean test -Dspring-boot.version=${{ matrix.springboot }} -Dcheckstyle.skip=true -Dlicense.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; - fi + ./mvnw -version; + ./mvnw -T 4C clean test \ + -P args-for-client-test \ + -Dspring-boot.version=${{ matrix.springboot }} \ + -Dmaven.git-commit-id.skip=true \ + -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; + ## step 3.2: for Windows + - name: "Build with Maven on 'windows' OS (Skip tests)" + if: matrix.os == 'windows' + run: | # Skip tests, because too many errors in unit-test. + ./mvnw.cmd -version; + ./mvnw.cmd clean install -P args-for-client-test -DskipTests -D spring-boot.version=${{ matrix.springboot }} -D maven.git-commit-id.skip=true -e -B -D org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; # job 2 test-springboot3x: name: "test-springboot3.x" - runs-on: ubuntu-latest + runs-on: "${{ matrix.os }}-latest" strategy: fail-fast: false matrix: java: [ 17, 21 ] + os: [ + ubuntu, + macos, + windows, # Skip tests, because too many errors in unit-test. + ] springboot: [ - 3.1.4 -Dspring-framework.version=6.0.12, - 3.0.11 -Dspring-framework.version=6.0.12, + 3.2.0 -D spring-framework.version=6.1.1, + 3.1.6 -D spring-framework.version=6.0.14, + 3.0.13 -D spring-framework.version=6.0.14, ] steps: # step 1 @@ -75,9 +85,59 @@ jobs: distribution: 'zulu' java-version: ${{ matrix.java }} # step 3 - - name: "Print maven version" - run: ./mvnw -version - # step 4 - - name: "Test with Maven" + ## step 3.1: for Ubuntu and MacOS + - name: "Test with Maven on '${{ matrix.os }}' OS" + if: matrix.os != 'windows' + run: | + ./mvnw -version; + ./mvnw -T 4C clean install \ + -P args-for-client-test \ + -Dspring-boot.version=${{ matrix.springboot }} \ + -Dmaven.git-commit-id.skip=true \ + -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; + ## step 3.2: for Windows + - name: "Build with Maven on 'windows' OS (Skip tests)" + if: matrix.os == 'windows' + run: | # Skip tests, because too many errors in unit-test. + ./mvnw.cmd -version; + ./mvnw.cmd clean install -P args-for-client-test -DskipTests -D spring-boot.version=${{ matrix.springboot }} -D maven.git-commit-id.skip=true -e -B -D org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; + + # job 3 + test-arm64: + name: "test-arm64" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + springboot: [ + #2.7.18 -Dspring-framework.version=5.3.31, # The maven-compiler-plugin will throw an error for an unknown reason. + #2.6.15 -Dspring-framework.version=5.3.27, # The maven-compiler-plugin will throw an error for an unknown reason. + #2.5.15 -Dspring-framework.version=5.3.27, # The maven-compiler-plugin will throw an error for an unknown reason. + 2.4.13 -Dspring-framework.version=5.3.13, + 2.3.12.RELEASE -Dspring-framework.version=5.2.15.RELEASE, + 2.2.13.RELEASE -Dspring-framework.version=5.2.12.RELEASE, + #2.1.18.RELEASE, + #2.0.9.RELEASE, + ] + steps: + # step 1 + - name: "Checkout" + uses: actions/checkout@v3 + # step 2 + - name: "Set up QEMU" + id: qemu + uses: docker/setup-qemu-action@v3 + # step 3 + - name: "Build with Maven on 'arm64v8/ubuntu:20.04' OS (Skip tests)" run: | - ./mvnw -T 4C clean test -Dspring-boot.version=${{ matrix.springboot }} -Dspring-boot-for-server.version=2.5.14 -Dspring-framework-for-server.version=5.3.20 -Dkotlin-maven-plugin.version=1.7.22 -Dcheckstyle.skip=true -Dlicense.skip=true -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn; + docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ + arm64v8/ubuntu:20.04 \ + bash -exc 'apt-get update -y && \ + apt-get install maven -y && \ + mvn -version && \ + mvn -T 4C clean install \ + -Dspring-boot.version=${{ matrix.springboot }} \ + -Prelease-seata \ + -DskipTests \ + -Dmaven.git-commit-id.skip=true \ + -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' diff --git a/all/pom.xml b/all/pom.xml index 3d5d2696241..85aa3975a3d 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -581,11 +581,6 @@ postgresql provided - - com.dameng - DmJdbcDriver18 - provided - com.fasterxml.jackson.core jackson-databind @@ -596,6 +591,11 @@ kryo provided + + com.dameng + DmJdbcDriver18 + provided + de.ruedigermoeller fst diff --git a/build/pom.xml b/build/pom.xml index 629a1c65fae..a67df706d0d 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -87,7 +87,7 @@ 3.8.1 0.6.1 - 1.3.72 + 1.9.21 3.8 1.3.6 @@ -120,6 +120,7 @@ true false + 37F181C60AACE24BD5C1D3925583F79497E8E293 @@ -379,9 +380,9 @@ - + - args-for-test-by-jdk17-and-above-versions + args-for-test-by-jdk17-and-above [17,) @@ -398,10 +399,17 @@ --add-opens java.sql/java.sql=ALL-UNNAMED --add-opens java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED - --illegal-access=permit - -Dillegal-access=permit + -Dnet.bytebuddy.experimental=true + + + + args-for-client-test + + io/seata/server/**/*.java,io/seata/console/**/*.java + + diff --git a/changes/en-us/develop.md b/changes/en-us/develop.md index 4b464d99b98..4e2716d213b 100644 --- a/changes/en-us/develop.md +++ b/changes/en-us/develop.md @@ -19,7 +19,7 @@ Add changes here for all PR submitted to the develop branch. - [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] A brief and accurate description of PR ### test: -- [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] A brief and accurate description of PR +- [[#6151](https://github.com/seata/seata/pull/6151)] add test for `MacOS` and `Windows` Thanks to these contributors for their code commits. Please report an unintended omission. diff --git a/changes/zh-cn/develop.md b/changes/zh-cn/develop.md index 90b7dab8518..45c7f71bd0e 100644 --- a/changes/zh-cn/develop.md +++ b/changes/zh-cn/develop.md @@ -19,7 +19,7 @@ - [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] 准确简要的PR描述 ### test: -- [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] 准确简要的PR描述 +- [[#6151](https://github.com/seata/seata/pull/6151)] 添加对 `MacOS` 和 `Windows` 的测试 非常感谢以下 contributors 的代码贡献。若有无意遗漏,请报告。 diff --git a/console/pom.xml b/console/pom.xml index 62147c66d34..32de0bc493a 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -29,8 +29,9 @@ console for Seata built with Maven - ${spring-boot.version} - ${spring-framework.version} + 2.7.18 + 5.3.31 + 2.0 @@ -63,10 +64,19 @@ org.springframework spring-framework-bom + + org.yaml + snakeyaml + pom import + + org.yaml + snakeyaml + ${snakeyaml-for-server.version} + diff --git a/core/src/main/java/io/seata/core/rpc/netty/AbstractNettyRemotingClient.java b/core/src/main/java/io/seata/core/rpc/netty/AbstractNettyRemotingClient.java index 8766cde4873..1ea89f85b44 100644 --- a/core/src/main/java/io/seata/core/rpc/netty/AbstractNettyRemotingClient.java +++ b/core/src/main/java/io/seata/core/rpc/netty/AbstractNettyRemotingClient.java @@ -109,12 +109,7 @@ public abstract class AbstractNettyRemotingClient extends AbstractNettyRemoting @Override public void init() { - timerExecutor.scheduleAtFixedRate(new Runnable() { - @Override - public void run() { - clientChannelManager.reconnect(getTransactionServiceGroup()); - } - }, SCHEDULE_DELAY_MILLS, SCHEDULE_INTERVAL_MILLS, TimeUnit.MILLISECONDS); + timerExecutor.scheduleAtFixedRate(() -> clientChannelManager.reconnect(getTransactionServiceGroup()), SCHEDULE_DELAY_MILLS, SCHEDULE_INTERVAL_MILLS, TimeUnit.MILLISECONDS); if (this.isEnableClientBatchSendRequest()) { mergeSendExecutorService = new ThreadPoolExecutor(MAX_MERGE_SEND_THREAD, MAX_MERGE_SEND_THREAD, @@ -257,10 +252,11 @@ protected String loadBalance(String transactionServiceGroup, Object msg) { InetSocketAddress address = null; try { @SuppressWarnings("unchecked") - List inetSocketAddressList = RegistryFactory.getInstance().aliveLookup(transactionServiceGroup); + List inetSocketAddressList = + RegistryFactory.getInstance().aliveLookup(transactionServiceGroup); address = this.doSelect(inetSocketAddressList, msg); } catch (Exception ex) { - LOGGER.error(ex.getMessage()); + LOGGER.error("Select the address failed: {}", ex.getMessage()); } if (address == null) { throw new FrameworkException(NoAvailableService); diff --git a/core/src/main/java/io/seata/core/serializer/SerializerSecurityRegistry.java b/core/src/main/java/io/seata/core/serializer/SerializerSecurityRegistry.java index 1d4b65e4fd1..0f922d97885 100644 --- a/core/src/main/java/io/seata/core/serializer/SerializerSecurityRegistry.java +++ b/core/src/main/java/io/seata/core/serializer/SerializerSecurityRegistry.java @@ -103,17 +103,54 @@ private static String[] getDenyClassPatternList() { } private static Set> getProtocolType() { - Enumeration packageDir = null; - String packageName = "io.seata.core.protocol"; Set> classNameSet = new HashSet<>(); + try { - packageDir = Thread.currentThread().getContextClassLoader().getResources(packageName.replace(".", "/")); + String packageName = "io.seata.core.protocol"; + Enumeration packageDir = Thread.currentThread().getContextClassLoader().getResources(packageName.replace(".", "/")); + while (packageDir.hasMoreElements()) { + String filePath = packageDir.nextElement().getFile(); + findProtocolClassByPackage(filePath, packageName, classNameSet); + } } catch (IOException ignore) { } - while (packageDir.hasMoreElements()) { - String filePath = packageDir.nextElement().getFile(); - findProtocolClassByPackage(filePath, packageName, classNameSet); + + if (classNameSet.size() < 30) { + // package io.seata.core.protocol + classNameSet.add(io.seata.core.protocol.BatchResultMessage.class); + classNameSet.add(io.seata.core.protocol.HeartbeatMessage.class); + classNameSet.add(io.seata.core.protocol.MergedWarpMessage.class); + classNameSet.add(io.seata.core.protocol.MergeResultMessage.class); + classNameSet.add(io.seata.core.protocol.RegisterRMRequest.class); + classNameSet.add(io.seata.core.protocol.RegisterRMResponse.class); + classNameSet.add(io.seata.core.protocol.RegisterTMRequest.class); + classNameSet.add(io.seata.core.protocol.RegisterTMResponse.class); + classNameSet.add(io.seata.core.protocol.RpcMessage.class); + + // package io.seata.core.protocol.transaction + classNameSet.add(io.seata.core.protocol.transaction.BranchCommitRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.BranchCommitResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.BranchRegisterRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.BranchRegisterResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.BranchReportRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.BranchReportResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.BranchRollbackRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.BranchRollbackResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalBeginRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalBeginResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalCommitRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalCommitResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalLockQueryResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalLockQueryRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalReportRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalReportResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalRollbackRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalRollbackResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalStatusRequest.class); + classNameSet.add(io.seata.core.protocol.transaction.GlobalStatusResponse.class); + classNameSet.add(io.seata.core.protocol.transaction.UndoLogDeleteRequest.class); } + return classNameSet; } diff --git a/dependencies/pom.xml b/dependencies/pom.xml index 56980d6a02a..c8b26cc87fc 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -26,6 +26,7 @@ 4.0.0 seata-dependencies + pom Seata dependencies ${project.version} @@ -35,7 +36,7 @@ 1.0.2 2.5.9 1.8.3 - 1.12.13 + 1.12.17 2.6.10 5.5.3 1.2.83 @@ -98,10 +99,10 @@ 5.1.42 19.3.0.0 + 8.1.2.192 42.3.3 1.4.181 2.7.2 - 8.1.2.192 1.2.7 2.9.0 @@ -215,16 +216,16 @@ postgresql ${postgresql.version} - - org.mariadb.jdbc - mariadb-java-client - ${mariadb.version} - com.dameng DmJdbcDriver18 ${dm.version} + + org.mariadb.jdbc + mariadb-java-client + ${mariadb.version} + com.alipay.sofa sofa-rpc-all diff --git a/discovery/seata-discovery-core/src/main/java/io/seata/discovery/registry/FileRegistryServiceImpl.java b/discovery/seata-discovery-core/src/main/java/io/seata/discovery/registry/FileRegistryServiceImpl.java index 4f4fa0840f8..b626553480c 100644 --- a/discovery/seata-discovery-core/src/main/java/io/seata/discovery/registry/FileRegistryServiceImpl.java +++ b/discovery/seata-discovery-core/src/main/java/io/seata/discovery/registry/FileRegistryServiceImpl.java @@ -90,7 +90,7 @@ public List lookup(String key) throws Exception { for (String endpoint : endpoints) { String[] ipAndPort = endpoint.split(IP_PORT_SPLIT_CHAR); if (ipAndPort.length != 2) { - throw new IllegalArgumentException("endpoint format should like ip:port"); + throw new IllegalArgumentException("endpoint format should like ip:port, the invalid endpoint: " + endpoint); } inetSocketAddresses.add(new InetSocketAddress(ipAndPort[0], Integer.parseInt(ipAndPort[1]))); } diff --git a/pom.xml b/pom.xml index 44071516399..6904cddba63 100644 --- a/pom.xml +++ b/pom.xml @@ -360,6 +360,7 @@ ${maven-surefire-plugin.version} ${maven.surefire.argLine} + ${maven.surefire.excludes} diff --git a/server/pom.xml b/server/pom.xml index 2b24b55ab62..652459054ec 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -29,11 +29,9 @@ server for Seata built with Maven - ${spring-boot.version} - ${spring-framework.version} - 0.9.20 - - + 2.7.18 + 5.3.31 + 2.0 3.8.0 @@ -67,10 +65,19 @@ org.springframework spring-framework-bom + + org.yaml + snakeyaml + pom import + + org.yaml + snakeyaml + ${snakeyaml-for-server.version} + diff --git a/server/src/test/java/io/seata/server/session/redis/RedisDistributedLockerTest.java b/server/src/test/java/io/seata/server/session/redis/RedisDistributedLockerTest.java index 331c536ed79..b9d54ed6355 100644 --- a/server/src/test/java/io/seata/server/session/redis/RedisDistributedLockerTest.java +++ b/server/src/test/java/io/seata/server/session/redis/RedisDistributedLockerTest.java @@ -16,7 +16,6 @@ package io.seata.server.session.redis; import java.io.IOException; -import java.net.UnknownHostException; import io.seata.common.XID; import io.seata.common.loader.EnhancedServiceLoader; @@ -45,6 +44,7 @@ public class RedisDistributedLockerTest { private String retryRollbacking = "RetryRollbacking"; + private String retryRollbacking2 = "RetryRollbacking2"; private String retryCommiting = "RetryCommiting"; private String lockValue = "127.1.1.1:9081"; private static DistributedLocker distributedLocker; @@ -59,27 +59,39 @@ public static void start(ApplicationContext context) throws IOException { jedis = JedisPooledFactory.getJedisInstance(); } + @AfterAll + public static void after() throws IOException { + EnhancedServiceLoader.unload(DistributedLocker.class); + DistributedLockerFactory.cleanLocker(); + DistributedLockerFactory.getDistributedLocker(StoreMode.FILE.getName()); + jedis.close(); + } + @Test public void test_acquireScheduledLock_success() { - boolean acquire = distributedLocker.acquireLock(new DistributedLockDO(retryRollbacking, lockValue, 60000L)); + String lockKey = retryRollbacking; + + boolean acquire = distributedLocker.acquireLock(new DistributedLockDO(lockKey, lockValue, 60000L)); Assertions.assertTrue(acquire); - String lockValueExisted = jedis.get(retryRollbacking); + String lockValueExisted = jedis.get(lockKey); Assertions.assertEquals(lockValue, lockValueExisted); - boolean release = distributedLocker.releaseLock(new DistributedLockDO(retryRollbacking, lockValue, null)); + boolean release = distributedLocker.releaseLock(new DistributedLockDO(lockKey, lockValue, null)); Assertions.assertTrue(release); - Assertions.assertNull(jedis.get(retryRollbacking)); + Assertions.assertNull(jedis.get(lockKey)); } @Test - public void test_acquireScheduledLock_success_() throws UnknownHostException { + public void test_acquireScheduledLock_success_() { + String lockKey = retryRollbacking2; SessionHolder.init(SessionMode.REDIS); - boolean accquire = SessionHolder.acquireDistributedLock(retryRollbacking); + + boolean accquire = SessionHolder.acquireDistributedLock(lockKey); Assertions.assertTrue(accquire); - String lockValueExisted = jedis.get(retryRollbacking); + String lockValueExisted = jedis.get(lockKey); Assertions.assertEquals(XID.getIpAddressAndPort(), lockValueExisted); - boolean release = SessionHolder.releaseDistributedLock(retryRollbacking); + boolean release = SessionHolder.releaseDistributedLock(lockKey); Assertions.assertTrue(release); - Assertions.assertNull(jedis.get(retryRollbacking)); + Assertions.assertNull(jedis.get(lockKey)); } @Test @@ -132,12 +144,4 @@ public void test_acquireLock_false() { Assertions.assertFalse(acquire); } - @AfterAll - public static void after() throws IOException { - EnhancedServiceLoader.unload(DistributedLocker.class); - DistributedLockerFactory.cleanLocker(); - DistributedLockerFactory.getDistributedLocker(StoreMode.FILE.getName()); - jedis.close(); - } - } diff --git a/spring/pom.xml b/spring/pom.xml index 7b36f4864dc..afafdb3d546 100644 --- a/spring/pom.xml +++ b/spring/pom.xml @@ -41,17 +41,17 @@ ${project.groupId} - seata-tcc + seata-rm ${project.version} ${project.groupId} - seata-rm + seata-serializer-all ${project.version} ${project.groupId} - seata-serializer-all + seata-tcc ${project.version} @@ -74,8 +74,6 @@ org.jetbrains.kotlinx kotlinx-coroutines-core - - diff --git a/test/src/test/java/io/seata/core/rpc/netty/TmNettyClientTest.java b/test/src/test/java/io/seata/core/rpc/netty/TmNettyClientTest.java index a2ac66f3a2f..8b09fbc6cd3 100644 --- a/test/src/test/java/io/seata/core/rpc/netty/TmNettyClientTest.java +++ b/test/src/test/java/io/seata/core/rpc/netty/TmNettyClientTest.java @@ -19,6 +19,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import io.netty.channel.Channel; import io.seata.common.XID; @@ -32,12 +33,17 @@ import io.seata.server.session.SessionHolder; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author slievrly */ public class TmNettyClientTest extends AbstractServerTest { + private static final Logger LOGGER = LoggerFactory.getLogger(TmNettyClientTest.class); + + public static ThreadPoolExecutor initMessageExecutor() { return new ThreadPoolExecutor(100, 500, 500, TimeUnit.SECONDS, new LinkedBlockingQueue(20000), new ThreadPoolExecutor.CallerRunsPolicy()); @@ -53,21 +59,39 @@ public void testDoConnect() throws Exception { ThreadPoolExecutor workingThreads = initMessageExecutor(); NettyRemotingServer nettyRemotingServer = new NettyRemotingServer(workingThreads); //start services server first + AtomicBoolean serverStatus = new AtomicBoolean(); Thread thread = new Thread(() -> { - nettyRemotingServer.setHandler(DefaultCoordinator.getInstance(nettyRemotingServer)); - // set registry - XID.setIpAddress(NetUtil.getLocalIp()); - XID.setPort(8091); - // init snowflake for transactionId, branchId - UUIDGenerator.init(1L); - System.out.println("pid info: "+ ManagementFactory.getRuntimeMXBean().getName()); - nettyRemotingServer.init(); + try { + nettyRemotingServer.setHandler(DefaultCoordinator.getInstance(nettyRemotingServer)); + // set registry + XID.setIpAddress(NetUtil.getLocalIp()); + XID.setPort(8091); + // init snowflake for transactionId, branchId + UUIDGenerator.init(1L); + System.out.println("pid info: " + ManagementFactory.getRuntimeMXBean().getName()); + nettyRemotingServer.init(); + serverStatus.set(true); + } catch (Throwable t) { + serverStatus.set(false); + LOGGER.error("The seata-server failed to start", t); + } }); thread.start(); - //then test client - Thread.sleep(3000); + //Wait for the seata-server to start. + long start = System.nanoTime(); + long maxWaitNanoTime = 10 * 1000 * 1000 * 1000L; // 10s + while (System.nanoTime() - start < maxWaitNanoTime) { + Thread.sleep(100); + if (serverStatus.get()) { + break; + } + } + if (!serverStatus.get()) { + throw new RuntimeException("Waiting for a while, but the seata-server did not start successfully."); + } + //then test client String applicationId = "app 1"; String transactionServiceGroup = "group A"; TmNettyRemotingClient tmNettyRemotingClient = TmNettyRemotingClient.getInstance(applicationId, transactionServiceGroup); diff --git a/tm/src/test/java/io/seata/tm/api/TransactionTemplateTest.java b/tm/src/test/java/io/seata/tm/api/TransactionTemplateTest.java index 43dce648697..cc4c0a8ef09 100644 --- a/tm/src/test/java/io/seata/tm/api/TransactionTemplateTest.java +++ b/tm/src/test/java/io/seata/tm/api/TransactionTemplateTest.java @@ -18,6 +18,7 @@ import java.util.LinkedHashSet; import java.util.Set; +import io.seata.core.context.RootContext; import io.seata.core.model.GlobalStatus; import io.seata.core.model.TransactionManager; import io.seata.tm.TransactionManagerHolder; @@ -63,6 +64,7 @@ public void init() throws Exception { txInfo.setTimeOut(DEFAULT_TIME_OUT); txInfo.setName(DEFAULT_NAME); when(transactionalExecutor.getTransactionInfo()).thenReturn(txInfo); + RootContext.unbind(); } @AfterEach