This is an automated email from the ASF dual-hosted git repository.
yowuwuuuw 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 0fb5e8f54c test: add UT for RegistryNamingServerProperties and
RegistryMetadataProperties (#7763)
0fb5e8f54c is described below
commit 0fb5e8f54cfc2a5bdcfc960b1644aa4404011f68
Author: lokidundun <[email protected]>
AuthorDate: Mon Nov 3 17:11:33 2025 +0800
test: add UT for RegistryNamingServerProperties and
RegistryMetadataProperties (#7763)
* test: add tests for RegistryNamingServerProperties and
RegistryMetadataProperties
* run mvn spotless
* add lisence
* change log
---
changes/en-us/2.x.md | 1 +
changes/zh-cn/2.x.md | 1 +
.../registry/RegistryMetadataPropertiesTest.java | 36 +++++++++++++++++
.../RegistryNamingServerPropertiesTest.java | 45 ++++++++++++++++++++++
4 files changed, 83 insertions(+)
diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 3eb083e537..eaa912415e 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -101,6 +101,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#7731](https://github.com/apache/incubator-seata/pull/7731)] add UT for
rm.fence
- [[#7737](https://github.com/apache/incubator-seata/pull/7737)] add UT for
DefaultResourceManager and ClusterWatcherManager
- [[#7757](https://github.com/apache/incubator-seata/pull/7757)] add UT for
undo module
+- [[#7763](https://github.com/apache/incubator-seata/pull/7763)] add UT for
RegistryNamingServerProperties and RegistryMetadataProperties
### refactor:
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index ffd72bba25..e6563659ba 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -100,6 +100,7 @@
- [[#7731](https://github.com/apache/incubator-seata/pull/7731)]
为rm.fence模块添加单测
- [[#7737](https://github.com/apache/incubator-seata/pull/7737)] 为
DefaultResourceManager 和 ClusterWatcherManager 添加测试方法
- [[#7757](https://github.com/apache/incubator-seata/pull/7757)] 为 undo 模块添加单测
+- [[#7763](https://github.com/apache/incubator-seata/pull/7763)] 为
RegistryNamingServerProperties 和 RegistryMetadataProperties 添加单测
### refactor:
diff --git
a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/registry/RegistryMetadataPropertiesTest.java
b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/registry/RegistryMetadataPropertiesTest.java
new file mode 100644
index 0000000000..6b7a60287d
--- /dev/null
+++
b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/registry/RegistryMetadataPropertiesTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.spring.boot.autoconfigure.properties.registry;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class RegistryMetadataPropertiesTest {
+
+ @Test
+ void testRegistryMetadataProperties() {
+ RegistryMetadataProperties metadataProperties = new
RegistryMetadataProperties();
+
+ metadataProperties.setExternal("external-metadata");
+ assertEquals("external-metadata", metadataProperties.getExternal());
+
+ metadataProperties.setExternal(null);
+ assertNull(metadataProperties.getExternal());
+ }
+}
diff --git
a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/registry/RegistryNamingServerPropertiesTest.java
b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/registry/RegistryNamingServerPropertiesTest.java
new file mode 100644
index 0000000000..5a8c9b92c4
--- /dev/null
+++
b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/registry/RegistryNamingServerPropertiesTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.spring.boot.autoconfigure.properties.registry;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class RegistryNamingServerPropertiesTest {
+
+ @Test
+ public void testRegistryNamingServerProperties() {
+ RegistryNamingServerProperties namingServerProperties = new
RegistryNamingServerProperties();
+ namingServerProperties.setCluster("cluster");
+ namingServerProperties.setServerAddr("addr");
+ namingServerProperties.setNamespace("namespace");
+ namingServerProperties.setHeartbeatPeriod(1);
+ namingServerProperties.setMetadataMaxAgeMs(1L);
+ namingServerProperties.setUsername("username");
+ namingServerProperties.setPassword("password");
+ namingServerProperties.setTokenValidityInMilliseconds(1L);
+
+ Assertions.assertEquals("cluster",
namingServerProperties.getCluster());
+ Assertions.assertEquals("addr",
namingServerProperties.getServerAddr());
+ Assertions.assertEquals("namespace",
namingServerProperties.getNamespace());
+ Assertions.assertEquals(1,
namingServerProperties.getHeartbeatPeriod());
+ Assertions.assertEquals(1L,
namingServerProperties.getMetadataMaxAgeMs());
+ Assertions.assertEquals("username",
namingServerProperties.getUsername());
+ Assertions.assertEquals("password",
namingServerProperties.getPassword());
+ Assertions.assertEquals(1L,
namingServerProperties.getTokenValidityInMilliseconds());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]