From a165e04e4e96b424e9bf1faa6390f888278e8abd Mon Sep 17 00:00:00 2001 From: zzx <142965157+zzxxiansheng@users.noreply.github.com> Date: Tue, 12 Mar 2024 23:21:42 +0800 Subject: [PATCH] [ISSUE #57] Modify the field, synchronize the modification, and add the mapper method (#58) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: add dependency of console module and move controllers into console module. * fix: add logback config, fix application-dev.yml and move `` to root `pom.xml` as pointed out in PR#19. * FirstCommit * remerge * first improve * second improve * third improve * fourth improve * fourth improve * fourth improve * Update and rename EventmeshConsoleApplication.java to EventMeshDashboardApplication.java * rename this starter class file to EventMeshDashboardApplication * rename this starter class file to EventMeshDashboardApplication * change some resource file * improve name * improve name * Modify the fields of the synchronized log table * improve name * improve name * config basic function and config ,runtime,store,cluster sql * try to resolve build error * Some changes in the specification * something rename * one sql update * tag something to do * The distinction between state and status is_delete fields is unified, and selectAll() and batchInsert() are added to all instance tables for subsequent data synchronization. Modification of some fields. * Delete eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/ClusterEntity1.java delete something no use * Delete eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/RuntimeEntity1.java delete something no use * improve something checkstyle error * try to solve something sql test error * try to resolve something test error * try to resolve something test error * something is_delete(error) change to status (#3) Co-authored-by: 周倬贤 <14100340+zhou-zhuoxian@user.noreply.gitee.com> --------- Co-authored-by: lambert@arch Co-authored-by: 周倬贤 <14100340+zhou-zhuoxian@user.noreply.gitee.com> --- .../console/entity/cluster/ClusterEntity.java | 8 +- .../console/entity/config/ConfigEntity.java | 4 +- .../console/entity/group/GroupEntity.java | 7 +- .../entity/groupmember/GroupMemberEntity.java | 7 +- .../health/HealthCheckResultEntity.java | 4 +- .../console/entity/log/LogEntity.java | 6 +- .../console/entity/runtime/RuntimeEntity.java | 4 +- .../console/entity/storage/StoreEntity.java | 4 +- .../console/entity/topic/TopicEntity.java | 6 +- .../function/health/HealthExecutor.java | 2 +- .../dashboard/console/log/OprLog.java | 6 +- .../console/mapper/client/ClientMapper.java | 16 ++++ .../console/mapper/cluster/ClusterMapper.java | 23 ++++-- .../console/mapper/config/ConfigMapper.java | 24 +++++- .../mapper/connection/ConnectionMapper.java | 2 +- .../mapper/connector/ConnectorMapper.java | 3 + .../console/mapper/group/OprGroupMapper.java | 23 ++++-- .../groupmember/OprGroupMemberMapper.java | 25 ++++-- .../health/HealthCheckResultMapper.java | 17 +++-- .../console/mapper/log/OprLogMapper.java | 2 +- .../console/mapper/meta/MetaMapper.java | 14 ++++ .../console/mapper/runtime/RuntimeMapper.java | 19 ++++- .../console/mapper/storage/StoreMapper.java | 19 ++++- .../console/mapper/topic/TopicMapper.java | 19 ++++- .../service/client/ClientDataService.java | 7 ++ .../client/Impl/ClientDataServiceImpl.java | 44 +++++++++++ .../service/cluster/ClusterService.java | 4 + .../cluster/impl/ClusterServiceImpl.java | 10 +++ .../console/service/config/ConfigService.java | 4 + .../config/Impl/ConfigServiceImpl.java | 10 +++ .../console/service/group/GroupService.java | 4 + .../group/{ => Impl}/GroupServiceImpl.java | 13 +++- .../groupmember/GroupMemberService.java | 4 + .../{ => Impl}/GroupMemberServiceImp.java | 13 +++- .../runtime/Impl/RuntimeServiceImpl.java | 10 +++ .../service/runtime/RuntimeService.java | 4 + .../service/store/Impl/StoreServiceImpl.java | 10 +++ .../console/service/store/StoreService.java | 4 + .../console/service/topic/TopicService.java | 4 + .../service/topic/TopicServiceImpl.java | 10 +++ .../main/resources/eventmesh-dashboard.sql | 76 +++++++++++++++---- .../function/health/HealthExecutorTest.java | 6 +- .../console/linkage/log/TestOprLog.java | 2 +- .../health/HealthCheckResultMapperTest.java | 16 ++-- .../unit/cluster/TestClusterMapper.java | 12 +-- .../console/unit/group/GroupMapperTest.java | 2 +- .../groupmember/GroupMemberMapperTest.java | 2 +- .../console/unit/topic/TopicMapperTest.java | 2 +- .../src/test/resources/health-test.sql | 14 ++-- 49 files changed, 453 insertions(+), 98 deletions(-) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/{ => Impl}/GroupServiceImpl.java (91%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/{ => Impl}/GroupMemberServiceImp.java (89%) diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java index f81237d9..dc1f4e44 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.console.entity.cluster; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -26,7 +28,7 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class ClusterEntity { +public class ClusterEntity extends BaseEntity { private Long id; @@ -50,7 +52,11 @@ public class ClusterEntity { private Integer runState; + private Integer status; + private Timestamp createTime; private Timestamp updateTime; + + private Integer storeType; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java index dd726a8f..07b979b6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.console.entity.config; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -26,7 +28,7 @@ @NoArgsConstructor @AllArgsConstructor @Data -public class ConfigEntity { +public class ConfigEntity extends BaseEntity { private Long id; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java index c395bac3..52d15d20 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.console.entity.group; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -26,7 +28,8 @@ @NoArgsConstructor @AllArgsConstructor @Data -public class GroupEntity { +public class GroupEntity extends BaseEntity { + private Long id; private Long clusterId; @@ -45,6 +48,6 @@ public class GroupEntity { private Timestamp updateTime; - + private Integer status; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java index dbadc1eb..9b56cbe1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.console.entity.groupmember; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -26,7 +28,8 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class GroupMemberEntity { +public class GroupMemberEntity extends BaseEntity { + private Long id; private Long clusterId; @@ -43,5 +46,5 @@ public class GroupMemberEntity { private Timestamp updateTime; - + private Integer status; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java index f427b66b..f2b65ad3 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java @@ -44,7 +44,7 @@ public class HealthCheckResultEntity extends BaseEntity { private String resultDesc; - @Schema(description = "status of a health check, 0: failed, 1: passed, 2: doing check, 3: out of time") - private Integer status; + @Schema(description = "state of a health check, 0: failed, 1: passed, 2: doing check, 3: out of time") + private Integer state; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java index ac7c30aa..f2483f5f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.console.entity.log; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -26,7 +28,7 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class LogEntity { +public class LogEntity extends BaseEntity { private Long id; @@ -36,7 +38,7 @@ public class LogEntity { private String targetType; - private Integer status; + private Integer state; private String content; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java index e070075d..2cc3f5cf 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.console.entity.runtime; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -26,7 +28,7 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class RuntimeEntity { +public class RuntimeEntity extends BaseEntity { private Long id; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java index dd7f4d21..3f3d326b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java @@ -18,6 +18,8 @@ package org.apache.eventmesh.dashboard.console.entity.storage; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -27,7 +29,7 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class StoreEntity { +public class StoreEntity extends BaseEntity { private Long id; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java index 6b4bd09c..a5784f01 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.console.entity.topic; +import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + import java.sql.Timestamp; import lombok.AllArgsConstructor; @@ -26,7 +28,8 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class TopicEntity { +public class TopicEntity extends BaseEntity { + private Long id; private Long clusterId; @@ -47,4 +50,5 @@ public class TopicEntity { private Timestamp updateTime; + private Integer status; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java index fac6eb76..5cb0e024 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java @@ -137,7 +137,7 @@ private void addToResultList(CheckResult result, ArrayList selectAll(); + + @Select({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List clientEntityList); + @Select("SELECT * FROM `client` WHERE `id` = #{id}") ClientEntity selectById(ClientEntity clientEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java index eea050a8..23608bfa 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java @@ -34,15 +34,28 @@ @Mapper public interface ClusterMapper { - @Select("SELECT * FROM cluster WHERE is_delete=0") + @Select("SELECT * FROM cluster WHERE status=1") List selectAllCluster(); - @Select("SELECT * FROM cluster WHERE id=#{id} AND is_delete=0") + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List clusterEntities); + + @Select("SELECT * FROM cluster WHERE id=#{id} AND status=1") ClusterEntity selectClusterById(ClusterEntity cluster); @Insert("INSERT INTO cluster (name, register_name_list, bootstrap_servers, eventmesh_version, client_properties, " - + "jmx_properties, reg_properties, description, auth_type, run_state) VALUES (#{name},#{registerNameList}," - + "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType},#{runState})") + + "jmx_properties, reg_properties, description, auth_type, run_state,store_type) VALUES (#{name},#{registerNameList}," + + "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType}," + + "#{runState},#{storeType})") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void addCluster(ClusterEntity cluster); @@ -52,7 +65,7 @@ public interface ClusterMapper { + "register_name_list=#{registerNameList} WHERE id=#{id}") void updateClusterById(ClusterEntity cluster); - @Delete("UPDATE cluster SET is_delete=1 WHERE id=#{id}") + @Delete("UPDATE cluster SET status=0 WHERE id=#{id}") void deleteClusterById(ClusterEntity clusterEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java index e7ee325e..167c7b24 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/config/ConfigMapper.java @@ -33,14 +33,30 @@ @Mapper public interface ConfigMapper { - @Insert("INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name," - + " config_value, start_version,eventmesh_version, description, edit,end_version,is_default,is_modify) VALUE " + @Select("SELECT * FROM config WHERE status=1") + List selectAll(); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List configEntityList); + + @Insert("INSERT INTO config (cluster_id, business_type, instance_type, instance_id, config_name, config_value, start_version, " + + "status, is_default, end_version, diff_type, description, edit, is_modify, eventmesh_version) VALUE " + "(#{clusterId},#{businessType},#{instanceType},#{instanceId},#{configName}," - + "#{configValue},#{startVersion},#{eventmeshVersion},#{description},#{edit},#{endVersion},#{isDefault},#{isModify})") + + "#{configValue},#{startVersion},#{status},#{isDefault},#{endVersion},#{diffType},#{description},#{edit},#{isModify},#{eventmeshVersion})") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") Integer addConfig(ConfigEntity configEntity); - @Update("UPDATE config SET status=2 WHERE id=#{id}") + @Update("UPDATE config SET status=0 WHERE id=#{id}") Integer deleteConfig(ConfigEntity configEntity); @Update("UPDATE config SET config_value=#{configValue} WHERE status=1 AND edit=2") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapper.java index 82ebc5c3..38903cd9 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapper.java @@ -91,4 +91,4 @@ public List selectByClusterIdSinkTypeAndSinkIdAndCreateTimeRan ""}) void batchEndConnectionById(List connectionEntityList); -} +} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java index 2f5101a3..ba0724c4 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapper.java @@ -33,6 +33,9 @@ @Mapper public interface ConnectorMapper { + @Select("SELECT * FROM connector WHERE status=1") + ConnectorEntity selectAll(); + @Select("SELECT * FROM connector WHERE id = #{id}") ConnectorEntity selectById(ConnectorEntity connectorEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java index 321e76c9..fe228ab1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/group/OprGroupMapper.java @@ -36,23 +36,36 @@ public interface OprGroupMapper { @Insert("INSERT INTO `group` (cluster_id, name, member_count, members, type, state)" + "VALUE (#{clusterId},#{name},#{memberCount},#{members},#{type},#{state}) " - + "ON DUPLICATE KEY UPDATE is_delete=0") + + "ON DUPLICATE KEY UPDATE status=1") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void addGroup(GroupEntity groupEntity); + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List groupEntities); + + @Select("SELECT * FROM `group` WHERE status=1") + List selectAll(); + @Update("UPDATE `group` SET member_count=#{memberCount}," + "members=#{members},type=#{type},state=#{state} WHERE id=#{id}") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") Integer updateGroup(GroupEntity groupEntity); - @Delete("UPDATE `group` SET is_delete=1 WHERE id=#{id}") + @Delete("UPDATE `group` SET status=1 WHERE id=#{id}") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") Integer deleteGroup(GroupEntity groupEntity); - @Select("SELECT * FROM `group` WHERE cluster_id=#{clusterId} AND name=#{name} AND is_delete=0") + @Select("SELECT * FROM `group` WHERE cluster_id=#{clusterId} AND name=#{name} AND status=1") GroupEntity selectGroupByUnique(GroupEntity groupEntity); - @Select("SELECT * FROM `group` WHERE id=#{id} AND is_delete=0") + @Select("SELECT * FROM `group` WHERE id=#{id} AND status=1") GroupEntity selectGroupById(GroupEntity groupEntity); @Select({ @@ -65,7 +78,7 @@ public interface OprGroupMapper { " ", " AND name LIKE concat('%',#{name},'%')", " ", - " AND is_delete=0", + " AND status=1", " ", ""}) List selectGroup(GroupEntity groupEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/groupmember/OprGroupMemberMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/groupmember/OprGroupMemberMapper.java index b3dab8aa..40849035 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/groupmember/OprGroupMemberMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/groupmember/OprGroupMemberMapper.java @@ -36,12 +36,25 @@ @Mapper public interface OprGroupMemberMapper { - @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND is_delete=0") + @Select("SELECT * FROM group_member WHERE status=1") + List selectAll(); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List groupMemberEntities); + + @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND status=1") List getGroupByClusterId(GroupMemberEntity groupMemberEntity); @Insert("INSERT INTO group_member (cluster_id, topic_name, group_name, eventmesh_user,state)" + " VALUE (#{clusterId},#{topicName},#{groupName},#{eventMeshUser},#{state})" - + "ON DUPLICATE KEY UPDATE is_delete=0") + + "ON DUPLICATE KEY UPDATE status=0") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void addGroupMember(GroupMemberEntity groupMemberEntity); @@ -49,14 +62,14 @@ public interface OprGroupMemberMapper { @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void updateGroupMember(GroupMemberEntity groupMemberEntity); - @Delete("UPDATE group_member SET is_delete=1 WHERE id=#{id} ") + @Delete("UPDATE group_member SET status=0 WHERE id=#{id} ") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") GroupMemberEntity deleteGroupMember(GroupMemberEntity groupMemberEntity); - @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND group_name=#{groupName} AND topic_name=#{topicName} AND is_delete=0") + @Select("SELECT * FROM group_member WHERE cluster_id=#{clusterId} AND group_name=#{groupName} AND topic_name=#{topicName} AND status=1") GroupMemberEntity selectGroupMemberByUnique(GroupMemberEntity groupMemberEntity); - @Select("SELECT * FROM group_member WHERE id=#{id} AND is_delete=0") + @Select("SELECT * FROM group_member WHERE id=#{id} AND status=1") GroupMemberEntity selectGroupMemberById(GroupMemberEntity groupMemberEntity); @Select({ @@ -73,7 +86,7 @@ public interface OprGroupMemberMapper { " AND topic_name=#{topicName}", " ", " ", - " AND is_delete=0", + " AND status=1", ""}) List selectMember(GroupMemberEntity groupMemberEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java index d5d5aab5..01930c5b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapper.java @@ -35,6 +35,9 @@ @Mapper public interface HealthCheckResultMapper { + @Select("SELECT * FROM health_check_result") + List selectAll(); + @Select("SELECT * FROM health_check_result WHERE id = #{id}") HealthCheckResultEntity selectById(HealthCheckResultEntity healthCheckResultEntity); @@ -49,28 +52,28 @@ List selectByClusterIdAndCreateTimeRange(@Param("cluste @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime); @Options(useGeneratedKeys = true, keyProperty = "id") - @Insert("INSERT INTO health_check_result(type,type_id, cluster_id, status,result_desc)" - + " VALUES( #{type}, #{typeId}, #{clusterId}, #{status}, #{resultDesc})") + @Insert("INSERT INTO health_check_result(type,type_id, cluster_id, state,result_desc)" + + " VALUES( #{type}, #{typeId}, #{clusterId}, #{state}, #{resultDesc})") void insert(HealthCheckResultEntity healthCheckResultEntity); @Insert({ "" }) void batchInsert(List healthCheckResultEntityList); - @Update("UPDATE health_check_result SET status = #{status}, result_desc = #{resultDesc} WHERE id = #{id}") + @Update("UPDATE health_check_result SET state = #{state}, result_desc = #{resultDesc} WHERE id = #{id}") void update(HealthCheckResultEntity healthCheckResultEntity); @Update({ ""}) @@ -79,7 +82,7 @@ List selectByClusterIdAndCreateTimeRange(@Param("cluste @Select({ ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List metaEntities); + @Select("SELECT * FROM meta WHERE id = #{id}") MetaEntity selectById(MetaEntity metaEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java index a9db87f6..4c6e8ceb 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java @@ -34,18 +34,31 @@ @Mapper public interface RuntimeMapper { + @Select("SELECT * FROM runtime WHERE status=1") + List selectAll(); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List runtimeEntities); + @Insert("INSERT INTO runtime (cluster_id, host, storage_cluster_id, port, jmx_port, start_timestamp, rack, status, " + "endpoint_map) VALUES(#{clusterId},#{host},#{storageClusterId},#{port},#{jmxPort},#{startTimestamp},#{rack},#{status},#{endpointMap})") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void addRuntime(RuntimeEntity runtimeEntity); - @Select("SELECT * FROM runtime WHERE cluster_id=#{clusterId} AND is_delete=0") + @Select("SELECT * FROM runtime WHERE cluster_id=#{clusterId} AND status=1") List selectRuntimeByCluster(RuntimeEntity runtimeEntity); - @Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} WHERE cluster_id=#{clusterId} AND is_delete=0") + @Update("UPDATE runtime SET port=#{port} ,jmx_port=#{jmxPort} ,status=#{status} WHERE cluster_id=#{clusterId} AND status=1") void updateRuntimeByCluster(RuntimeEntity runtimeEntity); - @Delete("UPDATE runtime SET is_delete=1 WHERE cluster_id=#{clusterId}") + @Delete("UPDATE runtime SET status=0 WHERE cluster_id=#{clusterId}") void deleteRuntimeByCluster(RuntimeEntity runtimeEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java index 0207903d..804a3711 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java @@ -33,6 +33,21 @@ @Mapper public interface StoreMapper { + @Select("SELECT * FROM store WHERE status=1") + List selectAll(); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List storeEntities); + @Insert("INSERT INTO store (cluster_id, store_id, store_type, host, runtime_id, topic_list, diff_type" + ", port, jmx_port, start_timestamp, rack, status, endpoint_map ) VALUES (" + "#{clusterId},#{storeId},#{storeType},#{host},#{runtimeId},#{topicList},#{diffType},#{port},#{jmxPort}" @@ -40,10 +55,10 @@ public interface StoreMapper { @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void addStore(StoreEntity storeEntity); - @Update("UPDATE store SET is_delete=1 WHERE cluster_id=#{clusterId} AND store_id=#{storeId}") + @Update("UPDATE store SET status=0 WHERE cluster_id=#{clusterId} AND store_id=#{storeId}") void deleteStoreByUnique(StoreEntity storeEntity); - @Select("SELECT * FROM store WHERE cluster_id=#{clusterId} AND is_delete=0") + @Select("SELECT * FROM store WHERE cluster_id=#{clusterId} AND status=1") List selectStoreByCluster(StoreEntity storeEntity); @Update("UPDATE store SET status=#{status} WHERE cluster_id=#{clusterId} AND store_id=#{storeId}") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/topic/TopicMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/topic/TopicMapper.java index 0fe2cadc..48d6a0c7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/topic/TopicMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/topic/TopicMapper.java @@ -35,6 +35,19 @@ @Mapper public interface TopicMapper { + @Select("SELECT * FROM topic WHERE status=1") + List selectAll(); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List topicEntities); + @Select("SELECT count(*) FROM topic WHERE cluster_id=#{clusterId}") Integer selectTopicNumByCluster(TopicEntity topicEntity); @@ -48,21 +61,21 @@ public interface TopicMapper { " ", " AND cluster_id=#{clusterId} ", " ", - " AND is_delete=0", + " AND status=1", " ", ""}) List getTopicList(TopicEntity topicEntity); @Insert("INSERT INTO topic (cluster_id, topic_name, runtime_id, storage_id, retention_ms, type, description) " + "VALUE (#{clusterId},#{topicName},#{runtimeId},#{storageId},#{retentionMs},#{type},#{description})" - + "ON DUPLICATE KEY UPDATE is_delete = 0") + + "ON DUPLICATE KEY UPDATE status = 1") @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void addTopic(TopicEntity topicEntity); @Update("UPDATE topic SET type=#{type},description=#{description} WHERE id=#{id}") void updateTopic(TopicEntity topicEntity); - @Delete("UPDATE `topic` SET is_delete=1 WHERE id=#{id}") + @Delete("UPDATE `topic` SET status=0 WHERE id=#{id}") void deleteTopic(TopicEntity topicEntity); @Select("SELECT * FROM topic WHERE cluster_id=#{clusterId} AND topic_name=#{topicName}") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java index 4daa5ff1..22a0712d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java @@ -17,9 +17,16 @@ package org.apache.eventmesh.dashboard.console.service.client; +import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; + +import java.util.List; + /** * Service providing data of clients. */ public interface ClientDataService { + List selectAll(); + + void batchInsert(List clientEntityList); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java new file mode 100644 index 00000000..7a153fc2 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java @@ -0,0 +1,44 @@ +/* + * 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.eventmesh.dashboard.console.service.client.Impl; + +import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; +import org.apache.eventmesh.dashboard.console.mapper.client.ClientMapper; +import org.apache.eventmesh.dashboard.console.service.client.ClientDataService; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ClientDataServiceImpl implements ClientDataService { + + @Autowired + private ClientMapper clientMapper; + + @Override + public List selectAll() { + return clientMapper.selectAll(); + } + + @Override + public void batchInsert(List clientEntityList) { + clientMapper.batchInsert(clientEntityList); + } +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java index 6f0d7cf3..754c2235 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterService.java @@ -26,6 +26,10 @@ */ public interface ClusterService { + void batchInsert(List clusterEntities); + + List selectAll(); + void addCluster(ClusterEntity cluster); List selectAllCluster(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java index b669c4e6..f4b7e9ab 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java @@ -33,6 +33,16 @@ public class ClusterServiceImpl implements ClusterService { @Autowired private ClusterMapper clusterMapper; + @Override + public void batchInsert(List clusterEntities) { + clusterMapper.batchInsert(clusterEntities); + } + + @Override + public List selectAll() { + return clusterMapper.selectAllCluster(); + } + @Override public void addCluster(ClusterEntity cluster) { clusterMapper.addCluster(cluster); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java index d2dea9e0..c05d5da2 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java @@ -29,6 +29,10 @@ */ public interface ConfigService { + List selectAll(); + + void batchInsert(List configEntityList); + String mapToYaml(Map stringMap); Integer addConfig(ConfigEntity configEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java index 9bab90c3..b8d32b45 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java @@ -36,6 +36,16 @@ public class ConfigServiceImpl implements ConfigService { @Autowired ConfigMapper configMapper; + @Override + public List selectAll() { + return configMapper.selectAll(); + } + + @Override + public void batchInsert(List configEntityList) { + configMapper.batchInsert(configEntityList); + } + @Override public String mapToYaml(Map stringMap) { Yaml yaml = new Yaml(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupService.java index 2afda6e9..1663632c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupService.java @@ -28,6 +28,10 @@ public interface GroupService { + List selectAll(); + + void batchInsert(List groupEntities); + List getGroupByClusterId(GroupEntity groupEntity); GroupEntity addGroup(GroupEntity groupEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java similarity index 91% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java index 3647a5a6..cfcfe31f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java @@ -15,12 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.group; +package org.apache.eventmesh.dashboard.console.service.group.Impl; import org.apache.eventmesh.dashboard.console.annotation.EmLog; import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity; import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper; +import org.apache.eventmesh.dashboard.console.service.group.GroupService; import org.apache.eventmesh.dashboard.console.service.groupmember.GroupMemberService; import java.sql.Timestamp; @@ -38,6 +39,16 @@ public class GroupServiceImpl implements GroupService { @Autowired GroupMemberService groupMemberService; + @Override + public List selectAll() { + return oprGroupMapper.selectAll(); + } + + @Override + public void batchInsert(List groupEntities) { + oprGroupMapper.batchInsert(groupEntities); + } + @EmLog(OprType = "search", OprTarget = "Group") @Override public List getGroupByClusterId(GroupEntity groupEntity) { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberService.java index 28f95168..25bdbeb1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberService.java @@ -27,6 +27,10 @@ */ public interface GroupMemberService { + List selectAll(); + + void batchInsert(List groupMemberEntities); + List getGroupMemberByClusterId(GroupMemberEntity groupMemberEntity); void addGroupMember(GroupMemberEntity groupMemberEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberServiceImp.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/Impl/GroupMemberServiceImp.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberServiceImp.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/Impl/GroupMemberServiceImp.java index d50173e2..2ce9fac1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberServiceImp.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/Impl/GroupMemberServiceImp.java @@ -15,12 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.groupmember; +package org.apache.eventmesh.dashboard.console.service.groupmember.Impl; import org.apache.eventmesh.dashboard.console.annotation.EmLog; import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity; import org.apache.eventmesh.dashboard.console.mapper.groupmember.OprGroupMemberMapper; +import org.apache.eventmesh.dashboard.console.service.groupmember.GroupMemberService; import java.util.List; @@ -33,6 +34,16 @@ public class GroupMemberServiceImp implements GroupMemberService { @Autowired OprGroupMemberMapper oprGroupMemberMapper; + @Override + public List selectAll() { + return oprGroupMemberMapper.selectAll(); + } + + @Override + public void batchInsert(List groupMemberEntities) { + oprGroupMemberMapper.batchInsert(groupMemberEntities); + } + @Override @EmLog(OprType = "View", OprTarget = "GroupMember") public List getGroupMemberByClusterId(GroupMemberEntity groupMemberEntity) { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java index 7b7ec07f..da6cd0f6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java @@ -32,6 +32,16 @@ public class RuntimeServiceImpl implements RuntimeService { @Autowired private RuntimeMapper runtimeMapper; + @Override + public void batchInsert(List runtimeEntities) { + runtimeMapper.batchInsert(runtimeEntities); + } + + @Override + public List selectAll() { + return runtimeMapper.selectAll(); + } + @Override public List getRuntimeByClusterId(Long clusterId) { RuntimeEntity runtimeEntity = new RuntimeEntity(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java index c4569cee..65f1a4e0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java @@ -26,6 +26,10 @@ */ public interface RuntimeService { + void batchInsert(List runtimeEntities); + + List selectAll(); + List getRuntimeByClusterId(Long cluster); void addRuntime(RuntimeEntity runtimeEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java index 4e4469bb..db992e2a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java @@ -32,6 +32,16 @@ public class StoreServiceImpl implements StoreService { @Autowired private StoreMapper storeMapper; + @Override + public List selectAll() { + return storeMapper.selectAll(); + } + + @Override + public void batchInsert(List storeEntities) { + storeMapper.batchInsert(storeEntities); + } + @Override public void addStore(StoreEntity storeEntity) { storeMapper.addStore(storeEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java index 9fdaf4f8..605b8b57 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/StoreService.java @@ -26,6 +26,10 @@ */ public interface StoreService { + List selectAll(); + + void batchInsert(List storeEntities); + void addStore(StoreEntity storeEntity); void deleteStoreByUnique(StoreEntity storeEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java index 2f8696da..3f0b986a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java @@ -26,6 +26,10 @@ */ public interface TopicService { + void batchInsert(List topicEntities); + + List selectAll(); + Integer selectTopicNumByCluster(Long clusterId); List getTopicList(TopicEntity topicEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java index 444de271..e15f7c48 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java @@ -37,6 +37,16 @@ public class TopicServiceImpl implements TopicService { OprGroupMemberMapper oprGroupMemberMapper; + @Override + public void batchInsert(List topicEntities) { + topicMapper.batchInsert(topicEntities); + } + + @Override + public List selectAll() { + return topicMapper.selectAll(); + } + @Override public Integer selectTopicNumByCluster(Long clusterId) { TopicEntity topicEntity = new TopicEntity(); diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql index 7c5e38b5..fa1ccb3a 100644 --- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql +++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql @@ -31,7 +31,8 @@ create table cluster run_state tinyint default 1 not null comment '运行状态, 0表示未监控, 1监控中,有注册中心,2:监控中,无注册中心', create_time timestamp default CURRENT_TIMESTAMP not null comment '接入时间', update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', - is_delete int default 0 not null comment '0', + status int default 1 not null comment '0', + store_type int default 0 not null, constraint uniq_name unique (name) ) @@ -53,14 +54,14 @@ create table config config_name varchar(192) default '' not null comment '配置名称', config_value text null comment '配置值', start_version varchar(64) default '' not null comment '配置开始使用的版本', - status int default 1 not null comment '1 正常 2 禁用', + status int default 1 not null comment '0 关闭 1 开启 ', + is_default int default 1 null, end_version varchar(64) default '' not null comment '配置结束使用的版本', diff_type int default -1 not null comment '差异类型', description varchar(1000) default '' not null comment '备注', edit int default 1 not null comment '是否可以编辑 1 不可编辑(程序获取) 2 可编辑', create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', - is_default int not null comment '是否是默认值,0默认,1自定义的', is_modify int default 0 not null, eventmesh_version varchar(64) default ' ' not null, constraint uniq_instance_type_instance_id_config_name @@ -72,7 +73,56 @@ create index idx_phy_id_instance_id on config (cluster_id, instance_id); -DROP TABLE IF EXISTS `runtime`; + +drop table if exists `group`; +create table `group` +( + id bigint unsigned auto_increment comment 'id' + primary key, + cluster_id bigint default -1 not null comment '集群id', + name varchar(192) collate utf8_bin default '' not null comment 'Group名称', + member_count int unsigned default '0' not null comment '成员数', + members text null comment 'group的member列表', + type tinyint not null comment 'group类型 0:consumer 1:producer', + state varchar(64) default '' not null comment '状态', + create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', + update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', + status int default 1 not null, + constraint uniq_cluster_phy_id_name + unique (cluster_id, name) +) + comment 'Group信息表'; + +create index cluster_id + on `group` (cluster_id, name); + + +drop table if exists group_member; +create table group_member +( + id bigint unsigned auto_increment comment 'id' + primary key, + cluster_id bigint default -1 not null comment '集群ID', + topic_name varchar(192) default '' not null comment 'Topic名称', + group_name varchar(192) default '' not null comment 'Group名称', + eventmesh_user varchar(192) default '' not null comment 'EventMesh用户', + state varchar(64) default '' not null comment '状态', + create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', + update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', + status int default 1 not null, + constraint uniq_cluster_topic_group + unique (cluster_id, topic_name, group_name) +) + comment 'GroupMember信息表'; + +create index cluster_id + on group_member (cluster_id, topic_name, group_name); + + + + + +drop table if exists runtime; create table runtime ( id bigint auto_increment comment 'id' @@ -84,11 +134,10 @@ create table runtime jmx_port int default -1 not null comment 'Jmx端口', start_timestamp bigint default -1 not null comment '启动时间', rack varchar(128) default '' not null comment 'Rack信息', - status int default 0 not null comment '状态: 1启用,0未启用', + status int default 1 not null comment '状态: 1启用,0未启用', create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', endpoint_map varchar(1024) default '' not null comment '监听信息', - is_delete int default 0 not null comment '0', constraint uniq_cluster_phy_id__host_port unique (cluster_id, host) ) @@ -114,11 +163,10 @@ create table store jmx_port int default -1 not null comment 'Jmx端口', start_timestamp bigint default -1 not null comment '启动时间', rack varchar(128) default '' not null comment 'Rack信息', - status int default 0 not null comment '状态: 1启用,0未启用', + status int default 1 not null comment '状态: 1启用,0未启用', create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', update_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间', endpoint_map varchar(1024) default '' not null comment '监听信息', - is_delete int default 0 not null, constraint uniq_cluster_phy_id__storage_id unique (cluster_id, store_id) ) @@ -141,7 +189,7 @@ CREATE TABLE `group` `state` varchar(64) NOT NULL DEFAULT '' COMMENT '状态', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `is_delete` int NOT NULL DEFAULT '0', + `status` int NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `uniq_cluster_phy_id_name` (`cluster_id`, `name`), KEY `cluster_id` (`cluster_id`, `name`) @@ -162,7 +210,7 @@ CREATE TABLE `group_member` `state` varchar(64) NOT NULL DEFAULT '' COMMENT '状态', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `is_delete` int NOT NULL DEFAULT '0', + `status` int NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `uniq_cluster_topic_group` (`cluster_id`, `topic_name`, `group_name`), KEY `cluster_id` (`cluster_id`, `topic_name`, `group_name`) @@ -178,7 +226,7 @@ CREATE TABLE `operation_log` `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '物理集群ID', `operation_type` varchar(192) NOT NULL DEFAULT '' COMMENT '操作类型,如:启动,停止,重启,添加,删除,修改', - `status` int NOT NULL DEFAULT '0' COMMENT '操作状态 0:未知,1:执行中,2:成功,3:失败', + `state` int NOT NULL DEFAULT '0' COMMENT '操作状态 0:未知,1:执行中,2:成功,3:失败', `content` varchar(1024) COMMENT '备注信息', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `end_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间', @@ -188,7 +236,7 @@ CREATE TABLE `operation_log` `is_delete` int NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `idx_cluster_phy_id` (`cluster_id`), - KEY `idx_status` (`status`) + KEY `idx_state` (`state`) ) ENGINE = InnoDB AUTO_INCREMENT = 68 DEFAULT CHARSET = utf8mb4, @@ -209,7 +257,7 @@ CREATE TABLE `topic` `description` varchar(1024) DEFAULT '' COMMENT '备注信息', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(尽量与Topic实际创建时间一致)', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间(尽量与Topic实际创建时间一致)', - `is_delete` int NOT NULL DEFAULT '0', + `status` int NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`), KEY `cluster_id` (`cluster_id`, `topic_name`) @@ -300,7 +348,7 @@ CREATE TABLE `health_check_result` `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查维度(0:未知, 1:Cluster, 2:Runtime, 3:Topic, 4:Storage)', `type_id` bigint(20) unsigned NOT NULL COMMENT '对应检查维度的实例id', `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群ID', - `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查状态(0:未通过,1:通过,2:正在检查,3:超时)', + `state` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查状态(0:未通过,1:通过,2:正在检查,3:超时)', `result_desc` varchar(1024) NOT NULL DEFAULT '' COMMENT '检查结果描述', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java index e36eb619..9ce9abd8 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java @@ -133,7 +133,7 @@ public void testEndExecute() { query.setClusterId(1L); query.setType(HealthCheckType.STORAGE.getNumber()); query.setTypeId(2L); - assertNotNull(healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getStatus()); + assertNotNull(healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getState()); } @Test @@ -147,7 +147,7 @@ public void testStartExecute() { query.setClusterId(1L); query.setType(HealthCheckType.STORAGE.getNumber()); query.setTypeId(1L); - assertEquals(1, healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getStatus()); + assertEquals(1, healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getState()); } @Test @@ -161,7 +161,7 @@ public void testTimeout() { query.setType(HealthCheckType.STORAGE.getNumber()); query.setTypeId(1L); assertEquals(HealthCheckStatus.TIMEOUT.getNumber(), - healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getStatus()); + healthDataService.queryHealthCheckResultByClusterIdAndTypeAndTypeId(query).get(0).getState()); } @Test diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java index 90047383..29a35113 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java @@ -44,7 +44,7 @@ public class TestOprLog { @Test public void testGroupServiceOprLog() { - GroupEntity groupEntity = new GroupEntity(null, 1L, "logTest", 0, null, 1, "OK", null, null); + GroupEntity groupEntity = new GroupEntity(null, 1L, "logTest", 0, null, 1, "OK", null, null, 0); GroupEntity groupEntity1 = groupService.addGroup(groupEntity); LogEntity logEntity = new LogEntity(null, 1L, "add", "Group", 2, groupEntity1.toString(), null, null, null, null); logEntity.setResult(groupEntity.toString()); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java index 30e66907..39e7ecfb 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java @@ -53,7 +53,7 @@ public void testSelectById() { healthCheckResultEntity.setId(1L); healthCheckResultEntity = healthCheckResultMapper.selectById(healthCheckResultEntity); assertEquals(1, healthCheckResultEntity.getId()); - assertEquals(0, healthCheckResultEntity.getStatus()); + assertEquals(0, healthCheckResultEntity.getState()); } @Test @@ -61,7 +61,7 @@ public void testSelectByClusterIdAndTypeAndTypeId() { HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "", 1); healthCheckResultEntity = healthCheckResultMapper.selectByClusterIdAndTypeAndTypeId(healthCheckResultEntity).get(0); assertEquals(1, healthCheckResultEntity.getId()); - assertEquals(0, healthCheckResultEntity.getStatus()); + assertEquals(0, healthCheckResultEntity.getState()); } @Test @@ -104,7 +104,7 @@ public void testUpdate() { HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "reason", 0); healthCheckResultMapper.update(healthCheckResultEntity); healthCheckResultEntity = healthCheckResultMapper.selectByClusterIdAndTypeAndTypeId(healthCheckResultEntity).get(0); - assertEquals(0, healthCheckResultEntity.getStatus()); + assertEquals(0, healthCheckResultEntity.getState()); } @Test @@ -117,8 +117,8 @@ public void testBatchUpdate() { healthCheckResultEntity1 = healthCheckResultMapper.selectById(healthCheckResultEntity1); healthCheckResultEntity2 = healthCheckResultMapper.selectById(healthCheckResultEntity2); - assertEquals(0, healthCheckResultEntity1.getStatus()); - assertEquals(0, healthCheckResultEntity2.getStatus()); + assertEquals(0, healthCheckResultEntity1.getState()); + assertEquals(0, healthCheckResultEntity2.getState()); } @Test @@ -130,13 +130,13 @@ public void testUpdateByClusterIdAndTypeAndTypeId() { List toBeUpdate = healthCheckResultMapper.getIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId( Arrays.asList(entity1, entity2)); - toBeUpdate.forEach(entity -> entity.setStatus(2)); + toBeUpdate.forEach(entity -> entity.setState(2)); healthCheckResultMapper.batchUpdate(toBeUpdate); entity1.setId(7L); - assertEquals(2, healthCheckResultMapper.selectById(entity1).getStatus()); + assertEquals(2, healthCheckResultMapper.selectById(entity1).getState()); entity2.setId(1L); - assertEquals(0, healthCheckResultMapper.selectById(entity2).getStatus()); + assertEquals(0, healthCheckResultMapper.selectById(entity2).getState()); } } \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java index 192c4e0f..c8625aae 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java @@ -23,7 +23,7 @@ public class TestClusterMapper { @Test public void testAddCluster() { ClusterEntity clusterEntity = - new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, null, null); + new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0); clusterMapper.addCluster(clusterEntity); ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); clusterEntity1.setUpdateTime(null); @@ -34,9 +34,9 @@ public void testAddCluster() { @Test public void testSelectAllCluster() { ClusterEntity clusterEntity = - new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, null, null); + new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0); ClusterEntity clusterEntity1 = - new ClusterEntity(null, "c1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, null, null); + new ClusterEntity(null, "c1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0); clusterMapper.addCluster(clusterEntity); clusterMapper.addCluster(clusterEntity1); List clusterEntities = clusterMapper.selectAllCluster(); @@ -46,7 +46,7 @@ public void testSelectAllCluster() { @Test public void testSelectClusterById() { ClusterEntity clusterEntity = - new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, null, null); + new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0); clusterMapper.addCluster(clusterEntity); ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); clusterEntity1.setCreateTime(null); @@ -57,7 +57,7 @@ public void testSelectClusterById() { @Test public void testUpdateCluster() { ClusterEntity clusterEntity = - new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, null, null); + new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0); clusterMapper.addCluster(clusterEntity); clusterEntity.setDescription("nothing"); clusterEntity.setName("cl2"); @@ -79,7 +79,7 @@ public void testUpdateCluster() { @Test public void testDeleteCluster() { ClusterEntity clusterEntity = - new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, null, null); + new ClusterEntity(null, "cl1", "registerList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, null, null, 0); clusterMapper.addCluster(clusterEntity); clusterMapper.deleteClusterById(clusterEntity); ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java index 41eca99f..6f26339a 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java @@ -41,7 +41,7 @@ public class GroupMapperTest { public List insertGroupData(String name) { List groupEntities = new ArrayList<>(); for (int i = 0; i < 10; i++) { - GroupEntity groupEntity = new GroupEntity(null, (long) i, name, 0, null, 1, "OK", null, null); + GroupEntity groupEntity = new GroupEntity(null, (long) i, name, 0, null, 1, "OK", null, null, 0); groupMapper.addGroup(groupEntity); groupEntities.add(groupEntity); } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java index 76fa8498..31d4ce45 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java @@ -41,7 +41,7 @@ public class GroupMemberMapperTest { public List insertGroupData(String topicName, String groupName) { List groupMemberEntities = new ArrayList<>(); for (int i = 0; i < 10; i++) { - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(null, (long) i, topicName, groupName, "admin", "active", null, null); + GroupMemberEntity groupMemberEntity = new GroupMemberEntity(null, (long) i, topicName, groupName, "admin", "active", null, null, 0); groupMemberMapper.addGroupMember(groupMemberEntity); groupMemberEntities.add(groupMemberEntity); } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java index 929953a5..940b1e3f 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java @@ -41,7 +41,7 @@ public class TopicMapperTest { public List insertGroupData(String topicName) { List topicEntities = new ArrayList<>(); for (int i = 0; i < 10; i++) { - TopicEntity topicEntity = new TopicEntity(null, (long) i, topicName, "10", "10", 100L, 1, "testTopic", null, null); + TopicEntity topicEntity = new TopicEntity(null, (long) i, topicName, "10", "10", 100L, 1, "testTopic", null, null, 0); topicMapper.addTopic(topicEntity); topicEntities.add(topicEntity); } diff --git a/eventmesh-dashboard-console/src/test/resources/health-test.sql b/eventmesh-dashboard-console/src/test/resources/health-test.sql index 45c3aebc..26400206 100644 --- a/eventmesh-dashboard-console/src/test/resources/health-test.sql +++ b/eventmesh-dashboard-console/src/test/resources/health-test.sql @@ -17,10 +17,10 @@ DELETE FROM `eventmesh_dashboard_test`.health_check_result WHERE TRUE; ALTER TABLE `eventmesh_dashboard_test`.health_check_result AUTO_INCREMENT = 1; -insert into `eventmesh_dashboard_test`.health_check_result (id, type, type_id, cluster_id, status, result_desc, create_time, update_time) -values (1, 1, 1, 1, 0, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), - (2, 2, 2, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), - (3, 3, 3, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), - (4, 4, 4, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), - (5, 1, 2, 1, 1, '', '2024-02-04 18:56:50', '2024-02-02 19:33:13'), - (6, 4, 2, 2, 0, '', '2024-02-04 18:56:50', '2024-02-02 19:33:13'); \ No newline at end of file +insert into `eventmesh_dashboard_test`.health_check_result (id, type, type_id, cluster_id, state, result_desc, create_time, update_time) +values (1, 1, 1, 1, 0, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), + (2, 2, 2, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), + (3, 3, 3, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), + (4, 4, 4, 1, 1, '', '2024-02-02 18:56:50', '2024-02-02 18:56:50'), + (5, 1, 2, 1, 1, '', '2024-02-04 18:56:50', '2024-02-02 19:33:13'), + (6, 4, 2, 2, 0, '', '2024-02-04 18:56:50', '2024-02-02 19:33:13'); \ No newline at end of file