This is an automated email from the ASF dual-hosted git repository.

Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new f7f3148759 fix: add missing instance_state mapping to instance_info 
BaseResultMap (#7015)
f7f3148759 is described below

commit f7f31487597323f988e55787b82ba3109a180508
Author: Daming <[email protected]>
AuthorDate: Fri Sep 4 07:04:52 2026 +0800

    fix: add missing instance_state mapping to instance_info BaseResultMap 
(#7015)
    
    * fix: add missing instance_state mapping to instance_info BaseResultMap 
(#6873)
    
    BaseResultMap in instance-info-sqlmap.xml mapped 
id/date_created/date_updated/instance_ip/instance_port/instance_type/instance_info/namespace_id
 but not instance_state, even though Base_Column_List includes it and 
insert/updateById write it. Every resultMap-based SELECT (selectAll, 
findAllByNamespaceId, selectByQuery) returned instanceState = null for rows 
with a non-null state, which is the upstream root cause of InstanceCheckService 
null-state autoboxing NPEs. Also removed the dupli [...]
    
    * Update instance-info-sqlmap.xml
    
    ---------
    
    Co-authored-by: Luke Haochao Zhuang <[email protected]>
    Co-authored-by: zhengpeng <[email protected]>
    Co-authored-by: aias00 <[email protected]>
---
 shenyu-admin/src/main/resources/mappers/instance-info-sqlmap.xml      | 1 +
 .../java/org/apache/shenyu/admin/mapper/InstanceInfoMapperTest.java   | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/shenyu-admin/src/main/resources/mappers/instance-info-sqlmap.xml 
b/shenyu-admin/src/main/resources/mappers/instance-info-sqlmap.xml
index d2a112b9ef..0a70c79b27 100644
--- a/shenyu-admin/src/main/resources/mappers/instance-info-sqlmap.xml
+++ b/shenyu-admin/src/main/resources/mappers/instance-info-sqlmap.xml
@@ -26,6 +26,7 @@
         <result column="instance_port" jdbcType="VARCHAR" 
property="instancePort"/>
         <result column="instance_type" jdbcType="VARCHAR" 
property="instanceType"/>
         <result column="instance_info" jdbcType="VARCHAR" 
property="instanceInfo"/>
+        <result column="instance_state" jdbcType="INTEGER" 
property="instanceState"/>
         <result column="namespace_id" jdbcType="VARCHAR" 
property="namespaceId"/>
     </resultMap>
 
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/InstanceInfoMapperTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/InstanceInfoMapperTest.java
index 4f5ce1112b..74801a12d2 100644
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/InstanceInfoMapperTest.java
+++ 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/mapper/InstanceInfoMapperTest.java
@@ -36,6 +36,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo;
 import static org.hamcrest.Matchers.notNullValue;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test cases for InstanceInfoMapper.
@@ -71,12 +72,14 @@ public final class InstanceInfoMapperTest extends 
AbstractSpringIntegrationTest
     void selectAll() {
         List<InstanceInfoDO> list = instanceInfoMapper.selectAll();
         assertThat(list.size(), greaterThanOrEqualTo(1));
+        assertTrue(list.stream().anyMatch(item -> 
instance.getId().equals(item.getId()) && 
instance.getInstanceState().equals(item.getInstanceState())));
     }
 
     @Test
     void findAllByNamespaceId() {
         List<InstanceInfoDO> list = 
instanceInfoMapper.findAllByNamespaceId(instance.getNamespaceId());
         assertThat(list.size(), greaterThanOrEqualTo(1));
+        assertTrue(list.stream().anyMatch(item -> 
instance.getId().equals(item.getId()) && 
instance.getInstanceState().equals(item.getInstanceState())));
     }
 
     @Test
@@ -108,6 +111,7 @@ public final class InstanceInfoMapperTest extends 
AbstractSpringIntegrationTest
         query.setInstancePort(instance.getInstancePort());
         List<InstanceInfoDO> list = instanceInfoMapper.selectByQuery(query);
         assertThat(list.size(), greaterThanOrEqualTo(1));
+        assertTrue(list.stream().anyMatch(item -> 
instance.getId().equals(item.getId()) && 
instance.getInstanceState().equals(item.getInstanceState())));
     }
 
     @Test

Reply via email to