This is an automated email from the ASF dual-hosted git repository.
jianbin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git
The following commit(s) were added to refs/heads/2.x by this push:
new d73c68763d test: add test for Fury/Fory (#7906)
d73c68763d is described below
commit d73c68763de8330fc3a1b1edc2e1850d6969e6ad
Author: jimin <[email protected]>
AuthorDate: Sun Dec 28 01:49:53 2025 +0800
test: add test for Fury/Fory (#7906)
---
.../seata/serializer/fory/ForySerializerTest.java | 26 ++++++++
.../src/test/resources/file.conf | 73 ++++++++++++++++++++++
.../src/test/resources/registry.conf | 24 +++++++
3 files changed, 123 insertions(+)
diff --git
a/serializer/seata-serializer-fory/src/test/java/org/apache/seata/serializer/fory/ForySerializerTest.java
b/serializer/seata-serializer-fory/src/test/java/org/apache/seata/serializer/fory/ForySerializerTest.java
index 8fe4ec555a..d5feaaf23f 100644
---
a/serializer/seata-serializer-fory/src/test/java/org/apache/seata/serializer/fory/ForySerializerTest.java
+++
b/serializer/seata-serializer-fory/src/test/java/org/apache/seata/serializer/fory/ForySerializerTest.java
@@ -22,6 +22,10 @@ import org.apache.seata.core.model.BranchType;
import org.apache.seata.core.protocol.ResultCode;
import org.apache.seata.core.protocol.transaction.BranchCommitRequest;
import org.apache.seata.core.protocol.transaction.BranchCommitResponse;
+import org.apache.seata.core.serializer.Serializer;
+import org.apache.seata.core.serializer.SerializerServiceLoader;
+import org.apache.seata.core.serializer.SerializerType;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -76,4 +80,26 @@ public class ForySerializerTest {
assertThat(t.getMsg()).isEqualTo(branchCommitResponse.getMsg());
assertThat(t.getResultCode()).isEqualTo(branchCommitResponse.getResultCode());
}
+
+ @Test
+ public void testLoadSerializerWithType() {
+ Serializer serializerFury =
SerializerServiceLoader.load(SerializerType.FURY);
+ Assertions.assertNotNull(serializerFury, "FURY Serializer should be
available");
+
+ Serializer serializerFory =
SerializerServiceLoader.load(SerializerType.FORY);
+ Assertions.assertNotNull(serializerFory, "FORY Serializer should be
available");
+
+ Assertions.assertEquals(serializerFury, serializerFory, "FORY
Serializer should be equal FURY");
+ }
+
+ @Test
+ public void testLoadSerializerWithVersion() {
+ Serializer serializerFury =
SerializerServiceLoader.load(SerializerType.FURY, (byte) 0x01);
+ Assertions.assertNotNull(serializerFury, "FURY Serializer should be
available");
+
+ Serializer serializerFory =
SerializerServiceLoader.load(SerializerType.FORY, (byte) 0x01);
+ Assertions.assertNotNull(serializerFory, "FORY Serializer should be
available");
+
+ Assertions.assertEquals(serializerFury, serializerFory, "FORY
Serializer should be equal FURY");
+ }
}
diff --git a/serializer/seata-serializer-fory/src/test/resources/file.conf
b/serializer/seata-serializer-fory/src/test/resources/file.conf
new file mode 100644
index 0000000000..1a03672ddf
--- /dev/null
+++ b/serializer/seata-serializer-fory/src/test/resources/file.conf
@@ -0,0 +1,73 @@
+#
+# 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.
+#
+
+#reduce delay for test
+## transaction log store, only used in seata-server
+store {
+ ## store mode: filećdb
+ mode = "file"
+
+ ## file store property
+ file {
+ ## store location dir
+ dir = "sessionStore"
+ }
+
+ ## database store property
+ db {
+ ## the implement of javax.sql.DataSource, such as
DruidDataSource(druid)/BasicDataSource(dbcp) etc.
+ datasource = "dbcp"
+ ## mysql/oracle/h2/oceanbase etc.
+ dbType = "mysql"
+ driverClassName = "com.mysql.jdbc.Driver"
+ ## if using mysql to store the data, recommend add
rewriteBatchedStatements=true in jdbc connection param
+ url = "jdbc:mysql://127.0.0.1:3306/seata?rewriteBatchedStatements=true"
+ user = "mysql"
+ password = "mysql"
+ }
+}
+server {
+ recovery {
+ #schedule committing retry period in milliseconds
+ committingRetryPeriod = 100
+ #schedule asyn committing retry period in milliseconds
+ asynCommittingRetryPeriod = 100
+ #schedule rollbacking retry period in milliseconds
+ rollbackingRetryPeriod = 100
+ #schedule timeout retry period in milliseconds
+ timeoutRetryPeriod = 100
+ }
+ undo {
+ logSaveDays = 2
+ #schedule delete expired undo_log in milliseconds
+ logDeletePeriod = 86400000
+ }
+ ratelimit {
+ enable = false
+ bucketTokenNumPerSecond = 999999
+ bucketTokenMaxNum = 999999
+ bucketTokenInitialNum = 999999
+ }
+}
+## metrics settings
+metrics {
+ enabled = true
+ registryType = "compact"
+ # multi exporters use comma divided
+ exporterList = "prometheus"
+ exporterPrometheusPort = 9898
+}
\ No newline at end of file
diff --git a/serializer/seata-serializer-fory/src/test/resources/registry.conf
b/serializer/seata-serializer-fory/src/test/resources/registry.conf
new file mode 100644
index 0000000000..2fc516151a
--- /dev/null
+++ b/serializer/seata-serializer-fory/src/test/resources/registry.conf
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+config {
+ type = "file"
+
+ file {
+ name = "file.conf"
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]