diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1323da7364a..bf2e1f9b229 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v3 # step 2 - name: "Set up Java JDK" - uses: actions/setup-java@v2.5.0 + uses: actions/setup-java@v3.12.0 with: distribution: 'zulu' java-version: ${{ matrix.java }} diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 65999b197f2..f0de60645e9 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -24,7 +24,7 @@ jobs: uses: actions/checkout@v3 # step 2 - name: "Setup Java JDK" - uses: actions/setup-java@v3.9.0 + uses: actions/setup-java@v3.12.0 with: distribution: 'zulu' java-version: ${{ matrix.java }} diff --git a/.github/workflows/publish-ossrh.yml b/.github/workflows/publish-ossrh.yml index 6cf10be8e20..b05bcbc2f08 100644 --- a/.github/workflows/publish-ossrh.yml +++ b/.github/workflows/publish-ossrh.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v2.4.0 # step 2 - name: "Setup Java JDK" - uses: actions/setup-java@v3.9.0 + uses: actions/setup-java@v3.12.0 with: distribution: 'zulu' java-version: 8 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd52728af8b..46f054f0352 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: uses: actions/checkout@v3 # step 2 - name: "Set up Java JDK" - uses: actions/setup-java@v2.5.0 + uses: actions/setup-java@v3.12.0 with: distribution: 'zulu' java-version: ${{ matrix.java }} @@ -61,7 +61,7 @@ jobs: matrix: java: [ 17, 21 ] springboot: [ - 3.1.4 -Dspring-framework.version=6.0.12 -Pdependencies-for-springboot3-1-or-above, + 3.1.4 -Dspring-framework.version=6.0.12, 3.0.11 -Dspring-framework.version=6.0.12, ] steps: @@ -70,7 +70,7 @@ jobs: uses: actions/checkout@v3 # step 2 - name: "Set up Java JDK" - uses: actions/setup-java@v2.5.0 + uses: actions/setup-java@v3.12.0 with: distribution: 'zulu' java-version: ${{ matrix.java }} diff --git a/all/pom.xml b/all/pom.xml index cc4a448e4de..14ef25f22e7 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -651,15 +651,12 @@ - + - + META-INF/spring.handlers - + META-INF/spring.schemas diff --git a/build/pom.xml b/build/pom.xml index d2f781868d6..db8caeb3c56 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -384,11 +384,11 @@ - + - args-for-test-by-jdk17 + args-for-test-by-jdk17-and-above - 17 + [17,) diff --git a/common/src/test/java/io/seata/common/util/CompressUtilTest.java b/common/src/test/java/io/seata/common/util/CompressUtilTest.java index 2fae122789a..6cda18e9359 100644 --- a/common/src/test/java/io/seata/common/util/CompressUtilTest.java +++ b/common/src/test/java/io/seata/common/util/CompressUtilTest.java @@ -36,15 +36,15 @@ public class CompressUtilTest { @Test - @DisabledOnJre(JRE.JAVA_17) - public void testCompress() throws IOException { + @EnabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) + public void testCompress1() throws IOException { Assertions.assertArrayEquals(compressedBytes1, CompressUtil.compress(originBytes)); } @Test - @EnabledOnJre(JRE.JAVA_17) - public void testCompressForJava17() throws IOException { + @DisabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) + public void testCompress2() throws IOException { Assertions.assertArrayEquals(compressedBytes2, CompressUtil.compress(originBytes)); } diff --git a/common/src/test/java/io/seata/common/util/ReflectionUtilTest.java b/common/src/test/java/io/seata/common/util/ReflectionUtilTest.java index 9e5a46ac12a..6df3dfb7a4d 100644 --- a/common/src/test/java/io/seata/common/util/ReflectionUtilTest.java +++ b/common/src/test/java/io/seata/common/util/ReflectionUtilTest.java @@ -28,7 +28,7 @@ import io.seata.common.BranchDO; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; public class ReflectionUtilTest { @@ -124,7 +124,7 @@ public void testGetInterfaces() { } @Test - @DisabledOnJre(JRE.JAVA_17) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 + @EnabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 and above versions public void testModifyStaticFinalField() throws NoSuchFieldException, IllegalAccessException { Assertions.assertEquals("hello", testValue); ReflectionUtil.modifyStaticFinalField(ReflectionUtilTest.class, "testValue", "hello world"); @@ -189,7 +189,7 @@ public void testAnnotationToString() throws NoSuchMethodException { } @Test - @DisabledOnJre(JRE.JAVA_17) // `ReflectionUtil.getAnnotationValues` does not supported java17 + @EnabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 and above versions public void testGetAnnotationValues() throws NoSuchMethodException, NoSuchFieldException { Assertions.assertEquals(new LinkedHashMap<>(), ReflectionUtil .getAnnotationValues(this.getClass().getMethod("testGetAnnotationValues").getAnnotation(Test.class))); diff --git a/common/src/test/java/io/seata/common/util/StringUtilsTest.java b/common/src/test/java/io/seata/common/util/StringUtilsTest.java index 410fc8e539e..f094eba625d 100644 --- a/common/src/test/java/io/seata/common/util/StringUtilsTest.java +++ b/common/src/test/java/io/seata/common/util/StringUtilsTest.java @@ -34,6 +34,7 @@ import io.seata.common.holder.ObjectHolder; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.opentest4j.AssertionFailedError; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertNull; @@ -172,7 +173,12 @@ void testToStringAndCycleDependency() throws Exception { //case: Charset Assertions.assertEquals("UTF-8", StringUtils.toString(StandardCharsets.UTF_8)); //case: Thread - Assertions.assertEquals("Thread[main,5,main]", StringUtils.toString(Thread.currentThread())); + try { + Assertions.assertEquals("Thread[main,5,main]", StringUtils.toString(Thread.currentThread())); + } catch (AssertionFailedError e) { + // for java21 and above + Assertions.assertEquals("Thread[#" + Thread.currentThread().getId() + ",main,5,main]", StringUtils.toString(Thread.currentThread())); + } //case: Date Date date = new Date(2021 - 1900, 6 - 1, 15); diff --git a/rm-datasource/src/test/java/io/seata/rm/datasource/ConnectionProxyTest.java b/rm-datasource/src/test/java/io/seata/rm/datasource/ConnectionProxyTest.java index 4a493a07fdb..81d62d618b5 100644 --- a/rm-datasource/src/test/java/io/seata/rm/datasource/ConnectionProxyTest.java +++ b/rm-datasource/src/test/java/io/seata/rm/datasource/ConnectionProxyTest.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; import org.mockito.Mockito; @@ -43,7 +43,7 @@ * * @author ggndnn */ -@DisabledOnJre(JRE.JAVA_17) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 +@EnabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 and above versions public class ConnectionProxyTest { private DataSourceProxy dataSourceProxy; diff --git a/rm-datasource/src/test/java/io/seata/rm/datasource/exec/AbstractDMLBaseExecutorTest.java b/rm-datasource/src/test/java/io/seata/rm/datasource/exec/AbstractDMLBaseExecutorTest.java index f2d1a73e08f..dbc6a4a6642 100644 --- a/rm-datasource/src/test/java/io/seata/rm/datasource/exec/AbstractDMLBaseExecutorTest.java +++ b/rm-datasource/src/test/java/io/seata/rm/datasource/exec/AbstractDMLBaseExecutorTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; import org.mockito.Mockito; @@ -44,7 +44,7 @@ * * @author ggndnn */ -@DisabledOnJre(JRE.JAVA_17) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 +@EnabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 and above versions public class AbstractDMLBaseExecutorTest { private ConnectionProxy connectionProxy; diff --git a/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java b/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java index 1890423683d..82136eaa7f6 100644 --- a/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java +++ b/server/src/test/java/io/seata/server/coordinator/DefaultCoordinatorTest.java @@ -53,7 +53,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -159,7 +159,7 @@ public void test_handleRetryRollbacking() throws TransactionException, Interrupt } @Test - @DisabledOnJre(JRE.JAVA_17) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 + @EnabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 and above versions public void test_handleRetryRollbackingTimeOut() throws TransactionException, InterruptedException, NoSuchFieldException, IllegalAccessException { String xid = core.begin(applicationId, txServiceGroup, txName, 10); Long branchId = core.branchRegister(BranchType.AT, "abcd", clientId, xid, applicationData, lockKeys_2); @@ -185,7 +185,7 @@ public void test_handleRetryRollbackingTimeOut() throws TransactionException, In } @Test - @DisabledOnJre(JRE.JAVA_17) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 + @EnabledOnJre({JRE.JAVA_8, JRE.JAVA_11}) // `ReflectionUtil.modifyStaticFinalField` does not supported java17 and above versions public void test_handleRetryRollbackingTimeOut_unlock() throws TransactionException, InterruptedException, NoSuchFieldException, IllegalAccessException { String xid = core.begin(applicationId, txServiceGroup, txName, 10);