From d3ffcb5875c50276ee3ef2e3fda1444d5cd540b2 Mon Sep 17 00:00:00 2001 From: githublaohu <2372554140@qq.com> Date: Wed, 12 Jun 2024 23:34:30 +0800 Subject: [PATCH] Refactor RemotingService and `SyncFrom...` interfaces (#146) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(*)1. 完成项目设计 2. 完成项目与模块搭建 * fix(core):1. 重构 同步模块 2. 重构 remote 模块 * fix(*):1. 格式化代码 。2. 第一次整理代码 * 1. 解决冲突 * 1. 解决冲突 * fix(*):1. 删除多余的代码 * 1. 解决冲突 * fix(ci): 1. 关闭 ci 的 test,重构完在打开 * fix(*):1. 完成控制的重构 * fix(*):1. 解决冲突 * fix(*):1. 解决冲突 * fix(*):1. 解决冲突 * fix(*):1. 解决冲突 --------- Co-authored-by: laohu <2732554140@qq.com> --- .mvn/wrapper/maven-wrapper.jar | Bin 0 -> 62547 bytes README.md | 2 +- README.zh-CN.md | 9 + .../dashboard/common/constant/ApiPrefix.java | 1 + .../common/constant/StoreTypeConstant.java | 1 + .../constant/health/HealthConstant.java | 1 + .../dashboard/common/dto/Result.java | 6 +- .../dashboard/common/enums/BusinessType.java | 28 + .../common/enums/ClusterTrusteeshipType.java | 30 + .../dashboard/common/enums/ClusterType.java | 124 ++++ .../dashboard/common/enums/RemotingType.java | 36 + .../common/enums/ResetOffsetMode.java | 29 + .../common/model/metadata/AclMetadata.java | 2 + .../common/model/metadata/ClientMetadata.java | 2 + .../model/metadata/ClusterMetadata.java | 8 + .../metadata/ClusterRelationshipMetadata.java | 26 +- .../common/model/metadata/ConfigMetadata.java | 2 + .../common/model/metadata/GroupMetadata.java | 2 + .../common/model/metadata/MetadataConfig.java | 3 + .../model/metadata/RegistryMetadata.java | 2 + .../model/metadata/RuntimeMetadata.java | 2 + .../common/model/metadata/TopicMetadata.java | 2 + .../model/remoting/BaseGlobalResult.java | 22 + .../common/model/remoting/GlobalRequest.java | 26 + .../common/model/remoting/GlobalResult.java | 28 +- .../common/model/remoting/RemotingAction.java | 29 + .../model/remoting/RemotingOperate.java | 27 + .../model/remoting/acl/CreateAclRequest.java | 1 + .../model/remoting/acl/GetAclsRequest.java | 5 +- .../model/remoting/acl/GetAclsResult.java | 8 +- .../remoting/config/AddConfigRequest.java | 22 +- .../remoting/config/AddConfigResponse.java | 9 +- .../remoting/config/AddConfigResult.java | 22 + .../model/remoting/config/ConfigType.java | 24 + .../remoting/config/DeleteConfigRequest.java | 28 + .../remoting/config/DeleteConfigResponse.java | 22 + .../remoting/config/DeleteConfigResult.java | 22 + .../remoting/config/GetConfigRequest.java | 7 +- .../remoting/config/GetConfigResult.java | 1 + .../remoting/config/UpdateConfigRequest.java | 27 + .../remoting/config/UpdateConfigResponse.java | 22 + .../remoting/config/UpdateConfigResult.java | 22 + .../model/remoting/group/GetGroupResult.java | 4 +- .../remoting/offset/GetOffsetRequest.java | 1 + .../remoting/offset/ResetOffsetRequest.java | 19 +- .../remoting/offset/ResetOffsetResult.java | 1 + .../remoting/runtime/GetRuntimeRequest.java | 4 +- .../remoting/runtime/GetRuntimeResult.java | 4 +- .../remoting/topic/CreateTopicRequest.java | 12 +- .../remoting/topic/CreateTopicResponse.java | 1 + .../remoting/topic/CreateTopicResult.java | 12 +- .../remoting/topic/DeleteTopicRequest.java | 1 + .../remoting/topic/DeleteTopicResponse.java | 1 + .../remoting/topic/DeleteTopicResult.java | 12 +- .../remoting/topic/GetTopicsRequest.java | 4 +- .../remoting/topic/GetTopicsResponse.java | 2 +- .../model/remoting/topic/GetTopicsResult.java | 14 +- .../remoting/user/DeleteUserResponse.java | 1 + .../model/remoting/user/GetUserRequest.java | 1 + eventmesh-dashboard-console/pom.xml | 12 +- .../dashboard/console/cache/ClusterCache.java | 99 --- .../dashboard/console/cache/RuntimeCache.java | 60 -- .../controller/ConnectionController.java | 4 +- .../controller/SubscriptionController.java | 11 +- .../{ => cluster}/AclController.java | 6 +- .../ClientDataController.java} | 32 +- .../controller/cluster/ClusterController.java | 106 +++ .../ClusterRelationshipController.java | 59 ++ .../{ => cluster}/InstanceUserController.java | 6 +- .../cluster/NetConnectionController.java | 39 + .../controller/cluster/RuntimeController.java | 109 +++ .../{ => function}/ConfigController.java | 6 +- .../{ => function}/HealthController.java | 11 +- .../{ => function}/LogController.java | 6 +- .../OverviewController.java} | 28 +- .../controller/message/GroupController.java | 58 ++ .../message/GroupRelationshipController.java | 47 ++ .../message/OffsetOperateController.java | 57 ++ .../{ => message}/TopicController.java | 53 +- .../console/entity/{base => }/BaseEntity.java | 14 +- .../entity/{config => }/DefaultConfigKey.java | 2 +- .../entity/{storage => }/StoreEntity.java | 16 +- .../entity/{acl => cluster}/AclEntity.java | 20 +- .../{client => cluster}/ClientEntity.java | 26 +- .../ClusterAndRelationshipEntity.java} | 25 +- .../console/entity/cluster/ClusterEntity.java | 42 +- .../cluster/ClusterRelationshipEntity.java | 36 + .../ConnectionEntity.java | 25 +- .../InstanceUserEntity.java | 10 +- .../entity/cluster/NetConnectionEntity.java | 52 ++ .../console/entity/cluster/RuntimeEntity.java | 50 ++ .../console/entity/config/ConfigEntity.java | 135 ---- .../entity/connector/ConnectorEntity.java | 8 +- .../console/entity/function/ConfigEntity.java | 70 ++ .../HealthCheckResultEntity.java | 12 +- .../entity/{log => function}/LogEntity.java | 6 +- .../console/entity/group/GroupEntity.java | 68 -- .../console/entity/message/GroupEntity.java | 45 ++ .../GroupMemberEntity.java | 16 +- .../{topic => message}/TopicEntity.java | 29 +- .../console/entity/meta/MetaEntity.java | 83 --- .../console/entity/runtime/RuntimeEntity.java | 70 -- .../exception/GlobalExceptionHandler.java | 3 +- .../function/health/CheckResultCache.java | 8 +- .../function/health/HealthExecutor.java | 12 +- .../function/health/HealthService.java | 18 +- .../health/annotation/HealthCheckType.java | 2 + .../health/callback/HealthCheckCallback.java | 2 + .../health/check/HealthCheckService.java | 8 +- .../rocketmq4/Rocketmq4BrokerCheck.java | 2 +- .../rocketmq4/Rocketmq4NameServerCheck.java | 2 +- .../rocketmq4/Rocketmq4TopicCheck.java | 6 +- .../function/metadata/MetadataManager.java | 222 ------ .../metadata/MetadataServiceWrapper.java | 8 +- ...rvice.java => SyncRelationshipConfig.java} | 15 +- .../handler/MetadataHandlerWrapper.java | 11 +- .../db/ClusterMetadataHandlerToDbImpl.java | 21 +- .../db/ConfigMetadataHandlerToDbImpl.java | 27 +- .../db/ConnectionMetadataHandlerToDbImpl.java | 154 ---- .../db/GroupMetadataHandlerToDbImpl.java | 25 +- .../db/RegistryMetadataHandlerToDbImpl.java | 57 -- .../db/RuntimeMetadataHandlerToDbImpl.java | 57 +- .../db/TopicMetadataHandlerToDbImpl.java | 21 +- .../syncservice/SyncDataServiceWrapper.java | 17 +- .../cluster/ConfigSyncFromClusterService.java | 97 --- .../cluster/GroupSyncFromClusterService.java | 46 -- .../RuntimeSyncFromClusterService.java | 93 --- .../cluster/TopicSyncFromClusterService.java | 87 --- .../db/TopicSyncFromDbService.java | 43 -- .../TopicMetadataHandlerToClusterImpl.java | 57 -- .../dashboard/console/log/OprLog.java | 7 +- .../mapper/{acl => cluster}/AclMapper.java | 4 +- .../{client => cluster}/ClientMapper.java | 6 +- .../console/mapper/cluster/ClusterMapper.java | 56 +- .../cluster/ClusterRelationshipMapper.java | 65 ++ .../ConnectionMapper.java | 4 +- .../InstanceUserMapper.java | 10 +- .../mapper/cluster/NetConnectionMapper.java | 40 ++ .../{runtime => cluster}/RuntimeMapper.java | 10 +- .../{config => function}/ConfigMapper.java | 4 +- .../HealthCheckResultMapper.java | 4 +- .../{log => function}/OprLogMapper.java | 4 +- .../{group => message}/OprGroupMapper.java | 36 +- .../OprGroupMemberMapper.java | 4 +- .../{topic => message}/TopicMapper.java | 77 +- .../console/mapper/meta/MetaMapper.java | 62 -- .../console/mapper/storage/StoreMapper.java | 2 +- .../cluster/ClientDataControllerMapper.java | 35 + .../cluster/ClusterControllerMapper.java | 37 + .../cluster/GroupControllerMapper.java | 38 + .../cluster/RuntimeControllerMapper.java | 44 ++ .../message/TopicControllerMapper.java | 44 ++ .../dashboard/console/modle/ClusterIdDTO.java | 30 + .../dashboard/console/modle/IdDTO.java | 26 + .../modle/cluster/ClusterHomeListVO.java | 35 + .../modle/cluster/CreateClusterDTO.java | 50 ++ .../cluster/client/SelectByClusterIdDTO.java | 25 + .../cluster/runtime/CrateRuntimeDTO.java | 42 ++ .../QueryRuntimeListByClusterIdDTO.java} | 8 +- .../dto/connection/AddConnectorConfigDTO.java | 2 +- .../console/modle/function/OverviewDTO.java | 32 + .../console/modle/function/OverviewType.java | 26 + .../QueryOffsetByMessageMetadataDTO.java | 33 + .../modle/message/offset/ResetOffsetDTO.java | 39 + .../console/service/DataServiceWrapper.java | 20 +- .../console/service/OverviewService.java | 29 + .../service/{acl => cluster}/AclService.java | 4 +- .../ClientDataService.java | 8 +- .../cluster/ClusterRelationshipService.java | 42 ++ .../service/cluster/ClusterService.java | 19 +- .../ConnectionDataService.java | 6 +- .../InstanceUserService.java | 4 +- .../{runtime => cluster}/RuntimeService.java | 13 +- .../Impl => cluster/impl}/AclServiceImpl.java | 8 +- .../impl}/ClientDataServiceImpl.java | 19 +- .../impl/ClusterRelationshipServiceImpl.java | 60 ++ .../cluster/impl/ClusterServiceImpl.java | 72 +- .../impl}/InstanceUserServiceImpl.java | 10 +- .../impl}/RuntimeServiceImpl.java | 33 +- .../synchronous/SyncConnectorConfigTask.java | 95 --- .../synchronous/SyncRuntimeConfigTask.java | 97 --- .../synchronous/SyncStoreConfigTask.java | 96 --- .../synchronous/SyncTopicConfigTask.java | 97 --- .../ConnectionDataServiceDatabaseImpl.java | 201 ------ .../{config => function}/ConfigService.java | 5 +- .../HealthDataService.java | 7 +- .../HealthDataServiceMemoryStorage.java | 16 +- .../Impl/ConfigServiceImpl.java | 10 +- .../Impl}/HealthDataServiceDatabaseImpl.java | 19 +- .../Impl}/LogServiceImpl.java | 7 +- .../service/{log => function}/LogService.java | 4 +- .../GroupMemberService.java | 6 +- .../{group => message}/GroupService.java | 6 +- .../{topic => message}/TopicService.java | 22 +- .../impl}/GroupMemberServiceImp.java | 10 +- .../impl}/GroupServiceImpl.java | 22 +- .../impl}/TopicServiceImpl.java | 70 +- .../service/store/Impl/StoreServiceImpl.java | 2 +- .../console/service/store/StoreService.java | 2 +- .../spring/support/FunctionManager.java | 9 - .../main/resources/eventmesh-dashboard.sql | 664 ++++++++---------- .../EventMeshDashboardApplicationTest.java | 31 +- .../console/cache/ClusterCacheBase.java | 46 -- .../console/cache/ClusterCacheTest.java | 53 -- .../function/health/HealthExecutorTest.java | 15 +- .../function/health/HealthServiceTest.java | 2 +- .../metadata/MetadataManagerTest.java | 159 ----- .../ClusterMetadataHandlerToDbImplTest.java | 69 -- .../db/ConfigMetadataHandlerToDbImplTest.java | 2 +- ...ConnectionMetadataHandlerToDbImplTest.java | 10 +- .../db/GroupMetadataHandlerToDbImplTest.java | 6 +- .../RegistryMetadataHandlerToDbImplTest.java | 78 -- .../RuntimeMetadataHandlerToDbImplTest.java | 6 +- .../db/TopicMetadataHandlerToDbImplTest.java | 10 +- .../TopicSyncFromClusterServiceTest.java | 82 --- .../health/HealthServiceIntegrateTest.java | 20 +- .../console/linkage/log/TestOprLog.java | 21 +- .../console/mapper/acl/AclMapperTest.java | 122 ---- .../mapper/client/ClientMapperTest.java | 95 --- .../connection/ConnectionMapperTest.java | 123 ---- .../mapper/connector/ConnectorMapperTest.java | 127 ---- .../health/HealthCheckResultMapperTest.java | 142 ---- .../instanceuser/InstanceUserMapperTest.java | 89 --- .../console/mapper/meta/MetaMapperTest.java | 49 -- ...ConnectionDataServiceDatabaseImplTest.java | 3 +- .../spring/support/FunctionManagerTest.java | 1 - .../unit/cluster/TestClusterMapper.java | 105 --- .../console/unit/config/TestConfigMapper.java | 111 --- .../console/unit/group/GroupMapperTest.java | 118 ---- .../groupmember/GroupMemberMapperTest.java | 158 ----- .../unit/runtime/TestRuntimeMapper.java | 74 -- .../console/unit/store/TestStoreMapper.java | 79 --- .../console/unit/topic/TopicMapperTest.java | 133 ---- eventmesh-dashboard-core/pom.xml | 6 +- .../dashboard/core/cluster/ClusterDO.java | 35 + .../core/cluster/ClusterDoCache.java | 94 +++ .../dashboard/core/cluster/ColonyDO.java | 56 ++ .../core/config/AdminProperties.java | 4 + .../core/function/SDK/SDKManager.java | 58 +- .../core/function/SDK/SDKTypeEnum.java | 2 + .../config/CreateRocketmqAdminSDKConfig.java | 34 + .../SDK/config/CreateRocketmqConfig.java | 8 +- .../SDK/operation/EtcdSDKOperation.java | 8 +- .../rocketmq/RocketMQAdminOperation.java | 54 ++ .../RocketMQProduceSDKOperation.java | 2 +- .../RocketMQPushConsumerSDKOperation.java | 4 +- .../RocketMQRemotingSDKOperation.java | 2 +- .../RuntimeGrpcConsumerSDKOperation.java | 2 +- .../RuntimeGrpcProducerSDKOperation.java | 2 +- .../RuntimeHttpConsumerSDKOperation.java | 2 +- .../RuntimeHttpProducerSDKOperation.java | 2 +- .../{ => runtime}/RuntimeSDKOperation.java | 4 +- .../RuntimeTcpCloudEventSDKOperation.java | 2 +- .../RuntimeTcpEventMeshSDKOperation.java | 2 +- .../RuntimeTcpOpenMessageSDKOperation.java | 2 +- .../function/SDK/wrapper/NacosSDKWrapper.java | 6 +- .../subscription/NacosSubscriptionCore.java | 5 +- .../core/metadata}/MetadataHandler.java | 39 +- .../core/metadata/MetadataSyncManager.java | 245 +++++++ .../cluster/AbstractMetadataHandler.java | 57 ++ .../cluster/AclSyncFromClusterService.java | 30 +- .../cluster/ConfigSyncFromClusterService.java | 70 ++ .../cluster/GroupSyncFromClusterService.java | 65 ++ .../InstanceUserFromClusterService.java | 2 +- .../RuntimeSyncFromClusterService.java | 58 ++ .../cluster/TopicSyncFromClusterService.java | 36 +- .../remoting/AbstractRemotingService.java | 99 +++ .../core/remoting/RemotingManager.java | 391 +++++++++++ .../RemotingServiceRuntimeConfig.java | 37 + .../AbstractRocketMQRemotingService.java | 112 +++ .../rocketmq/RocketMQAclRemotingService.java | 46 ++ .../RocketMQClientRemotingService.java | 17 +- .../RocketMQConfigRemotingService.java | 43 ++ .../RocketMQGroupRemotingService.java | 30 + .../RocketMQOffsetRemotingService.java | 38 + .../RocketMQSubscriptionRemotingService.java | 30 + .../RocketMQTopicRemotingService.java | 81 +++ .../rocketmq/RocketMQUserRemotingService.java | 42 ++ .../core/store/RocketmqTopicCore.java | 17 +- .../operation/EtcdSDKCreateOperationTest.java | 3 +- .../RuntimeGrpcConsumerSDKOperationTest.java | 1 + .../RuntimeGrpcProducerSDKOperationTest.java | 1 + .../RuntimeHttpConsumerSDKOperationTest.java | 1 + .../RuntimeHttpProducerSDKOperationTest.java | 1 + .../operation/RuntimeSDKOperationTest.java | 1 + .../RuntimeTcpCloudEventSDKOperationTest.java | 1 + .../RuntimeTcpEventMeshSDKOperationTest.java | 1 + ...RuntimeTcpOpenMessageSDKOperationTest.java | 2 + .../meta/runtime/NacosRuntimeCoreTest.java | 5 +- .../metadata/MetadataSyncManagerTest.java | 136 ++++ .../core/remoting/RemotingManagerTest.java | 166 +++++ .../service/meta/ConnectionCore.java | 5 +- .../service/meta/SubscriptionCore.java | 5 +- .../remoting/ClientRemotingService.java | 4 +- .../remoting/ConfigRemotingService.java | 26 +- .../service/remoting/MetaRemotingService.java | 1 + .../remoting/RemotingIntegrationService.java | 26 + .../service/remoting/RemotingOperate.java | 27 + .../service/remoting/RemotingServiceType.java | 23 + .../remoting/RuntimeRemotingService.java | 29 + pom.xml | 99 +++ style/checkStyle.xml | 4 +- 302 files changed, 5562 insertions(+), 5457 deletions(-) create mode 100644 .mvn/wrapper/maven-wrapper.jar create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java => eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java (67%) create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java => eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java (65%) create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java => eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java (67%) rename eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java => eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java (87%) create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{ => cluster}/AclController.java (89%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{ClusterController.java => cluster/ClientDataController.java} (50%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{ => cluster}/InstanceUserController.java (90%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{ => function}/ConfigController.java (93%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{ => function}/HealthController.java (83%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{ => function}/LogController.java (87%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{RuntimeController.java => function/OverviewController.java} (63%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/{ => message}/TopicController.java (55%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{base => }/BaseEntity.java (81%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{config => }/DefaultConfigKey.java (94%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{storage => }/StoreEntity.java (77%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{acl => cluster}/AclEntity.java (82%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{client => cluster}/ClientEntity.java (75%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{service/config/instanceoperation/ConnectorConfigService.java => entity/cluster/ClusterAndRelationshipEntity.java} (65%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{connection => cluster}/ConnectionEntity.java (75%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{instanceuser => cluster}/InstanceUserEntity.java (79%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{health => function}/HealthCheckResultEntity.java (90%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{log => function}/LogEntity.java (89%) delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{groupmember => message}/GroupMemberEntity.java (74%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{topic => message}/TopicEntity.java (64%) delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManager.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/{syncservice/SyncDataService.java => SyncRelationshipConfig.java} (78%) delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/ConfigSyncFromClusterService.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/GroupSyncFromClusterService.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/RuntimeSyncFromClusterService.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterService.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/db/TopicSyncFromDbService.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/optration/TopicMetadataHandlerToClusterImpl.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{acl => cluster}/AclMapper.java (94%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{client => cluster}/ClientMapper.java (93%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{connection => cluster}/ConnectionMapper.java (97%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{instanceuser => cluster}/InstanceUserMapper.java (84%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{runtime => cluster}/RuntimeMapper.java (91%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{config => function}/ConfigMapper.java (97%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{health => function}/HealthCheckResultMapper.java (97%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{log => function}/OprLogMapper.java (95%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{group => message}/OprGroupMapper.java (94%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{groupmember => message}/OprGroupMemberMapper.java (96%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/{topic => message}/TopicMapper.java (68%) delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/{dto/runtime/GetRuntimeListDTO.java => cluster/runtime/QueryRuntimeListByClusterIdDTO.java} (82%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{acl => cluster}/AclService.java (89%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{client => cluster}/ClientDataService.java (85%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{connection => cluster}/ConnectionDataService.java (89%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{instanceuser => cluster}/InstanceUserService.java (89%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{runtime => cluster}/RuntimeService.java (74%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{acl/Impl => cluster/impl}/AclServiceImpl.java (85%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{client/Impl => cluster/impl}/ClientDataServiceImpl.java (80%) create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{instanceuser/Impl => cluster/impl}/InstanceUserServiceImpl.java (83%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{runtime/Impl => cluster/impl}/RuntimeServiceImpl.java (67%) delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{config => function}/ConfigService.java (93%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{health => function}/HealthDataService.java (89%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{health => function}/HealthDataServiceMemoryStorage.java (83%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{config => function}/Impl/ConfigServiceImpl.java (96%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{health/impl => function/Impl}/HealthDataServiceDatabaseImpl.java (90%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{log => function/Impl}/LogServiceImpl.java (86%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{log => function}/LogService.java (89%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{groupmember => message}/GroupMemberService.java (87%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{group => message}/GroupService.java (86%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{topic => message}/TopicService.java (60%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{groupmember/Impl => message/impl}/GroupMemberServiceImp.java (88%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{group/Impl => message/impl}/GroupServiceImpl.java (83%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{topic => message/impl}/TopicServiceImpl.java (64%) delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManagerTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterServiceTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => rocketmq}/RocketMQProduceSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => rocketmq}/RocketMQPushConsumerSDKOperation.java (96%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => rocketmq}/RocketMQRemotingSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeGrpcConsumerSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeGrpcProducerSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeHttpConsumerSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeHttpProducerSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeTcpCloudEventSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeTcpEventMeshSDKOperation.java (99%) rename eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/{ => runtime}/RuntimeTcpOpenMessageSDKOperation.java (99%) rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata}/MetadataHandler.java (70%) create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata}/cluster/AclSyncFromClusterService.java (60%) create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java rename {eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata}/cluster/InstanceUserFromClusterService.java (91%) create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java (50%) create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java => eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java (68%) create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java create mode 100644 eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java create mode 100644 eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java create mode 100644 eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java create mode 100644 eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java create mode 100644 eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java create mode 100644 eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java create mode 100644 eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..cb28b0e37c7d206feb564310fdeec0927af4123a GIT binary patch literal 62547 zcmb5V1CS=sk~Z9!wr$(CZEL#U=Co~N+O}=mwr$(Cds^S@-Tij=#=rmlVk@E|Dyp8$ z$UKz?`Q$l@GN3=8fq)=^fVx`E)Pern1@-q?PE1vZPD);!LGdpP^)C$aAFx&{CzjH` zpQV9;fd0PyFPNN=yp*_@iYmRFcvOrKbU!1a*o)t$0ex(~3z5?bw11HQYW_uDngyer za60w&wz^`W&Z!0XSH^cLNR&k>%)Vr|$}(wfBzmSbuK^)dy#xr@_NZVszJASn12dw; z-KbI5yz=2awY0>OUF)&crfPu&tVl|!>g*#ur@K=$@8N05<_Mldg}X`N6O<~3|Dpk3 zRWb!e7z<{Mr96 z^C{%ROigEIapRGbFA5g4XoQAe_Y1ii3Ci!KV`?$ zZ2Hy1VP#hVp>OOqe~m|lo@^276Ik<~*6eRSOe;$wn_0@St#cJy}qI#RP= zHVMXyFYYX%T_k3MNbtOX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C&BqoKWmv;|{O|4d#Nay<)gkxBr^^N48(VDF7Sj#H1i3>9138 zkhxAU7;M)I18&d!Yw!V9zQA0tp(G4<8U5GX{YoYCQ?p56FxcD-2FwO5fqyx@__=$L zeK6Sg3>XQv)qz1?zW-k$_j`-)tf+yRU_%fXrenc>$^70d1Q-W?T#vy;6#Y-Q-<2)+ z5iTl6MA7j9m&oBhRXTKr*$3gec z3E;zX457RGZwUvD$l&8e42Qb^cbq>zYy@ive8`2N9vk=#6+AQlZZ7qk=?(ap1q0n0 z{B9Fte-{Gi-Tvax1)M+d1}Fyg@9X~sh1m|hsDcZuYOnxriBPN;z)q3<=-yBN2iM6V A?*IS* literal 0 HcmV?d00001 diff --git a/README.md b/README.md index 09e6c118..0f3b3708 100644 --- a/README.md +++ b/README.md @@ -85,4 +85,4 @@ docker build -t yourname/eventmesh-dashboard -f docker/Dockerfile . ``` docker run -d --name eventmesh-dashboard -p 8080:8080 yourname/eventmesh-dashboard -``` \ No newline at end of file +``` diff --git a/README.zh-CN.md b/README.zh-CN.md index 167f86e6..cb9f70c0 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -86,3 +86,12 @@ docker build -t yourname/eventmesh-dashboard -f docker/Dockerfile . ``` docker run -d --name eventmesh-dashboard -p 8080:8080 yourname/eventmesh-dashboard ``` + +### 开发准备 +1. 配置格式化 + 1. 后端格式文档地址:https://eventmesh.apache.org/zh/community/contribute/contribute/ + 2. 前端使用 eslint +2. 配置协议头工具 license-eye。 + 1. 检查命令:license-eye header check + 2. 使用命令:license-eye header fix + 3. 下载地址: https://skywalking.apache.org/downloads/ \ No newline at end of file diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java index 14c3e050..df5f0715 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.constant; public class ApiPrefix { + public static final String API_PREFIX = "/eventmesh-dashboard/"; public static final String API_V1_PREFIX = API_PREFIX + "v1/"; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java index dfa3711c..665024af 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.constant; public class StoreTypeConstant { + public static final String STORE_TYPE_TYPE_UNKNOWN = "unknown"; public static final String STORE_TYPE_STANDALONE = "standalone"; public static final String STORE_TYPE_REDIS = "redis"; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java index bc3818b7..dd724889 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.constant.health; public class HealthConstant { + public static final String NEW_LINE_ENDING = "\n"; public static final String RUNTIME_CHECK_TOPIC = "eventmesh-dashboard-healthcheck-topic"; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java index 1ea4c520..e34fd920 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java @@ -70,8 +70,7 @@ public static Result success(T data) { } /** - * The request is valid and the result is returned in {@link ResponseEntity}. - * Logic issues should use 422 Unprocessable Entity instead of 200 OK. + * The request is valid and the result is returned in {@link ResponseEntity}. Logic issues should use 422 Unprocessable Entity instead of 200 OK. */ public static ResponseEntity> ok() { return ResponseEntity.ok(new Result<>(new StatusMessage(Status.SUCCESS))); @@ -126,8 +125,7 @@ public StatusMessage(BaseException e) { } /** - * Only recommended for returning successful results, - * the stack trace cannot be displayed when returning unsuccessful results. + * Only recommended for returning successful results, the stack trace cannot be displayed when returning unsuccessful results. */ public StatusMessage(Status status) { this.status = status.name(); diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java new file mode 100644 index 00000000..41ca551a --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/BusinessType.java @@ -0,0 +1,28 @@ +/* + * 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.common.enums; + +/** + * 业务类型, + * storage:可选值(rocketmq,pravega,mongodb,pulsar,redis,kafka,knative,rabbitmq), + * sinkConnector:可选值(rocketmq,spring,pravega,wechat,openfunction,file,knative,pulsar,lark,slack,rabbitmq,redis,mongodb,dingtalk) + * sourceConnector:可选值(rocketmq,spring,pravega,openfunction,jdbc,file,http,wecom,knative,pulsar,prometheus,rabbitmq,redis,mongodb)', + */ +public enum BusinessType { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java new file mode 100644 index 00000000..44b852d1 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java @@ -0,0 +1,30 @@ +/* + * 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.common.enums; + +public enum ClusterTrusteeshipType { + + FIRE_AND_FORGET_TRUSTEESHIP, + + TRUSTEESHIP, + + REVERSE, + + NO_TRUSTEESHIP; + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java new file mode 100644 index 00000000..41d918fb --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java @@ -0,0 +1,124 @@ +/* + * 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.common.enums; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import lombok.Getter; + +public enum ClusterType { + + DEFAULT(1), + + EVENTMESH(20), + + STORAGE(21), + + DEFAULT_TYPE_NAME(1), + + CLUSTER(1), + + META(2), + + RUNTIME(3), + + + RUNTIME_EVENT_RUNTIME(ClusterType.META.code + 1), + + RUNTIME_ROCKETMQ_BROKER(ClusterType.META.code + 31), + + META_TYPE_ETCD(ClusterType.META.code + 1), + + META_TYPE_NACOS(ClusterType.META.code + 2), + + META_TYPE_ROCKETMQ_NAMESERVER(ClusterType.META.code + 31), + + + EVENTMESH_CLUSTER(EVENTMESH, EVENTMESH, CLUSTER, DEFAULT, RemotingType.EVENT_MESH_RUNTIME), + + EVENTMESH_RUNTIME(EVENTMESH, EVENTMESH, RUNTIME, DEFAULT, RemotingType.EVENT_MESH_RUNTIME), + + EVENTMESH_META_ETCD(EVENTMESH, EVENTMESH, META, META_TYPE_ETCD, RemotingType.EVENT_MESH_ETCD), + + EVENTMESH_META_NACOS(EVENTMESH, EVENTMESH, META, META_TYPE_NACOS, RemotingType.EVENT_MESH_NACOS), + + STORAGE_ROCKETMQ(ClusterType.STORAGE.code + 1), + + STORAGE_ROCKETMQ_CLUSTER(STORAGE, STORAGE_ROCKETMQ, CLUSTER, DEFAULT, RemotingType.ROCKETMQ), + + STORAGE_ROCKETMQ_NAMESERVER(STORAGE, STORAGE_ROCKETMQ, META, DEFAULT, RemotingType.ROCKETMQ_NAMESERVER), + + STORAGE_ROCKETMQ_BROKER(STORAGE, STORAGE_ROCKETMQ, RUNTIME, DEFAULT, RemotingType.ROCKETMQ); + + + public static final List STORAGE_TYPES = getStorage(); + @Getter + private ClusterType eventmeshNodeType; + @Getter + private ClusterType assemblyName; + @Getter + private ClusterType assemblyNodeType; + @Getter + private ClusterType assemblyBusiness; + @Getter + private RemotingType remotingType; + @Getter + private int code; + + ClusterType(int code) { + this.code = code; + } + + + ClusterType(ClusterType eventmeshNodeType, ClusterType assemblyName, ClusterType assemblyNodeType, ClusterType assemblyBusiness, + RemotingType remotingType) { + this.eventmeshNodeType = eventmeshNodeType; + this.assemblyName = assemblyName; + this.assemblyNodeType = assemblyNodeType; + this.assemblyBusiness = assemblyBusiness; + this.remotingType = remotingType; + } + + private static List getStorage() { + List list = new ArrayList<>(); + for (ClusterType clusterType : ClusterType.values()) { + if (Objects.equals(clusterType.eventmeshNodeType, ClusterType.STORAGE) && Objects.equals(clusterType.assemblyNodeType, + ClusterType.CLUSTER)) { + list.add(clusterType); + } + } + return list; + } + + public boolean isMainCluster() { + return Objects.equals(this, ClusterType.EVENTMESH_CLUSTER) || Objects.equals(this.assemblyNodeType, ClusterType.CLUSTER); + } + + public boolean isFirstLayer() { + return Objects.equals(this, ClusterType.EVENTMESH_META_NACOS) || Objects.equals(this, ClusterType.EVENTMESH_META_ETCD) || Objects.equals(this, + ClusterType.EVENTMESH_RUNTIME) || Objects.equals(this.getAssemblyNodeType(), ClusterType.CLUSTER); + } + + public boolean isSecondFloor() { + return Objects.equals(eventmeshNodeType, ClusterType.STORAGE) ? (Objects.equals(assemblyNodeType, ClusterType.RUNTIME) || Objects.equals( + assemblyNodeType, ClusterType.META)) : false; + } + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java new file mode 100644 index 00000000..aa0ad0e8 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.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.eventmesh.dashboard.common.enums; + +public enum RemotingType { + + NOT, + + META, + + STORAGE, + + EVENT_MESH_RUNTIME, + + EVENT_MESH_NACOS, + + EVENT_MESH_ETCD, + + ROCKETMQ, + ROCKETMQ_NAMESERVER; +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java new file mode 100644 index 00000000..519767ae --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.java @@ -0,0 +1,29 @@ +/* + * 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.common.enums; + +public enum ResetOffsetMode { + + CONSUME_FROM_LAST_OFFSET, + + CONSUME_FROM_FIRST_OFFSET, + CONSUME_FROM_TIMESTAMP, + + CONSUME_FROM_DESIGNATED_OFFSET + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java index d3878dea..982fa5a9 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/AclMetadata.java @@ -18,8 +18,10 @@ package org.apache.eventmesh.dashboard.common.model.metadata; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public class AclMetadata extends MetadataConfig { private Long clusterId; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java index 15762f1d..8dd240ae 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClientMetadata.java @@ -18,8 +18,10 @@ package org.apache.eventmesh.dashboard.common.model.metadata; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public class ClientMetadata extends MetadataConfig { private String name; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java index 585b03dc..57f37b26 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java @@ -17,15 +17,23 @@ package org.apache.eventmesh.dashboard.common.model.metadata; +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; import org.apache.eventmesh.dashboard.common.enums.StoreType; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public class ClusterMetadata extends MetadataConfig { private String clusterName; + private ClusterTrusteeshipType trusteeshipType; + + private ClusterType clusterType; + private String registryAddress; private String bootstrapServers; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java similarity index 67% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java index 7ad7c16e..1b5d5644 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java @@ -15,22 +15,26 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.instanceoperation; +package org.apache.eventmesh.dashboard.common.model.metadata; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import java.util.List; +import lombok.Data; -import org.springframework.stereotype.Service; -/** - * TODO Pending interfaces - */ -@Service -public class StoreConfigService { +@Data +public class ClusterRelationshipMetadata extends MetadataConfig { + + private ClusterType clusterType; + + private Long relationshipId; - public List getStorageConfigFromInstance(Long clusterId, String storeId) { + private ClusterType relationshipType; + + private Integer status; + + @Override + public String getUnique() { return null; } - } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java index c956e142..3592010f 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ConfigMetadata.java @@ -18,11 +18,13 @@ package org.apache.eventmesh.dashboard.common.model.metadata; import lombok.Data; +import lombok.EqualsAndHashCode; /** * Config metadata is a piece of config with key and value */ @Data +@EqualsAndHashCode(callSuper = true) public class ConfigMetadata extends MetadataConfig { /** diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java index 92ff3b01..3827f93a 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/GroupMetadata.java @@ -18,8 +18,10 @@ package org.apache.eventmesh.dashboard.common.model.metadata; import lombok.Data; +import lombok.EqualsAndHashCode; @Data +@EqualsAndHashCode(callSuper = true) public class GroupMetadata extends MetadataConfig { private String name; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/MetadataConfig.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/MetadataConfig.java index cbcdd9a5..09483cfd 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/MetadataConfig.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/MetadataConfig.java @@ -38,6 +38,9 @@ public abstract class MetadataConfig { //cluster id in database private Long clusterId; + + private Long id; + /** * @return A string that is unique to the source, usually a url */ diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java index 0ed58ebb..890ce757 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java @@ -20,12 +20,14 @@ import org.apache.eventmesh.dashboard.common.enums.RecordStatus; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; @Data @SuperBuilder @NoArgsConstructor +@EqualsAndHashCode(callSuper = true) public class RegistryMetadata extends MetadataConfig { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java index e0467514..eb88e38d 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RuntimeMetadata.java @@ -46,6 +46,8 @@ public class RuntimeMetadata extends MetadataConfig { private String clusterName; + private Integer status; + @Override public String getUnique() { return host + ":" + port; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java index 20df8817..b85c346f 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/TopicMetadata.java @@ -47,6 +47,8 @@ public class TopicMetadata extends MetadataConfig { private String description; + private String topicConfig; + @Override public String getUnique() { return topicName; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java new file mode 100644 index 00000000..28d413aa --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java @@ -0,0 +1,22 @@ +/* + * 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.common.model.remoting; + +public class BaseGlobalResult extends GlobalResult { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java new file mode 100644 index 00000000..82e6c7fa --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java @@ -0,0 +1,26 @@ +/* + * 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.common.model.remoting; + +import lombok.Data; + +@Data +public class GlobalRequest { + + private Long clusterId; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java similarity index 65% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java index 344aad61..d6866a33 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalResult.java @@ -15,23 +15,29 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.registry; +package org.apache.eventmesh.dashboard.common.model.remoting; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GlobalResult { -import java.util.List; + private Integer code; -/** - * Database service of registry(meta) such as nacos - */ -public interface RegistryDataService { + private String message; + + private String errorCode; - List selectAll(); + private T data; - void batchInsert(List metaEntities); + private String errorMessages; - void insert(MetaEntity metaEntity); + private Throwable throwable; - void deactivate(MetaEntity metaEntity); } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java new file mode 100644 index 00000000..ce625648 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java @@ -0,0 +1,29 @@ +/* + * 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.common.model.remoting; + +import org.apache.eventmesh.dashboard.common.enums.RemotingType; + +public @interface RemotingAction { + + boolean support(); + + RemotingType substitution(); + + RemotingType retrySubstitution() default RemotingType.STORAGE; +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java new file mode 100644 index 00000000..39bda207 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java @@ -0,0 +1,27 @@ +/* + * 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.common.model.remoting; + +public enum RemotingOperate { + + ADD, + + UPDATE, + + DELETE; +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java index 08b80990..e1844ce0 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.model.remoting.acl; public class CreateAclRequest { + //acl is included in runtime config private String runtimeAddress; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java index 6454a2a2..37d78ecb 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsRequest.java @@ -17,6 +17,9 @@ package org.apache.eventmesh.dashboard.common.model.remoting.acl; -public class GetAclsRequest { +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; + +public class GetAclsRequest extends GlobalRequest { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java index 68f4161b..036dcd6f 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/GetAclsResult.java @@ -17,6 +17,12 @@ package org.apache.eventmesh.dashboard.common.model.remoting.acl; -public class GetAclsResult { + +import org.apache.eventmesh.dashboard.common.model.metadata.AclMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; + +import java.util.List; + +public class GetAclsResult extends GlobalResult> { } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java similarity index 67% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java index 3e8645dd..0f8d3de7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java @@ -15,22 +15,22 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.instanceoperation; +package org.apache.eventmesh.dashboard.common.model.remoting.config; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.common.model.remoting.RemotingOperate; import java.util.List; -import org.springframework.stereotype.Service; -/** - * TODO Pending interfaces - */ +import lombok.Data; + +@Data +public class AddConfigRequest { + + protected RemotingOperate remotingOperate = RemotingOperate.ADD; -@Service -public class RuntimeConfigService { + private ConfigType configType; - public List getRuntimeConfigFromInstance(Long clusterId, String host) { - return null; - } + private List incrementConfig; + private List fullConfig; } diff --git a/eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java similarity index 87% rename from eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java rename to eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java index dc40fa22..d951a91a 100644 --- a/eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java @@ -15,9 +15,8 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.observe; +package org.apache.eventmesh.dashboard.common.model.remoting.config; -public class Main { - public static void main(String[] args) { - } -} \ No newline at end of file +public class AddConfigResponse { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java new file mode 100644 index 00000000..2af482a7 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java @@ -0,0 +1,22 @@ +/* + * 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.common.model.remoting.config; + +public class AddConfigResult { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java new file mode 100644 index 00000000..585e9328 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/ConfigType.java @@ -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. + */ + +package org.apache.eventmesh.dashboard.common.model.remoting.config; + +public enum ConfigType { + + NODE, + TOPIC +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java new file mode 100644 index 00000000..c6566125 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigRequest.java @@ -0,0 +1,28 @@ +/* + * 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.common.model.remoting.config; + +import org.apache.eventmesh.dashboard.common.model.remoting.RemotingOperate; + +public class DeleteConfigRequest extends AddConfigRequest { + + { + remotingOperate = RemotingOperate.DELETE; + } +} + diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java new file mode 100644 index 00000000..b580d437 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java @@ -0,0 +1,22 @@ +/* + * 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.common.model.remoting.config; + +public class DeleteConfigResponse { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java new file mode 100644 index 00000000..935fb4d1 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java @@ -0,0 +1,22 @@ +/* + * 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.common.model.remoting.config; + +public class DeleteConfigResult extends AddConfigResult { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java index b5be52c3..b24ab36b 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigRequest.java @@ -17,7 +17,6 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; -import java.util.List; import lombok.AllArgsConstructor; import lombok.Data; @@ -29,9 +28,9 @@ public class GetConfigRequest { - private List registryAddressList; + private ConfigType configType; - private List runtimeAddressList; + private String node; - private List nameServerAddressList; + private String configObjectName; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java index 3954e7f5..3fb1053f 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java @@ -28,5 +28,6 @@ @AllArgsConstructor public class GetConfigResult { + CompletableFuture getConfigResponseFuture; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java new file mode 100644 index 00000000..baae0023 --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigRequest.java @@ -0,0 +1,27 @@ +/* + * 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.common.model.remoting.config; + +import org.apache.eventmesh.dashboard.common.model.remoting.RemotingOperate; + +public class UpdateConfigRequest extends AddConfigRequest { + + { + remotingOperate = RemotingOperate.DELETE; + } +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java new file mode 100644 index 00000000..2686df1c --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java @@ -0,0 +1,22 @@ +/* + * 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.common.model.remoting.config; + +public class UpdateConfigResponse { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java new file mode 100644 index 00000000..a3128dab --- /dev/null +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java @@ -0,0 +1,22 @@ +/* + * 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.common.model.remoting.config; + +public class UpdateConfigResult extends AddConfigResult { + +} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java index 75552cd8..b41acc3e 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java @@ -17,12 +17,14 @@ package org.apache.eventmesh.dashboard.common.model.remoting.group; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; + import java.util.concurrent.CompletableFuture; import lombok.Data; @Data -public class GetGroupResult { +public class GetGroupResult extends GlobalResult { private CompletableFuture future; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java index 0f938ffc..96f4b691 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/GetOffsetRequest.java @@ -26,4 +26,5 @@ public class GetOffsetRequest { private String bootstrapServers; private String groupName; + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java index f33d8a75..3fa223e4 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java @@ -18,29 +18,20 @@ package org.apache.eventmesh.dashboard.common.model.remoting.offset; +import org.apache.eventmesh.dashboard.common.enums.ResetOffsetMode; + import lombok.Data; @Data public class ResetOffsetRequest { - Long timestamp; - - Long offset; + private Long timestamp; + private Long offset; + private ResetOffsetMode resetOffsetMode; private String topic; - private String bootstrapServers; - private Integer partitionId; - - ResetOffsetMode resetOffsetMode; - private String groupName; - public enum ResetOffsetMode { - EARLIEST, - LATEST, - TIMESTAMP, - OFFSET - } } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java index 3c1fb225..3f0773e7 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java @@ -23,6 +23,7 @@ @Data public class ResetOffsetResult { + private Boolean success; private CompletableFuture future; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java index 4fb5c7de..de8ac0ab 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java @@ -17,10 +17,12 @@ package org.apache.eventmesh.dashboard.common.model.remoting.runtime; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; + import lombok.Data; @Data -public class GetRuntimeRequest { +public class GetRuntimeRequest extends GlobalRequest { private String registryAddress; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java index 3fae063b..d0ec3e17 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java @@ -17,12 +17,14 @@ package org.apache.eventmesh.dashboard.common.model.remoting.runtime; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; + import java.util.concurrent.CompletableFuture; import lombok.Data; @Data -public class GetRuntimeResult { +public class GetRuntimeResult extends GlobalResult { private CompletableFuture future; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java index 6eefe44f..a9eb328e 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java @@ -19,15 +19,23 @@ import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; + +import com.alibaba.fastjson2.JSONObject; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor -public class CreateTopicRequest { +@EqualsAndHashCode(callSuper = true) +public class CreateTopicRequest extends GlobalRequest { + + private TopicMetadata topicMetadata; + - TopicMetadata topicMetadata; + private JSONObject topicConfig; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java index a66e4b9d..d4e4a786 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java @@ -25,5 +25,6 @@ @NoArgsConstructor @AllArgsConstructor public class CreateTopicResponse { + private String result; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java index 4313b284..9fb63277 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResult.java @@ -17,15 +17,9 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; -import java.util.concurrent.CompletableFuture; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -@Data -@NoArgsConstructor -@AllArgsConstructor -public class CreateTopicResult { - CompletableFuture createTopicResponseFuture; +public class CreateTopicResult extends GlobalResult { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java index 5b429dfe..b2bd2161 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java @@ -28,5 +28,6 @@ @NoArgsConstructor @AllArgsConstructor public class DeleteTopicRequest { + TopicMetadata topicMetadata; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java index 95d82561..df818750 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java @@ -25,5 +25,6 @@ @NoArgsConstructor @AllArgsConstructor public class DeleteTopicResponse { + private String result; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java index b9241225..a340735d 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResult.java @@ -17,17 +17,9 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; -import java.util.concurrent.CompletableFuture; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -@Data -@NoArgsConstructor -@AllArgsConstructor +public class DeleteTopicResult extends GlobalResult { -public class DeleteTopicResult { - - private CompletableFuture deleteTopicResponseFuture; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java index 94e141cd..d9920d82 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java @@ -17,6 +17,8 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; + import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -24,7 +26,7 @@ @Data @NoArgsConstructor @AllArgsConstructor -public class GetTopicsRequest { +public class GetTopicsRequest extends GlobalRequest { private String runtimeHost; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java index 5ed2126b..dfe3408d 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java @@ -18,7 +18,6 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; - import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; import java.util.List; @@ -31,5 +30,6 @@ @NoArgsConstructor @AllArgsConstructor public class GetTopicsResponse { + List topicMetadataList; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java index effca2d1..debdbdba 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java @@ -17,15 +17,11 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; -import java.util.concurrent.CompletableFuture; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +/** + * + */ +public class GetTopicsResult extends GlobalResult { -@Data -@NoArgsConstructor -@AllArgsConstructor -public class GetTopicsResult { - CompletableFuture getTopicsResponseFuture; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java index f047e2ff..a8c10278 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java @@ -18,5 +18,6 @@ package org.apache.eventmesh.dashboard.common.model.remoting.user; public class DeleteUserResponse { + Boolean success; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java index 420c746d..faccba53 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java @@ -20,6 +20,7 @@ import org.apache.eventmesh.dashboard.common.enums.StoreType; public class GetUserRequest { + private StoreType serviceType; private String serviceAddress; diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml index c5fb5ee9..cdac182f 100644 --- a/eventmesh-dashboard-console/pom.xml +++ b/eventmesh-dashboard-console/pom.xml @@ -65,7 +65,7 @@ mybatis-dependent 0.1.4 - + com.github.pagehelper pagehelper-spring-boot-starter 2.1.0 @@ -82,6 +82,16 @@ springdoc-openapi-javadoc 1.8.0 + + org.mapstruct + mapstruct + 1.5.2.Final + + + org.mapstruct + mapstruct-processor + 1.5.2.Final + diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java deleted file mode 100644 index bde19f9b..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.cache; - - -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import lombok.Getter; - -public class ClusterCache { - - @Getter - private static final ClusterCache INSTANCE = new ClusterCache(); - - //cluster name - private HashMap clusterNameMap = new HashMap<>(); - - private HashMap clusterIdMap = new HashMap<>(); - - private static final Object lock = new Object(); - - public ClusterEntity getClusterById(Long id) { - return INSTANCE.clusterIdMap.get(id); - } - - public ClusterEntity getClusterByName(String name) { - return INSTANCE.clusterNameMap.get(name); - } - - public ClusterEntity getClusterByRegistryAddress(String registryAddress) { - for (ClusterEntity clusterEntity : INSTANCE.clusterIdMap.values()) { - if (clusterEntity.getRegistryAddress().equals(registryAddress)) { - return clusterEntity; - } - } - return null; - } - - public List getClusters() { - return new ArrayList<>(INSTANCE.clusterIdMap.values()); - } - - public void addCluster(ClusterEntity clusterEntity) { - synchronized (lock) { - if (INSTANCE.clusterIdMap.containsKey(clusterEntity.getId()) - || INSTANCE.clusterNameMap.containsKey(clusterEntity.getName())) { - return; - } - INSTANCE.clusterIdMap.put(clusterEntity.getId(), clusterEntity); - INSTANCE.clusterNameMap.put(clusterEntity.getName(), clusterEntity); - } - } - - public void deleteClusterById(Long id) { - synchronized (lock) { - ClusterEntity clusterEntity = INSTANCE.clusterIdMap.get(id); - INSTANCE.clusterIdMap.remove(id); - INSTANCE.clusterNameMap.remove(clusterEntity.getName()); - } - } - - public void deleteClusterByName(String name) { - synchronized (lock) { - ClusterEntity clusterEntity = INSTANCE.clusterNameMap.get(name); - INSTANCE.clusterNameMap.remove(name); - INSTANCE.clusterIdMap.remove(clusterEntity.getId()); - } - } - - public void syncClusters(List clusters) { - synchronized (lock) { - INSTANCE.clusterIdMap.clear(); - INSTANCE.clusterNameMap.clear(); - for (ClusterEntity clusterEntity : clusters) { - INSTANCE.clusterIdMap.put(clusterEntity.getId(), clusterEntity); - INSTANCE.clusterNameMap.put(clusterEntity.getName(), clusterEntity); - } - } - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java deleted file mode 100644 index d179847f..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.cache; - -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -public class RuntimeCache { - - private static final RuntimeCache INSTANCE = new RuntimeCache(); - - public static final RuntimeCache getInstance() { - return INSTANCE; - } - - // ip:port -> runtime - private Map runtimeMap = new ConcurrentHashMap<>(); - - private RuntimeCache() { - } - - public void addRuntime(RuntimeEntity runtimeEntity) { - runtimeMap.put(runtimeEntity.getHost() + ":" + runtimeEntity.getPort(), runtimeEntity); - } - - public Collection getRuntimeList() { - return runtimeMap.values(); - } - - public void deleteRuntime(RuntimeEntity runtimeEntity) { - runtimeMap.remove(runtimeEntity.getHost() + ":" + runtimeEntity.getPort()); - } - - public void replaceAllRuntime(List runtimeEntities) { - Map newRuntimeList = new ConcurrentHashMap<>(); - runtimeEntities.forEach(runtimeEntity -> { - newRuntimeList.put(runtimeEntity.getHost() + ":" + runtimeEntity.getPort(), runtimeEntity); - }); - runtimeMap = newRuntimeList; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java index 79540d38..2eca4804 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java @@ -17,13 +17,13 @@ package org.apache.eventmesh.dashboard.console.controller; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO; import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; -import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; +import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java index 6d53a963..871e0c53 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java @@ -32,14 +32,13 @@ @RequestMapping("/api/v1") public class SubscriptionController { + // the subscription dataId naming pattern of EventMesh clients: ip-protocol + private static final String CLIENT_DATA_ID_PATTERN = "*.*.*.*-*"; /** * TODO expose implement by FunctionManager */ SubscriptionCore subscriptionCore; - // the subscription dataId naming pattern of EventMesh clients: ip-protocol - private static final String CLIENT_DATA_ID_PATTERN = "*.*.*.*-*"; - /** * Retrieve the config content of a specified config. * @@ -55,10 +54,10 @@ public Result retrieveSubscription(@RequestParam("dataId") String dataId /** * Retrieve a list of configs. * - * @param page page number - * @param size page size + * @param page page number + * @param size page size * @param dataId nacos config data id (Fuzzy Matching) - * @param group config group (Fuzzy Matching) + * @param group config group (Fuzzy Matching) * @return config properties and base64 encoded config content */ @GetMapping("/subscriptions") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/AclController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/AclController.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/AclController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/AclController.java index c35ebf94..e4947c31 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/AclController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/AclController.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; +package org.apache.eventmesh.dashboard.console.controller.cluster; -import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity; -import org.apache.eventmesh.dashboard.console.service.acl.AclService; +import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity; +import org.apache.eventmesh.dashboard.console.service.cluster.AclService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ClusterController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClientDataController.java similarity index 50% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ClusterController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClientDataController.java index 6bae56cd..258496ca 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ClusterController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClientDataController.java @@ -15,32 +15,34 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; +package org.apache.eventmesh.dashboard.console.controller.cluster; -import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO; -import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO; -import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity; +import org.apache.eventmesh.dashboard.console.mapstruct.cluster.ClientDataControllerMapper; +import org.apache.eventmesh.dashboard.console.modle.cluster.client.SelectByClusterIdDTO; +import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService; + +import java.util.List; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("client") +public class ClientDataController { -public class ClusterController { @Autowired - ClusterService clusterService; - - @GetMapping("/cluster/getResourceNum") - public ResourceNumVO getResourceNumByClusterId(Long clusterId) { - return clusterService.getResourceNumByCluster(clusterId); - } + private ClientDataService clientDataService; - @GetMapping("/cluster/getBaseMessage") - public GetClusterBaseMessageVO getClusterBaseMessage(Long clusterId) { - return clusterService.getClusterBaseMessage(clusterId); + @PostMapping("selectByClusterId") + public List selectByClusterId(@RequestBody @Validated SelectByClusterIdDTO selectByClusterIdDTO) { + return clientDataService.selectByClusterId(ClientDataControllerMapper.INSTANCE.selectByClusterIdDTO(selectByClusterIdDTO)); } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java new file mode 100644 index 00000000..983d3372 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterController.java @@ -0,0 +1,106 @@ +/* + * 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.controller.cluster; + + +import org.apache.eventmesh.dashboard.console.mapstruct.cluster.ClusterControllerMapper; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; +import org.apache.eventmesh.dashboard.console.modle.cluster.CreateClusterDTO; +import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO; +import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 1. 用户首页列表 + * 2. 集群首页概要 + */ +@RestController +@RequestMapping("cluster") +public class ClusterController { + + @Autowired + ClusterService clusterService; + + + + + @GetMapping("queryHomeClusterData") + public GetClusterBaseMessageVO queryHomeClusterData(@RequestBody @Validated ClusterIdDTO clusterIdDTO) { + return clusterService.getClusterBaseMessage(clusterIdDTO); + } + + + @PostMapping("createCluster") + public void createCluster(@RequestBody CreateClusterDTO createClusterDTO) { + this.clusterService.createCluster(ClusterControllerMapper.INSTANCE.createCluster(createClusterDTO)); + } + + /** + * 那些集群可以暂停。被依赖的集群不允许暂停。暂停的含义是什么 暂停是否释放资源 + * + * @return + */ + public Integer pauseCluster() { + // 查询集群 + + // 判断集群类型 + + // 查询依赖 + return null; + } + + /** + * 重新开始集群 + * + * @return + */ + public Integer resumeCluster() { + // 查询集群 + + // 判断集群类型 + + // 查询依赖 + return null; + } + + /** + * 注销集群 + * + * @return + */ + public Integer cancelCluster() { + // 查询集群 + + // 判断集群类型 + + // 查询依赖 + + // 如果是全程托管,释放k8s 集群 + return null; + } + + + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java new file mode 100644 index 00000000..1db255d6 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/ClusterRelationshipController.java @@ -0,0 +1,59 @@ +/* + * 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.controller.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity; +import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("clusterRelationship") +public class ClusterRelationshipController { + + + @Autowired + private ClusterRelationshipService clusterRelationshipService; + + + @PostMapping("addClusterRelationshipEntry") + public void addClusterRelationshipEntry(@RequestBody ClusterRelationshipEntity clusterRelationshipEntity) { + this.clusterRelationshipService.addClusterRelationshipEntry(clusterRelationshipEntity); + + } + + @PostMapping("relieveRelationship") + public Integer relieveRelationship(@RequestBody ClusterRelationshipEntity clusterRelationshipEntity) { + return this.clusterRelationshipService.relieveRelationship(clusterRelationshipEntity); + } + + @PostMapping("queryClusterAndRelationshipEntityListByClusterId") + public List queryClusterAndRelationshipEntityListByClusterId( + @RequestBody ClusterRelationshipEntity clusterRelationshipEntity) { + return this.clusterRelationshipService.queryClusterAndRelationshipEntityListByClusterId(clusterRelationshipEntity); + } + + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/InstanceUserController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/InstanceUserController.java similarity index 90% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/InstanceUserController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/InstanceUserController.java index 89b61c84..e95208ef 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/InstanceUserController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/InstanceUserController.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; +package org.apache.eventmesh.dashboard.console.controller.cluster; -import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity; -import org.apache.eventmesh.dashboard.console.service.instanceuser.InstanceUserService; +import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity; +import org.apache.eventmesh.dashboard.console.service.cluster.InstanceUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java new file mode 100644 index 00000000..38d3fe56 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/NetConnectionController.java @@ -0,0 +1,39 @@ +/* + * 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.controller.cluster; + + +import org.apache.eventmesh.dashboard.console.entity.cluster.NetConnectionEntity; + +import java.util.List; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("netConnection") +public class NetConnectionController { + + + @PostMapping("") + public List queryNetConnectionEntityListByFrom(NetConnectionEntity netConnectionEntity) { + return null; + } + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java new file mode 100644 index 00000000..3102a5a9 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/cluster/RuntimeController.java @@ -0,0 +1,109 @@ +/* + * 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.controller.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; +import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache; +import org.apache.eventmesh.dashboard.console.mapstruct.cluster.RuntimeControllerMapper; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; +import org.apache.eventmesh.dashboard.console.modle.IdDTO; +import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +@RestController +@RequestMapping("runtime") +public class RuntimeController { + + @Autowired + private RuntimeService runtimeService; + + @PostMapping("/queryRuntimeListByClusterId") + public List queryRuntimeListByClusterId(@Validated @RequestBody ClusterIdDTO clusterIdDTO) { + List runtimeEntityList = + runtimeService.getRuntimeToFrontByClusterId(RuntimeControllerMapper.INSTANCE.queryRuntimeListByClusterId(clusterIdDTO)); + runtimeEntityList.forEach(n -> { + n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("runtime", n.getId())); + }); + return runtimeEntityList; + } + + + @PostMapping("/queryRuntimeListById") + public RuntimeEntity queryRuntimeListById(@Validated @RequestBody IdDTO idDTO) { + return this.runtimeService.queryRuntimeEntityById(RuntimeControllerMapper.INSTANCE.queryRuntimeListById(idDTO)); + } + + @PostMapping("/createRuntime") + public void crateRuntime(@Validated @RequestBody RuntimeEntity runtimeEntity) { + runtimeService.insertRuntime(runtimeEntity); + } + + /** + * 那些集群可以暂停。被依赖的集群不允许暂停。暂停的含义是什么 + * 暂停是否释放资源 + * @return + */ + public Integer pauseCluster() { + // 查询集群 + + // 判断集群类型 + + // 查询依赖 + return null; + } + + /** + * 重新开始集群 + * @return + */ + public Integer resumeCluster() { + // 查询集群 + + // 判断集群类型 + + // 查询依赖 + return null; + } + + /** + * 注销集群 + * @return + */ + public Integer cancelCluster() { + // 查询集群 + + // 判断集群类型 + + // 查询依赖 + + // 如果是全程托管,释放k8s 集群 + return null; + } + + + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConfigController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java similarity index 93% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConfigController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java index ca819b7d..3dbb3ce8 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConfigController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/ConfigController.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; +package org.apache.eventmesh.dashboard.console.controller.function; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import org.apache.eventmesh.dashboard.console.modle.dto.config.DetailConfigsVO; import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigDTO; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; +import org.apache.eventmesh.dashboard.console.service.function.ConfigService; import java.util.ArrayList; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java similarity index 83% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java index c07c4c90..b88906ae 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/HealthController.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; +package org.apache.eventmesh.dashboard.console.controller.function; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; -import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -36,8 +36,7 @@ public class HealthController { @GetMapping("/cluster/health/getHistoryLiveStatus") public List getHistoryLiveStatusById(Integer type, Long instanceId, String startTime) { - Timestamp timestamp = Timestamp.valueOf(startTime); - return healthDataService.getInstanceLiveStatusHistory(type, instanceId, timestamp); + return healthDataService.getInstanceLiveStatusHistory(type, instanceId, LocalDateTime.parse(startTime)); } @GetMapping("/cluster/health/getInstanceLiveProportion") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/LogController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java similarity index 87% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/LogController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java index 31a0907c..1b048a26 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/LogController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/LogController.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; +package org.apache.eventmesh.dashboard.console.controller.function; -import org.apache.eventmesh.dashboard.console.entity.log.LogEntity; +import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; -import org.apache.eventmesh.dashboard.console.service.log.LogService; +import org.apache.eventmesh.dashboard.console.service.function.LogService; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/RuntimeController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/OverviewController.java similarity index 63% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/RuntimeController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/OverviewController.java index 4fc6c809..4667fcea 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/RuntimeController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/function/OverviewController.java @@ -15,31 +15,33 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.runtime.GetRuntimeListDTO; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; +package org.apache.eventmesh.dashboard.console.controller.function; -import java.util.List; + +import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO; +import org.apache.eventmesh.dashboard.console.service.OverviewService; + +import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - @RestController -public class RuntimeController { +@RequestMapping("overview") +public class OverviewController { - @Autowired - private RuntimeService runtimeService; - @PostMapping("/clusterId/runtime/getList") - public List getRuntimeList(@Validated @RequestBody GetRuntimeListDTO getRuntimeListDTO) { - return runtimeService.getRuntimeToFrontByClusterId(getRuntimeListDTO.getClusterId(), getRuntimeListDTO); - } + @Autowired + private Map overviewServiceMap; + @PostMapping("overview") + public Map overview(@RequestBody @Validated OverviewDTO overviewDTO) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java new file mode 100644 index 00000000..94c983c1 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupController.java @@ -0,0 +1,58 @@ +/* + * 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.controller.message; + + +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.mapstruct.cluster.GroupControllerMapper; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; +import org.apache.eventmesh.dashboard.console.modle.IdDTO; +import org.apache.eventmesh.dashboard.console.service.message.GroupService; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * + */ +@RestController +@RequestMapping("group") +public class GroupController { + + + @Autowired + private GroupService groupService; + + @PostMapping("queryGroupListByClusterId") + public List queryGroupListByClusterId(@RequestBody @Validated ClusterIdDTO clusterIdDTO) { + return groupService.getGroupByClusterId(GroupControllerMapper.INSTANCE.queryGroupListByClusterId(clusterIdDTO)); + } + + @PostMapping("deleteGroupById") + public Integer deleteGroupById(@RequestBody @Validated IdDTO idDTO) { + return groupService.deleteGroup(GroupControllerMapper.INSTANCE.deleteGroupById(idDTO)); + } + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java new file mode 100644 index 00000000..f8f19441 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/GroupRelationshipController.java @@ -0,0 +1,47 @@ +/* + * 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.controller.message; + + +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; +import org.apache.eventmesh.dashboard.console.modle.IdDTO; + +import java.util.List; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("groupRelationship") +public class GroupRelationshipController { + + + + public List queryTopicByGroupId(@RequestBody @Validated IdDTO idDTO) { + + return null; + } + + public List queryGroupByTopicId(@RequestBody @Validated IdDTO idDTO) { + return null; + } + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java new file mode 100644 index 00000000..366c106c --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/OffsetOperateController.java @@ -0,0 +1,57 @@ +/* + * 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.controller.message; + + +import org.apache.eventmesh.dashboard.console.modle.message.offset.QueryOffsetByMessageMetadataDTO; +import org.apache.eventmesh.dashboard.console.modle.message.offset.ResetOffsetDTO; +import org.apache.eventmesh.dashboard.service.remoting.OffsetRemotingService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.lamp.decoration.core.result.ResultObject; + +/** + * 这里是否添加,消息挤压的功能. dashboard, 从存储里面拉。 + */ +@RestController +@RequestMapping("offset") +public class OffsetOperateController { + + @Autowired + private OffsetRemotingService offsetRemotingService; + + + public ResultObject queryOffsetByMessageMetadataDTO( + @RequestBody @Validated QueryOffsetByMessageMetadataDTO queryOffsetByMessageMetadataDTO) { + + return null; + } + + + public ResultObject resetOffset(@RequestBody @Validated ResetOffsetDTO resetOffsetDTO) { + + return null; + } + + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java similarity index 55% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java index 400e0c55..a6d27096 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/TopicController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/message/TopicController.java @@ -15,14 +15,16 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.controller; +package org.apache.eventmesh.dashboard.console.controller.message; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; +import org.apache.eventmesh.dashboard.console.mapstruct.message.TopicControllerMapper; +import org.apache.eventmesh.dashboard.console.modle.IdDTO; import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO; import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO; -import org.apache.eventmesh.dashboard.console.service.topic.TopicService; +import org.apache.eventmesh.dashboard.console.service.message.TopicService; import java.util.List; @@ -31,48 +33,43 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController +@RequestMapping("topic") public class TopicController { @Autowired private TopicService topicService; - @PostMapping("/cluster/topic/topicList") - public List getTopicList(@Validated @RequestBody GetTopicListDTO getTopicListDTO) { - return topicService.getTopicListToFront(getTopicListDTO.getClusterId(), getTopicListDTO); - + @PostMapping("/queryTopicListByClusterId") + public List queryTopicListByClusterId(@Validated @RequestBody GetTopicListDTO getTopicListDTO) { + return topicService.getTopicListToFront(TopicControllerMapper.INSTANCE.queryTopicListByClusterId(getTopicListDTO)); } - - @GetMapping("/cluster/topic/deleteTopic") - public String deleteTopic(TopicEntity topicEntity) { - try { - topicService.deleteTopic(topicEntity); - } catch (Exception e) { - return e.getMessage(); - } - return "success"; + @PostMapping("queryTopicListById ") + public TopicEntity queryTopicById(@Validated @RequestBody IdDTO idDTO) { + return topicService.selectTopicById(TopicControllerMapper.INSTANCE.queryTopicListById(idDTO)); } - - @GetMapping("/cluster/topic/showCreateTopic") - public CreateTopicDTO showCreateTopicMessage() { - return new CreateTopicDTO(); + @GetMapping("deleteTopic") + public Integer deleteTopic(@Validated @RequestBody IdDTO idDTO) { + return topicService.deleteTopic(TopicControllerMapper.INSTANCE.deleteTopic(idDTO)); } - @PostMapping("/cluster/topic/createTopic") - public String createTopic(@Validated @RequestBody CreateTopicDTO createTopicDTO) { - try { - topicService.createTopic(createTopicDTO); - } catch (Exception e) { - return e.getMessage(); - } - return "success"; + @PostMapping("createTopic") + public void createTopic(@Validated @RequestBody CreateTopicDTO createTopicDTO) { + topicService.createTopic(TopicControllerMapper.INSTANCE.createTopic(createTopicDTO)); } + /** + * TODO delete + * + * @param topicId + * @return + */ @GetMapping("/cluster/topic/getTopicDetailGroups") public List getTopicDetailGroups(Long topicId) { return topicService.getTopicDetailGroups(topicId); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/BaseEntity.java similarity index 81% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/BaseEntity.java index c7022f34..59c0a676 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/BaseEntity.java @@ -15,28 +15,22 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.base; +package org.apache.eventmesh.dashboard.console.entity; import java.io.Serializable; -import java.sql.Timestamp; +import java.time.LocalDateTime; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; /** * Base Entity provide some basic fields that every Eventmesh Dashboard Entity would have */ @Data -@AllArgsConstructor -@NoArgsConstructor @EqualsAndHashCode(callSuper = false, exclude = {"createTime", "updateTime"}) @Schema(name = "BaseEntity", description = "Base entity") -@SuperBuilder public class BaseEntity implements Serializable { private static final long serialVersionUID = -2697805837923579585L; @@ -48,7 +42,7 @@ public class BaseEntity implements Serializable { protected Long clusterId; - protected Timestamp createTime; + protected LocalDateTime createTime; - protected Timestamp updateTime; + protected LocalDateTime updateTime; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/DefaultConfigKey.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java similarity index 94% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/DefaultConfigKey.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java index 49a5a863..9efb4cfc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/DefaultConfigKey.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/DefaultConfigKey.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.config; +package org.apache.eventmesh.dashboard.console.entity; import lombok.AllArgsConstructor; 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/StoreEntity.java similarity index 77% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/StoreEntity.java index ba0781e0..78e28d4f 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/StoreEntity.java @@ -15,24 +15,14 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.storage; +package org.apache.eventmesh.dashboard.console.entity; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; - -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class StoreEntity extends BaseEntity { private Long clusterId; @@ -56,10 +46,6 @@ public class StoreEntity extends BaseEntity { private Short status; - private Timestamp createTime; - - private Timestamp updateTime; - private String endpointMap; private Long startTimestamp; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/acl/AclEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/AclEntity.java similarity index 82% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/acl/AclEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/AclEntity.java index 18ca26c7..b19bbb65 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/acl/AclEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/AclEntity.java @@ -15,33 +15,37 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.acl; +package org.apache.eventmesh.dashboard.console.entity.cluster; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@AllArgsConstructor -@NoArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class AclEntity extends BaseEntity { private static final long serialVersionUID = 6057071983428111947L; + private Long id; + private Long clusterId; + private String pattern; + private Integer operation; + private Integer permissionType; + private String host; + private Integer resourceType; + private String resourceName; + private Integer patternType; + private Integer status; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/client/ClientEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClientEntity.java similarity index 75% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/client/ClientEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClientEntity.java index 61bc823f..452805f5 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/client/ClientEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClientEntity.java @@ -15,27 +15,20 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.client; +package org.apache.eventmesh.dashboard.console.entity.cluster; import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import java.sql.Timestamp; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class ClientEntity extends BaseEntity { private static final long serialVersionUID = 8204133370609215856L; @@ -93,22 +86,9 @@ public class ClientEntity extends BaseEntity { */ private Timestamp endTime; + public void setStatusEntity(RecordStatus status) { this.status = status.getNumber(); } - - public ClientEntity(ClientMetadata source) { - setName(source.getName()); - setPlatform(source.getPlatform()); - setLanguage(source.getLanguage()); - setPid(source.getPid()); - setHost(source.getHost()); - setPort(source.getPort()); - setClusterId(source.getClusterId()); - setProtocol(source.getProtocol()); - setDescription(""); - setConfigIds(""); - setStatus(1); - } } \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java similarity index 65% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java index e54b3cc4..78b008c8 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java @@ -15,22 +15,23 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.instanceoperation; +package org.apache.eventmesh.dashboard.console.entity.cluster; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import java.time.LocalDateTime; -import java.util.List; +import lombok.Data; -import org.springframework.stereotype.Service; -/** - * TODO Pending interfaces - */ +@Data +public class ClusterAndRelationshipEntity extends ClusterEntity { + + private LocalDateTime relationshipTime; + + private LocalDateTime unRelationshipTime; + + private ClusterType relationshipType; -@Service -public class ConnectorConfigService { + private Integer status; - public List getConnectorConfigFromInstance(Long clusterId, Long id) { - return null; - } } 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 e0992db4..121fe8ec 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,36 +17,28 @@ package org.apache.eventmesh.dashboard.console.entity.cluster; -import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor -@SuperBuilder @EqualsAndHashCode(callSuper = true, exclude = "status") public class ClusterEntity extends BaseEntity { private String name; - private String registryAddress; - - private String bootstrapServers; + private ClusterTrusteeshipType trusteeshipType; - private String eventmeshVersion; + private ClusterType clusterType; - private String clientProperties; + private String version; private String jmxProperties; - private String regProperties; - private String description; private Integer authType; @@ -55,24 +47,4 @@ public class ClusterEntity extends BaseEntity { private Integer status; - private Integer storeType; - - public ClusterEntity(ClusterMetadata source) { - if (source.getClusterName() != null && !source.getClusterName().isEmpty()) { - setAuthType(source.getAuthType()); - setBootstrapServers(source.getBootstrapServers()); - setClientProperties(source.getClientProperties()); - setRegistryAddress(source.getRegistryAddress()); - setEventmeshVersion(source.getEventmeshVersion()); - setJmxProperties(source.getJmxProperties()); - setRegProperties(source.getRegProperties()); - setDescription(source.getDescription()); - setAuthType(source.getAuthType()); - setRunState(source.getRunState()); - setStoreType(source.getStoreType().getNumber()); - setName(source.getClusterName()); - } else { - throw new RuntimeException("cluster name is empty"); - } - } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java new file mode 100644 index 00000000..c930ed1a --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.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.eventmesh.dashboard.console.entity.cluster; + + +import org.apache.eventmesh.dashboard.common.enums.ClusterType; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + +import lombok.Data; + +@Data +public class ClusterRelationshipEntity extends BaseEntity { + + private ClusterType clusterType; + + private Long relationshipId; + + private ClusterType relationshipType; + + private Integer status; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/ConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ConnectionEntity.java similarity index 75% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/ConnectionEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ConnectionEntity.java index 613f33c6..9f8468a9 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/ConnectionEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ConnectionEntity.java @@ -15,31 +15,24 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.connection; +package org.apache.eventmesh.dashboard.console.entity.cluster; import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.common.model.metadata.ConnectionMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import java.sql.Timestamp; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; /** * A Connection is a link from a source to a sink. */ @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = {"status", "endTime"}) -@SuperBuilder public class ConnectionEntity extends BaseEntity { private static final long serialVersionUID = 6565578252656944905L; @@ -87,20 +80,8 @@ public class ConnectionEntity extends BaseEntity { private String description; + public void setStatusEnum(RecordStatus statusEnum) { this.status = statusEnum.getNumber(); } - - public ConnectionEntity(ConnectionMetadata source) { - setClusterId(source.getClusterId()); - setSourceId(source.getSourceId()); - setSourceType(source.getSourceType()); - setSinkId(source.getSinkId()); - setSinkType(source.getSinkType()); - setRuntimeId(source.getRuntimeId()); - setStatus(1); - setTopic(source.getTopic()); - setGroupId(source.getGroupId()); - setDescription(source.getDescription()); - } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/instanceuser/InstanceUserEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/InstanceUserEntity.java similarity index 79% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/instanceuser/InstanceUserEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/InstanceUserEntity.java index bce60c15..35c0fc52 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/instanceuser/InstanceUserEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/InstanceUserEntity.java @@ -15,22 +15,16 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.instanceuser; +package org.apache.eventmesh.dashboard.console.entity.cluster; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@AllArgsConstructor -@NoArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class InstanceUserEntity extends BaseEntity { private Integer instanceType; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java new file mode 100644 index 00000000..f9785fb1 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/NetConnectionEntity.java @@ -0,0 +1,52 @@ +/* + * 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.entity.cluster; + +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class NetConnectionEntity extends BaseEntity { + + + private Long clusterId; + + private String clientHost; + + private Integer clientPort; + + private Long runtimeId; + + private String runtimeHost; + + private Integer runtimePort; + + private int status; + + private String description; + + private LocalDateTime connectionTime; + + private LocalDateTime disconnectTime; + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java new file mode 100644 index 00000000..750f265f --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java @@ -0,0 +1,50 @@ +/* + * 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.entity.cluster; + +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * + */ +@Data +@EqualsAndHashCode(callSuper = true, exclude = "status") +public class RuntimeEntity extends BaseEntity { + + private String name; + + private String host; + + private Integer port; + + private Integer jmxPort; + + private LocalDateTime startTimestamp; + + private String rack; + + private Integer status; + + private String endpointMap; + +} 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 deleted file mode 100644 index ed612fab..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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.entity.config; - -import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; - -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -@Data -@EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@SuperBuilder -public class ConfigEntity extends BaseEntity { - - private Long id; - - private Long clusterId; - - private String businessType; - - /** - * config type 0:runtime,1:storage,2:connector,3:topic - */ - private Integer instanceType; - - private Long instanceId; - - private String configName; - - private String configValue; - - private String startVersion; - - private String eventmeshVersion; - - private Integer status; - - private String endVersion; - - private Integer diffType; - - private String description; - - private Integer edit; - - private Timestamp createTime; - - private Timestamp updateTime; - - private Integer isDefault; - - private Integer isModify; - - private Integer alreadyUpdate; - - public boolean matchVersion(String eventmeshVersion) { - return (xiaoyu(eventmeshVersion) && dayu(eventmeshVersion)); - } - - - public boolean xiaoyu(String eventmeshVersion) { - String[] em = eventmeshVersion.split("."); - String[] startVersion = this.getStartVersion().split("."); - boolean flag = true; - for (int i = 0; i < em.length; i++) { - if (Integer.valueOf(em[i]) < Integer.valueOf(startVersion[i])) { - flag = false; - break; - } else if (Integer.valueOf(em[i]) == Integer.valueOf(startVersion[i])) { - continue; - } else { - break; - } - } - return flag; - } - - public boolean dayu(String eventmeshVersion) { - String[] em = eventmeshVersion.split("."); - String[] endVersion = this.getEndVersion().split("."); - boolean flag = true; - for (int i = 0; i < em.length; i++) { - if (Integer.valueOf(em[i]) < Integer.valueOf(endVersion[i])) { - break; - } else if (Integer.valueOf(em[i]) == Integer.valueOf(endVersion[i])) { - continue; - } else { - flag = false; - break; - } - } - return flag; - } - - public ConfigEntity(ConfigMetadata source) { - setConfigName(source.getConfigKey()); - setConfigValue(source.getConfigValue()); - setClusterId(source.getClusterId()); - setEdit(1); - setBusinessType(""); - setInstanceId(source.getInstanceId()); - setDescription(""); - setInstanceType(source.getInstanceType()); - setIsDefault(0); - setStartVersion(""); - setEndVersion(""); - setEventmeshVersion(""); - setDiffType(0); - setIsModify(0); - setStatus(1); - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java index 64655726..5bab3fc8 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java @@ -19,21 +19,15 @@ import org.apache.eventmesh.dashboard.common.enums.KubernetesPodStatus; import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class ConnectorEntity extends BaseEntity { private static final long serialVersionUID = -8226303660232951326L; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java new file mode 100644 index 00000000..cdf31405 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java @@ -0,0 +1,70 @@ +/* + * 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.entity.function; + +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class ConfigEntity extends BaseEntity { + + private Long id; + + private Long clusterId; + + private String businessType; + + /** + * config type 0:runtime,1:storage,2:connector,3:topic + */ + private Integer instanceType; + + private Long instanceId; + + private String configName; + + private String configValue; + + private String startVersion; + + private String eventmeshVersion; + + private Integer status; + + private String endVersion; + + private Integer diffType; + + private String description; + + private Integer edit; + + private Integer isDefault; + + private Integer isModify; + + private Integer alreadyUpdate; + + + public boolean matchVersion(String eventmeshVersion) { + return true; + } +} 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/function/HealthCheckResultEntity.java similarity index 90% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/HealthCheckResultEntity.java index 017a9470..b08053e9 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/function/HealthCheckResultEntity.java @@ -15,23 +15,25 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.health; +package org.apache.eventmesh.dashboard.console.entity.function; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; + @Data -@SuperBuilder +@EqualsAndHashCode(callSuper = true, exclude = "resultDesc") +@Builder @AllArgsConstructor @NoArgsConstructor -@EqualsAndHashCode(callSuper = true, exclude = "resultDesc") @Schema(name = "HealthCheckResultEntity", description = "Health check result entity") public class HealthCheckResultEntity extends BaseEntity { 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/function/LogEntity.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/LogEntity.java index 48c0efbe..eb38abf9 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/function/LogEntity.java @@ -15,9 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.log; +package org.apache.eventmesh.dashboard.console.entity.function; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; + +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import java.sql.Timestamp; @@ -44,7 +45,6 @@ public class LogEntity extends BaseEntity { private String content; - private Timestamp createTime; private Timestamp endTime; 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 deleted file mode 100644 index 8e255651..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.entity.group; - -import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; - -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -@NoArgsConstructor -@AllArgsConstructor -@Data -@SuperBuilder -@EqualsAndHashCode(callSuper = true, exclude = "status") -public class GroupEntity extends BaseEntity { - - private Long id; - - private Long clusterId; - - private String name; - - private Integer memberCount; - - private String members; - - private Integer type; - - private String state; - - private Timestamp createTime; - - private Timestamp updateTime; - - private Integer status; - - public GroupEntity(GroupMetadata source) { - setClusterId(source.getClusterId()); - setName(source.getName()); - setMembers(source.getMembers()); - setType(source.getType()); - setState(source.getState()); - setStatus(RecordStatus.ACTIVE.getNumber()); - setMemberCount(source.getMemberCount()); - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java new file mode 100644 index 00000000..b081d44d --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.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.eventmesh.dashboard.console.entity.message; + +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true, exclude = "status") +public class GroupEntity extends BaseEntity { + + private Long id; + + private Long clusterId; + + private String name; + + private Integer memberCount; + + private String members; + + private Integer type; + + private String state; + + 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/message/GroupMemberEntity.java similarity index 74% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupMemberEntity.java index 9e2f6011..344d02d5 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/message/GroupMemberEntity.java @@ -15,23 +15,15 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.groupmember; +package org.apache.eventmesh.dashboard.console.entity.message; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class GroupMemberEntity extends BaseEntity { private Long id; @@ -46,9 +38,5 @@ public class GroupMemberEntity extends BaseEntity { private String state; - private Timestamp createTime; - - private Timestamp updateTime; - private Integer status; } 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/message/TopicEntity.java similarity index 64% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/TopicEntity.java index 531e63ac..9b70bf80 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/message/TopicEntity.java @@ -15,26 +15,17 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.topic; +package org.apache.eventmesh.dashboard.console.entity.message; -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; - -import java.sql.Timestamp; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class TopicEntity extends BaseEntity { private Long id; @@ -56,22 +47,8 @@ public class TopicEntity extends BaseEntity { private String description; - private Timestamp createTime; - - private Timestamp updateTime; - private Integer status; private Integer createProgress; - - public TopicEntity(TopicMetadata source) { - setClusterId(source.getClusterId()); - setTopicName(source.getTopicName()); - setStorageId(source.getStorageId()); - setRetentionMs(source.getRetentionMs()); - setType(source.getType()); - setDescription(source.getDescription()); - setStatus(1); - setCreateProgress(1); - } + } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java deleted file mode 100644 index 60ef0eb1..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.entity.meta; - -import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.common.model.metadata.RegistryMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; - -import io.swagger.v3.oas.annotations.media.Schema; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder -public class MetaEntity extends BaseEntity { - - private static final long serialVersionUID = 7176263169716424469L; - - private String name; - - private String type; - - private String version; - - private Long clusterId; - - private String host; - - private Integer port; - - private String role; - - private String username; - - private String params; - - /** - * 0: not active, 1: active - * - * @see RecordStatus - */ - @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active") - private Integer status; - - public void setStatusEnum(RecordStatus statusEnum) { - this.status = statusEnum.getNumber(); - } - - public MetaEntity(RegistryMetadata source) { - setHost(source.getHost()); - setPort(source.getPort()); - setClusterId(source.getClusterId()); - setName(source.getName()); - setVersion(source.getVersion()); - setParams(source.getParams()); - setRole(source.getRole()); - setStatus(RecordStatus.ACTIVE.getNumber()); - setType(source.getType()); - setUsername(source.getUsername()); - } -} 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 deleted file mode 100644 index be853792..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.entity.runtime; - -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; - -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder -public class RuntimeEntity extends BaseEntity { - private Long clusterId; - - private String host; - - private Long storageClusterId; - - private Integer port; - - private Integer jmxPort; - - private Long startTimestamp; - - private String rack; - - private Integer status; - - private Timestamp createTime; - - private Timestamp updateTime; - - private String endpointMap; - - public RuntimeEntity(RuntimeMetadata source) { - setHost(source.getHost()); - setPort(source.getPort()); - setClusterId(source.getClusterId()); - setStatus(1); - setEndpointMap(source.getEndpointMap()); - setJmxPort(source.getJmxPort()); - setRack(source.getRack()); - setStorageClusterId(source.getStorageClusterId()); - setStartTimestamp(source.getStartTimestamp()); - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java index 891255d6..f61431fc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java @@ -31,8 +31,7 @@ import lombok.extern.slf4j.Slf4j; /** - * This class, in conjunction with {@linkplain Status Status} and {@link BaseException}, - * collectively implements customized error reporting. + * This class, in conjunction with {@linkplain Status Status} and {@link BaseException}, collectively implements customized error reporting. */ @Slf4j diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java index 69358641..512ea12b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java @@ -38,16 +38,16 @@ public class CheckResultCache { private final HashMap> cacheMap = new HashMap<>(); - public Integer getLastHealthyCheckResult(String type, Long typeId) { + private CheckResultCache() { + } + + public Integer getLastHealthyCheckResult(String type, Long typeId) { if (!Objects.isNull(cacheMap.get(type)) && !Objects.isNull(cacheMap.get(type).get(typeId))) { return cacheMap.get(type).get(typeId).getStatus().getNumber(); } return HealthCheckStatus.CHECKING.getNumber(); } - private CheckResultCache() { - } - public void update(String type, Long typeId, HealthCheckStatus status, String resultDesc, Long latency) { HashMap subMap = cacheMap.get(type); if (Objects.isNull(subMap)) { 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 08d46daa..267bf8b7 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 @@ -19,11 +19,11 @@ import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckStatus; import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache.CheckResult; import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback; import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; import java.util.ArrayList; import java.util.concurrent.ExecutorService; @@ -36,9 +36,9 @@ @Slf4j public class HealthExecutor { + private final ExecutorService executorService = Executors.newCachedThreadPool(); @Setter private HealthDataService dataService; - /** * memory cache is used to store real-time health check result. */ @@ -46,8 +46,6 @@ public class HealthExecutor { @Setter private CheckResultCache memoryCache; - private final ExecutorService executorService = Executors.newCachedThreadPool(); - /** * execute function is where health check services work. * @@ -93,8 +91,8 @@ public void onFail(Exception e) { } /** - * this function should be called before any actual execute behaviour.

It will check the execution result of the last check cycle in the - * memory cache, set tasks that haven't finished status to time out and update the database. + * this function should be called before any actual execute behaviour.

It will check the execution result of the last check cycle in the memory + * cache, set tasks that haven't finished status to time out and update the database. */ public void startExecute() { ArrayList resultList = new ArrayList<>(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java index 17e17b86..d8fa8392 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java @@ -19,8 +19,8 @@ import org.apache.eventmesh.dashboard.common.constant.health.HealthCheckTypeConstant; import org.apache.eventmesh.dashboard.common.enums.StoreType; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; -import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; +import org.apache.eventmesh.dashboard.console.entity.StoreEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache.CheckResult; import org.apache.eventmesh.dashboard.console.function.health.annotation.HealthCheckType; import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService; @@ -29,7 +29,7 @@ import org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4.Rocketmq4BrokerCheck; import org.apache.eventmesh.dashboard.console.function.health.check.impl.storage.rocketmq4.Rocketmq4NameServerCheck; import org.apache.eventmesh.dashboard.console.service.DataServiceWrapper; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -54,8 +54,6 @@ @Slf4j public class HealthService { - private HealthExecutor healthExecutor; - /** * class cache used to build healthCheckService instance.

key: HealthCheckObjectConfig.SimpleClassName value: HealthCheckService * @@ -69,10 +67,6 @@ public class HealthService { setClassCache(Rocketmq4NameServerCheck.class); } - private static void setClassCache(Class clazz) { - HEALTH_CHECK_CLASS_CACHE.put(clazz.getSimpleName(), clazz); - } - /** * This map is used to store HealthExecutor.

Outside key is Type(runtime, storage etc.), inside key is the id of type instance(runtimeId, * storageId etc.). @@ -80,9 +74,13 @@ private static void setClassCache(Class clazz) { * @see AbstractHealthCheckService */ private final Map> checkServiceMap = new ConcurrentHashMap<>(); - + private HealthExecutor healthExecutor; private ScheduledThreadPoolExecutor scheduledExecutor; + private static void setClassCache(Class clazz) { + HEALTH_CHECK_CLASS_CACHE.put(clazz.getSimpleName(), clazz); + } + public Map> getCheckResultCacheMap() { return healthExecutor.getMemoryCache().getCacheMap(); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java index 0d3750ca..43de45cc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java @@ -24,11 +24,13 @@ /** * This annotation is used to mark the type of health check service implement. + * * @see org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface HealthCheckType { + /** * type of resource. runtime, topic etc. */ diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java index 86e92c23..1229b234 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java @@ -21,9 +21,11 @@ /** * Callback used by HealthService.doCheck to notify the caller of the result of the health check.

+ * * @see HealthExecutor */ public interface HealthCheckCallback { + public void onSuccess(); public void onFail(Exception e); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java index 5aa15e11..98f666f5 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java @@ -21,15 +21,15 @@ import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback; /** - * Health check service interface.

- * To add a new check service, extend the {@link AbstractHealthCheckService}. + * Health check service interface.

To add a new check service, extend the {@link AbstractHealthCheckService}. + * * @see AbstractHealthCheckService */ public interface HealthCheckService { /** - * Do the health check.

- * To implement a new check service, add the necessary logic to call the success and fail functions of the callback. + * Do the health check.

To implement a new check service, add the necessary logic to call the success and fail functions of the callback. + * * @param callback The behaviour of the callback is defined as a lambda function when used. Please refer to {@link HealthExecutor} for usage. */ public void doCheck(HealthCheckCallback callback); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java index 73d466b9..58c144cd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java @@ -24,11 +24,11 @@ import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; -import org.apache.rocketmq.common.protocol.RequestCode; import org.apache.rocketmq.remoting.InvokeCallback; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.netty.ResponseFuture; import org.apache.rocketmq.remoting.protocol.RemotingCommand; +import org.apache.rocketmq.remoting.protocol.RequestCode; import java.util.Objects; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java index 00e7739a..3c26a06d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java @@ -26,11 +26,11 @@ import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; -import org.apache.rocketmq.common.protocol.RequestCode; import org.apache.rocketmq.remoting.InvokeCallback; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.netty.ResponseFuture; import org.apache.rocketmq.remoting.protocol.RemotingCommand; +import org.apache.rocketmq.remoting.protocol.RequestCode; import java.util.Objects; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java index 1acbe934..3e7c4337 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java @@ -35,14 +35,14 @@ import org.apache.rocketmq.common.constant.PermName; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.common.message.MessageExt; -import org.apache.rocketmq.common.protocol.RequestCode; -import org.apache.rocketmq.common.protocol.header.CreateTopicRequestHeader; -import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.common.RemotingHelper; import org.apache.rocketmq.remoting.netty.NettyClientConfig; import org.apache.rocketmq.remoting.netty.NettyRemotingClient; import org.apache.rocketmq.remoting.protocol.RemotingCommand; +import org.apache.rocketmq.remoting.protocol.RequestCode; +import org.apache.rocketmq.remoting.protocol.header.CreateTopicRequestHeader; +import org.apache.rocketmq.remoting.protocol.heartbeat.MessageModel; import java.util.Arrays; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManager.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManager.java deleted file mode 100644 index 261d429a..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManager.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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.function.metadata; - -import org.apache.eventmesh.dashboard.common.model.metadata.MetadataConfig; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.MetadataServiceWrapper.SingleMetadataServiceWrapper; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandlerWrapper; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataServiceWrapper; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - -import javax.validation.constraints.NotNull; - -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; - -/** - * MetadataManager is a manager for metadata service, it will sync the data between cluster service and database. database should be empty when this - * manager booted - */ -@Slf4j -public class MetadataManager { - - @Setter - private Boolean toDbSync = true; - - private final ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor(2); - - private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(32, 32, 10, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), - new ThreadFactory() { - final AtomicInteger counter = new AtomicInteger(0); - - @Override - public Thread newThread(@NotNull Runnable r) { - return new Thread(r, "metadata-manager-" + counter.incrementAndGet()); - } - }); - /** - * singleton id for service wrapper map, even if the cache is not on, the id should be increased. - */ - private static final AtomicLong staticServiceId = new AtomicLong(0); - - private static final ConcurrentHashMap firstRunToDb = new ConcurrentHashMap<>(); - - private final Map metaDataServiceWrapperMap = new ConcurrentHashMap<>(); - - private final Map> cacheData = new ConcurrentHashMap<>(); - - - public void init(Integer initialDelay, Integer period) { - - scheduledExecutorService.scheduleAtFixedRate(() -> MetadataManager.this.run(toDbSync, true), initialDelay, period, TimeUnit.SECONDS); - } - - - /** - * entrance of a sync scheduled task - * - * @param metaDataServiceWrapper - */ - public void addMetadataService(MetadataServiceWrapper metaDataServiceWrapper) { - Long cacheId = staticServiceId.incrementAndGet(); - metaDataServiceWrapper.setCacheId(cacheId); - metaDataServiceWrapperMap.put(cacheId, metaDataServiceWrapper); - } - - public void run() { - metaDataServiceWrapperMap.forEach(this::handlers); - } - - public void run(Boolean toDbOn, Boolean toServiceOn) { - try { - metaDataServiceWrapperMap.forEach((cacheId, metaDataServiceWrapper) -> handlers(cacheId, metaDataServiceWrapper, toDbOn, toServiceOn)); - } catch (Exception e) { - log.error("metadata manager run error", e); - } - } - - public void handlers(Long cacheId, MetadataServiceWrapper metaDataServiceWrapper, Boolean toDbOn, Boolean toServiceOn) { - this.threadPoolExecutor.execute(() -> { - try { - if (toDbOn) { - this.handler(cacheId, metaDataServiceWrapper.getDbToService(), true); - } - if (toServiceOn) { - this.handler(cacheId, metaDataServiceWrapper.getServiceToDb(), false); - } - } catch (Throwable e) { - log.error("metadata manager handler error", e); - } - }); - } - - public void handlers(Long cacheId, MetadataServiceWrapper metaDataServiceWrapper) { - handlers(cacheId, metaDataServiceWrapper, true, true); - } - - public void handler(Long cacheID, SingleMetadataServiceWrapper singleMetadataServiceWrapper, boolean isDbToService) { - if (singleMetadataServiceWrapper == null) { - return; - } - - try { - List newObjectList = (List) singleMetadataServiceWrapper.getSyncService().getData(); - if (newObjectList.isEmpty()) { - return; - } - - //if cache is false, we don't need to compare the data - // full volume updates - if (!singleMetadataServiceWrapper.getCache()) { - singleMetadataServiceWrapper.getHandler() - .replaceMetadata(newObjectList); - return; - } - - List cacheDataList = cacheData.get(cacheID); - //update old cache - cacheData.put(cacheID, newObjectList); - - Map newObjectMap = getUniqueKeyMap(newObjectList); - Map oldObjectMap = getUniqueKeyMap(cacheDataList); - - //these three List are in target type - List toUpdate = new ArrayList<>(); - List toDelete = new ArrayList<>(); - List toInsert; - - for (Entry entry : oldObjectMap.entrySet()) { - - Object serviceObject = newObjectMap.remove(entry.getKey()); - //if new Data don't have a key in oldMap, - if (serviceObject == null) { - toDelete.add(entry.getValue()); - } else { - //primary id, creat time and update time should not be compared - //if not equal, we need to update fields except unique key(they are equal) - //cause entry is from the oldMap, it should contain the primary key. - if (!serviceObject.equals(entry.getValue())) { - toUpdate.add(entry.getValue()); - } - } - } - - toInsert = new ArrayList<>(newObjectMap.values()); - - //if target is db, we use handler to provide transaction - if (!isDbToService) { - firstRunToDb.putIfAbsent(cacheID, false); - singleMetadataServiceWrapper.getHandler().handleAllObject(toInsert, toUpdate, toDelete); - //if target is eventmesh, we just use that 3 basic method - } else { - toInsert.forEach(singleMetadataServiceWrapper.getHandler()::addMetadataObject); - toUpdate.forEach(singleMetadataServiceWrapper.getHandler()::updateMetadataObject); - toDelete.forEach(singleMetadataServiceWrapper.getHandler()::deleteMetadataObject); - } - } catch (Throwable e) { - log.error("metadata manager handler error", e); - } - } - - public void setUpSyncMetadataManager(SyncDataServiceWrapper syncDataServiceWrapper, MetadataHandlerWrapper metadataHandlerWrapper) { - MetadataServiceWrapper metadataServiceWrapper = new MetadataServiceWrapper(); - SingleMetadataServiceWrapper singleMetadataServiceWrapper = SingleMetadataServiceWrapper.builder() - .syncService(syncDataServiceWrapper.getRuntimeSyncFromClusterService()) - .handler(metadataHandlerWrapper.getRuntimeMetadataHandlerToDb()).build(); - metadataServiceWrapper.setServiceToDb(singleMetadataServiceWrapper); - this.addMetadataService(metadataServiceWrapper); - } - - private Map getUniqueKeyMap(List list) { - Map map = new HashMap<>(); - if (Objects.nonNull(list) && !list.isEmpty()) { - Object firstItem = list.get(0); - if (firstItem instanceof MetadataConfig) { - for (Object item : list) { - MetadataConfig metadataItem = (MetadataConfig) item; - map.put(metadataItem.getUnique(), metadataItem); - } - } else if (firstItem instanceof BaseEntity) { - for (Object item : list) { - BaseEntity baseEntityItem = (BaseEntity) item; - //TODO we don't have db2service method and getUniqueKeyMap from entity is not used - - // map.put(baseEntityItem.getUniqueKey(), baseEntityItem); - } - } - } - return map; - } - - //TODO if database is modified by other service, we need to update the cache -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java index c323cdf8..0c8656ef 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java @@ -17,8 +17,7 @@ package org.apache.eventmesh.dashboard.console.function.metadata; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import lombok.AllArgsConstructor; import lombok.Builder; @@ -43,15 +42,12 @@ public static class SingleMetadataServiceWrapper { /** * true -> incremental updates false -> full volume updates + * * @See MetadataManager */ @Default private Boolean cache = true; - /** - * syncService is the source of metadata - */ - private SyncDataService syncService; /** * handler is the target of metadata, it will process the metadata from syncService diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java similarity index 78% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java index 76776e3a..018584ab 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java @@ -15,16 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.metadata.syncservice; +package org.apache.eventmesh.dashboard.console.function.metadata; -import java.util.List; -/** - * interface to get data from different sources, including database or eventmesh cluster - * - * @param Entity or Metadata - */ -public interface SyncDataService { +public class SyncRelationshipConfig { + + private Class metadataClass; + + private Class entityClass; - public List getData(); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandlerWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandlerWrapper.java index 5722081a..dce04d7c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandlerWrapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandlerWrapper.java @@ -19,9 +19,7 @@ import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.ClusterMetadataHandlerToDbImpl; import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.ConfigMetadataHandlerToDbImpl; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.ConnectionMetadataHandlerToDbImpl; import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.GroupMetadataHandlerToDbImpl; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.RegistryMetadataHandlerToDbImpl; import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.RuntimeMetadataHandlerToDbImpl; import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.TopicMetadataHandlerToDbImpl; import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader; @@ -42,16 +40,17 @@ public class MetadataHandlerWrapper { @Autowired private ClusterMetadataHandlerToDbImpl clusterMetadataHandlerToDb; + @Autowired private ConfigMetadataHandlerToDbImpl configMetadataHandlerToDb; - @Autowired - private ConnectionMetadataHandlerToDbImpl connectionMetadataHandlerToDb; + @Autowired private GroupMetadataHandlerToDbImpl groupMetadataHandlerToDb; - @Autowired - private RegistryMetadataHandlerToDbImpl registryMetadataHandlerToDb; + + @Autowired private RuntimeMetadataHandlerToDbImpl runtimeMetadataHandlerToDb; + @Autowired private TopicMetadataHandlerToDbImpl topicMetadataHandlerToDb; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java index eae42b4f..f9a27432 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java @@ -18,12 +18,11 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; -import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,18 +35,28 @@ public class ClusterMetadataHandlerToDbImpl implements MetadataHandler metadataList) { - List entityList = metadataList.stream() + /* List entityList = metadataList.stream() .map(ClusterEntity::new) .collect(Collectors.toList()); - clusterService.batchInsert(entityList); + clusterService.batchInsert(entityList);*/ } @Override public void deleteMetadata(ClusterMetadata meta) { } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java index 5711ca16..75494832 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java @@ -18,12 +18,11 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.console.service.function.ConfigService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; -import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -40,20 +39,30 @@ public class ConfigMetadataHandlerToDbImpl implements MetadataHandler meta) { - List entityList = meta.stream() + /* List entityList = meta.stream() .map(ConfigEntity::new) - .collect(Collectors.toList()); - configService.batchInsert(entityList); + .collect(Collectors.toList());*/ + //configService.batchInsert(entityList); } @Override public void deleteMetadata(ConfigMetadata meta) { - configService.deleteConfig(new ConfigEntity(meta)); + //configService.deleteConfig(new ConfigEntity(meta)); + } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java deleted file mode 100644 index fb143158..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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.function.metadata.handler.db; - -import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.common.model.metadata.ConnectionMetadata; -import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; -import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.client.ClientDataService; -import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; -import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService; - -import java.util.List; -import java.util.Objects; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class ConnectionMetadataHandlerToDbImpl implements MetadataHandler { - - @Autowired - private ClientDataService clientDataService; - - @Autowired - private ConnectionDataService connectionService; - - @Autowired - private ConnectorDataService connectorDataService; - - @Override - public void addMetadata(ConnectionMetadata meta) { - if (Objects.equals(meta.getSinkType(), "connector")) { - ConnectorEntity query = ConnectorEntity.builder() - .host(meta.getSinkHost()) - .port(meta.getSinkPort()) - .build(); - List sink = connectorDataService.selectByHostPort(query); - if (sink.size() == 1) { - meta.setSinkId(sink.get(0).getId()); - } else if (sink.isEmpty()) { - log.info("sink connector not found, sinkHost:{}, sinkPort:{}.creating one", meta.getSinkHost(), meta.getSinkPort()); - ConnectorEntity connectorEntity = new ConnectorEntity(meta.getClusterId(), meta.getSinkName(), "", "", 1, meta.getSinkHost(), - meta.getSinkPort(), 4, ""); - connectorDataService.createConnector(connectorEntity); - meta.setSinkId(connectorEntity.getId()); - } else { - log.error("more than 1 sink connector active, sinkHost:{}, sinkPort:{}", meta.getSinkHost(), meta.getSinkPort()); - } - - } else if (Objects.equals(meta.getSinkType(), "client")) { - ClientEntity query = new ClientEntity(); - query.setHost(meta.getSinkHost()); - query.setPort(meta.getSinkPort()); - List sink = clientDataService.selectByHostPort(query); - if (sink.size() == 1) { - meta.setSinkId(sink.get(0).getId()); - } else if (sink.isEmpty()) { - log.info("sink client not found, sinkHost:{}, sinkPort:{}.creating one", meta.getSinkHost(), meta.getSinkPort()); - ClientEntity clientEntity = new ClientEntity(); - clientEntity.setStatusEntity(RecordStatus.ACTIVE); - clientEntity.setName(""); - clientEntity.setPlatform(""); - clientEntity.setLanguage(""); - clientEntity.setPid(0L); - clientEntity.setProtocol(""); - clientEntity.setConfigIds(""); - clientEntity.setDescription(""); - clientEntity.setClusterId(0L); - clientEntity.setHost(meta.getSinkHost()); - clientEntity.setPort(meta.getSinkPort()); - clientDataService.addClient(clientEntity); - meta.setSinkId(clientEntity.getId()); - } else { - log.error("more than 1 sink client active, sinkHost:{}, sinkPort:{}", meta.getSinkHost(), meta.getSinkPort()); - } - } - - if (Objects.equals(meta.getSourceType(), "connector")) { - ConnectorEntity query = ConnectorEntity.builder() - .host(meta.getSourceHost()) - .port(meta.getSourcePort()) - .build(); - List source = connectorDataService.selectByHostPort(query); - if (source.size() == 1) { - meta.setSourceId(source.get(0).getId()); - } else if (source.isEmpty()) { - log.info("source connector not found, sourceHost:{}, sourcePort:{}.creating one", meta.getSourceHost(), meta.getSourcePort()); - ConnectorEntity connectorEntity = new ConnectorEntity(meta.getClusterId(), meta.getSourceName(), "", "", 1, meta.getSourceHost(), - meta.getSourcePort(), 4, ""); - connectorDataService.createConnector(connectorEntity); - meta.setSourceId(connectorEntity.getId()); - } else { - log.error("more than 1 source connector active, sourceHost:{}, sourcePort:{}", meta.getSourceHost(), meta.getSourcePort()); - } - } - - if (Objects.equals(meta.getSourceType(), "client")) { - ClientEntity query = new ClientEntity(); - query.setHost(meta.getSourceHost()); - query.setPort(meta.getSourcePort()); - List source = clientDataService.selectByHostPort(query); - if (source.size() == 1) { - meta.setSourceId(source.get(0).getId()); - } else if (source.isEmpty()) { - log.info("source client not found, sourceHost:{}, sourcePort:{}.creating one", meta.getSourceHost(), meta.getSourcePort()); - - ClientEntity clientEntity = new ClientEntity(); - clientEntity.setStatusEntity(RecordStatus.ACTIVE); - clientEntity.setName(""); - clientEntity.setPlatform(""); - clientEntity.setLanguage(""); - clientEntity.setPid(0L); - clientEntity.setProtocol(""); - clientEntity.setConfigIds(""); - clientEntity.setDescription(""); - clientEntity.setClusterId(0L); - clientEntity.setHost(meta.getSinkHost()); - clientEntity.setPort(meta.getSinkPort()); - clientDataService.addClient(clientEntity); - meta.setSourceId(clientEntity.getId()); - } else { - log.error("more than 1 source client active, sourceHost:{}, sourcePort:{}", meta.getSourceHost(), meta.getSourcePort()); - } - } - - connectionService.insert(new ConnectionEntity(meta)); - } - - @Override - public void deleteMetadata(ConnectionMetadata meta) { - - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java index 30914558..963c005a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java @@ -18,12 +18,11 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.group.GroupService; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.console.service.message.GroupService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; -import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,19 +35,29 @@ public class GroupMetadataHandlerToDbImpl implements MetadataHandler metadata) { - List entityList = metadata.stream().map(GroupEntity::new).collect(Collectors.toList()); - groupService.batchInsert(entityList); + /*List entityList = metadata.stream().map(GroupEntity::new).collect(Collectors.toList()); + groupService.batchInsert(entityList);*/ } @Override public void deleteMetadata(GroupMetadata meta) { } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java deleted file mode 100644 index 16c3307a..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.function.metadata.handler.db; - -import org.apache.eventmesh.dashboard.common.model.metadata.RegistryMetadata; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; - -import java.util.List; -import java.util.stream.Collectors; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class RegistryMetadataHandlerToDbImpl implements MetadataHandler { - - @Autowired - private RegistryDataService registryDataService; - - @Override - public void addMetadata(RegistryMetadata meta) { - registryDataService.insert(new MetaEntity(meta)); - } - - @Override - public void addMetadata(List meta) { - List entityList = meta.stream() - .map(MetaEntity::new) - .collect(Collectors.toList()); - registryDataService.batchInsert(entityList); - } - - @Override - public void deleteMetadata(RegistryMetadata meta) { - registryDataService.deactivate(new MetaEntity(meta)); - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java index d8df9f2a..98c78cdb 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java @@ -17,15 +17,16 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; -import org.apache.eventmesh.dashboard.console.cache.ClusterCache; -import org.apache.eventmesh.dashboard.console.cache.RuntimeCache; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; +import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; +import java.util.List; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; @@ -45,38 +46,58 @@ public class RuntimeMetadataHandlerToDbImpl implements MetadataHandler getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java index b15bfa8b..ec86ca65 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java @@ -18,13 +18,14 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.console.entity.StoreEntity; +import org.apache.eventmesh.dashboard.console.service.message.TopicService; import org.apache.eventmesh.dashboard.console.service.store.StoreService; -import org.apache.eventmesh.dashboard.console.service.topic.TopicService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.net.URI; +import java.util.List; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; @@ -54,11 +55,21 @@ public void addMetadata(TopicMetadata meta) { } } - topicService.addTopic(new TopicEntity(meta)); + //topicService.addTopic(new TopicEntity(meta)); } @Override public void deleteMetadata(TopicMetadata meta) { topicService.deleteTopic(null); } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java index 11bd912d..7b52922c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java @@ -17,13 +17,13 @@ package org.apache.eventmesh.dashboard.console.function.metadata.syncservice; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.AclSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.ConfigSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.GroupSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.InstanceUserFromClusterService; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.RuntimeSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.TopicSyncFromClusterService; import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader; +import org.apache.eventmesh.dashboard.core.metadata.cluster.AclSyncFromClusterService; +import org.apache.eventmesh.dashboard.core.metadata.cluster.ConfigSyncFromClusterService; +import org.apache.eventmesh.dashboard.core.metadata.cluster.GroupSyncFromClusterService; +import org.apache.eventmesh.dashboard.core.metadata.cluster.InstanceUserFromClusterService; +import org.apache.eventmesh.dashboard.core.metadata.cluster.RuntimeSyncFromClusterService; +import org.apache.eventmesh.dashboard.core.metadata.cluster.TopicSyncFromClusterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -41,14 +41,19 @@ public class SyncDataServiceWrapper { @Autowired private AclSyncFromClusterService aclSyncFromClusterService; + @Autowired private ConfigSyncFromClusterService configSyncFromClusterService; + @Autowired private GroupSyncFromClusterService groupSyncFromClusterService; + @Autowired private RuntimeSyncFromClusterService runtimeSyncFromClusterService; + @Autowired private InstanceUserFromClusterService instanceUserFromClusterService; + @Autowired private TopicSyncFromClusterService topicSyncFromClusterService; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/ConfigSyncFromClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/ConfigSyncFromClusterService.java deleted file mode 100644 index 6cbf9584..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/ConfigSyncFromClusterService.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.function.metadata.syncservice.cluster; - -import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigResponse; -import org.apache.eventmesh.dashboard.console.cache.ClusterCache; -import org.apache.eventmesh.dashboard.console.cache.RuntimeCache; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; -import org.apache.eventmesh.dashboard.console.service.store.StoreService; -import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.stream.Collectors; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class ConfigSyncFromClusterService implements SyncDataService { - - @Autowired - private StoreService storeDataService; - - @Setter - ConfigRemotingService configRemotingService; - - @Override - public List getData() { - List> futures = new ArrayList<>(); - futures.add(getConfigsFromRegistry()); - futures.add(getConfigsFromRuntime()); - futures.add(getConfigsFromKafka()); - CompletableFuture allFutures = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); - - CompletableFuture> allConfigMetadataFuture = allFutures.thenApply(v -> - futures.stream() - .map(future -> { - try { - return future.get().getConfigMetadataList(); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } - }) - .flatMap(List::stream) - .collect(Collectors.toList()) - ); - - return allConfigMetadataFuture.join(); - } - - private CompletableFuture getConfigsFromRegistry() { - GetConfigRequest registryRequest = new GetConfigRequest(); - List registryList = new ArrayList<>(); - ClusterCache.getINSTANCE().getClusters().forEach(clusterEntity -> registryList.add(clusterEntity.getRegistryAddress())); - registryRequest.setRegistryAddressList(registryList); - return configRemotingService.getConfigsFromRegistry(registryRequest).getGetConfigResponseFuture(); - } - - private CompletableFuture getConfigsFromRuntime() { - GetConfigRequest runtimeRequest = new GetConfigRequest(); - List runtimeAddressList = new ArrayList<>(); - RuntimeCache.getInstance().getRuntimeList().forEach(runtimeEntity -> { - runtimeAddressList.add(runtimeEntity.getHost() + ":" + runtimeEntity.getPort()); - }); - runtimeRequest.setRuntimeAddressList(runtimeAddressList); - return configRemotingService.getConfigsFromRuntime(runtimeRequest).getGetConfigResponseFuture(); - } - - private CompletableFuture getConfigsFromKafka() { - GetConfigRequest brokerRequest = new GetConfigRequest(); - return null; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/GroupSyncFromClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/GroupSyncFromClusterService.java deleted file mode 100644 index 13dc104a..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/GroupSyncFromClusterService.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.function.metadata.syncservice.cluster; - -import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; -import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService; - -import java.util.List; - -import org.springframework.stereotype.Service; - -import lombok.Setter; - -@Service -public class GroupSyncFromClusterService implements SyncDataService { - - @Setter - private GroupRemotingService groupRemotingService; - - @Override - public List getData() { - GetGroupsRequest getGroupsRequest = new GetGroupsRequest(); - try { - return null; - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/RuntimeSyncFromClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/RuntimeSyncFromClusterService.java deleted file mode 100644 index 728ca17e..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/RuntimeSyncFromClusterService.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.function.metadata.syncservice.cluster; - -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; -import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; -import org.apache.eventmesh.dashboard.core.meta.runtime.NacosRuntimeCore; -import org.apache.eventmesh.dashboard.service.remoting.MetaRemotingService; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.ConcurrentLinkedDeque; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class RuntimeSyncFromClusterService implements SyncDataService { - - private final MetaRemotingService metaRemotingService = new NacosRuntimeCore(); - - @Autowired - private ClusterService clusterDataService; - - @Override - public List getData() { - List requestList = new ArrayList<>(); - ConcurrentLinkedDeque runtimeMetadata = new ConcurrentLinkedDeque<>(); - clusterDataService.selectAll().forEach( - clusterEntity -> { - GetRuntimeRequest request = new GetRuntimeRequest(); - request.setRegistryAddress(clusterEntity.getRegistryAddress()); - requestList.add(request); - } - ); - if (requestList.isEmpty()) { - return new ArrayList<>(); - } - CountDownLatch countDownLatch = new CountDownLatch(requestList.size()); - ForkJoinPool taskThreadPool = new ForkJoinPool(requestList.size()); - - try { - taskThreadPool.submit(() -> - requestList.parallelStream().forEach(request -> { - metaRemotingService.getRuntime(request).getFuture() - .whenComplete((result, ex) -> { - if (Objects.isNull(result)) { - log.error("Error occurred while getting topics", ex); - } - runtimeMetadata.addAll(result.getRuntimeMetadataList()); - countDownLatch.countDown(); - }); - }) - ).get(); - } catch (InterruptedException | ExecutionException e) { - log.error("Error occurred while executing parallel stream", e); - } finally { - taskThreadPool.shutdown(); - } - - try { - countDownLatch.await(); - return new ArrayList<>(runtimeMetadata); - } catch (InterruptedException e) { - log.error("sync topic data from runtime failed", e); - return new ArrayList<>(); - } - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterService.java deleted file mode 100644 index 2c8b28fc..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterService.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.function.metadata.syncservice.cluster; - -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest; -import org.apache.eventmesh.dashboard.console.cache.RuntimeCache; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; -import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.ConcurrentLinkedDeque; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; - -import org.springframework.stereotype.Service; - -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class TopicSyncFromClusterService implements SyncDataService { - - @Setter - TopicRemotingService topicRemotingService; - - public List getData() { - ConcurrentLinkedDeque topicList = new ConcurrentLinkedDeque<>(); - Collection runtimeList = RuntimeCache.getInstance().getRuntimeList(); - - CountDownLatch countDownLatch = new CountDownLatch(runtimeList.size()); - ForkJoinPool taskThreadPool = new ForkJoinPool(runtimeList.size()); - try { - taskThreadPool.submit(() -> - runtimeList.parallelStream().forEach(runtimeEntity -> { - GetTopicsRequest getTopicsRequest = new GetTopicsRequest(); - getTopicsRequest.setRuntimeHost(runtimeEntity.getHost()); - getTopicsRequest.setRuntimePort(runtimeEntity.getPort()); - topicRemotingService.getAllTopics(getTopicsRequest).getGetTopicsResponseFuture() - .whenComplete((result, ex) -> { - if (Objects.isNull(result)) { - log.error("Error occurred while getting topics", ex); - } - result.getTopicMetadataList().forEach(topic -> { - topic.setRuntimeId(runtimeEntity.getId()); - topicList.add(topic); - }); - countDownLatch.countDown(); - }); - }) - ).get(); - } catch (InterruptedException | ExecutionException e) { - log.error("Error occurred while executing parallel stream", e); - } finally { - taskThreadPool.shutdown(); - } - - try { - countDownLatch.await(); - return new ArrayList<>(topicList); - } catch (InterruptedException e) { - log.error("sync topic data from runtime failed", e); - return new ArrayList<>(); - } - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/db/TopicSyncFromDbService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/db/TopicSyncFromDbService.java deleted file mode 100644 index 4cbd1737..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/db/TopicSyncFromDbService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.function.metadata.syncservice.db; - - -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; -import org.apache.eventmesh.dashboard.console.service.topic.TopicService; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class TopicSyncFromDbService implements SyncDataService { - - @Autowired - private TopicService topicDataService; - - @Override - public List getData() { - return topicDataService.selectAll(); - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/optration/TopicMetadataHandlerToClusterImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/optration/TopicMetadataHandlerToClusterImpl.java deleted file mode 100644 index 6b89a58f..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/optration/TopicMetadataHandlerToClusterImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.function.optration; - -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; - -import org.springframework.stereotype.Service; - -import lombok.Setter; - -@Service -public class TopicMetadataHandlerToClusterImpl implements MetadataHandler { - - @Setter - private TopicRemotingService topicRemotingService; - - @Override - public void addMetadata(TopicEntity meta) { - TopicMetadata topicMetadata = new TopicMetadata(); - topicMetadata.setStoreAddress(""); - topicMetadata.setConnectionUrl(""); - topicMetadata.setTopicName(meta.getTopicName()); - topicMetadata.setRuntimeId(0L); - topicMetadata.setStorageId(meta.getStorageId()); - topicMetadata.setRetentionMs(0L); - topicMetadata.setType(meta.getType()); - topicMetadata.setDescription(meta.getDescription()); - topicMetadata.setRegistryAddress(""); - topicMetadata.setClusterId(0L); - - topicRemotingService.createTopic(new CreateTopicRequest(topicMetadata)); - } - - @Override - public void deleteMetadata(TopicEntity meta) { - - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java index bed58ebb..e1066b7f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java @@ -18,12 +18,13 @@ package org.apache.eventmesh.dashboard.console.log; import org.apache.eventmesh.dashboard.console.annotation.EmLog; -import org.apache.eventmesh.dashboard.console.entity.log.LogEntity; -import org.apache.eventmesh.dashboard.console.service.log.LogService; +import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; +import org.apache.eventmesh.dashboard.console.service.function.LogService; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.Objects; import org.aspectj.lang.ProceedingJoinPoint; @@ -99,7 +100,7 @@ public LogEntity productLoEntity(EmLog declaredAnnotation, ProceedingJoinPoint j logEntity.setOperationType(declaredAnnotation.OprType()); logEntity.setTargetType(declaredAnnotation.OprTarget()); logEntity.setState(1); - logEntity.setCreateTime(new Timestamp(System.currentTimeMillis())); + logEntity.setCreateTime(LocalDateTime.now()); return logEntity; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java similarity index 94% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapper.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java index e2e5021b..c69758cd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/AclMapper.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.mapper.acl; +package org.apache.eventmesh.dashboard.console.mapper.cluster; -import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java similarity index 93% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapper.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java index a2692848..1fa5a962 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClientMapper.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.mapper.client; +package org.apache.eventmesh.dashboard.console.mapper.cluster; -import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; @@ -34,8 +34,6 @@ @Mapper public interface ClientMapper { - @Select("select * from client where status=1") - List selectAll(); @Select({ ""}) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List clusterEntities); + Integer batchInsert(List clusterEntities); - @Select("SELECT * FROM cluster WHERE id=#{id} AND status=1") - ClusterEntity selectClusterById(ClusterEntity cluster); - @Insert("INSERT INTO cluster (name, registry_address, bootstrap_servers, eventmesh_version, client_properties, " - + "jmx_properties, reg_properties, description, auth_type, run_state,store_type) VALUES (#{name},#{registryAddress}," - + "#{bootstrapServers},#{eventmeshVersion},#{clientProperties},#{jmxProperties},#{regProperties},#{description},#{authType}," - + "#{runState},#{storeType})" - + "ON DUPLICATE KEY UPDATE status = 1") + @Select({ + "" + }) + Map queryHomeClusterData(ClusterIdDTO clusterIdDTO); + + + @Insert({ + "insert into cluster(name,trusteeship_type,cluster_type,version,jmx_properties,description,auth_type)values", + "(#{name},#{c.trusteeshipType},#{c.clusterType},#{c.version},#{jmxProperties},#{regProperties},#{description},#{authType})" + }) @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void addCluster(ClusterEntity cluster); + Integer insertCluster(ClusterEntity cluster); - @Update("UPDATE cluster SET name =#{name},reg_properties=#{regProperties},bootstrap_servers=#{bootstrapServers}," - + "eventmesh_version=#{eventmeshVersion},client_properties=#{clientProperties},jmx_properties=#{jmxProperties}," - + "reg_properties=#{regProperties},description=#{description},auth_type=#{authType},run_state=#{runState} ," - + "registry_address=#{registryAddress} WHERE id=#{id}") - void updateClusterById(ClusterEntity cluster); + @Update({"update cluster set name=#{name},jmx_properties=#{jmxProperties},description=#{description},auth_type=#{authType},run_state=#{runState}", + " where id=#{id}" + }) + Integer updateClusterById(ClusterEntity cluster); @Update("UPDATE cluster SET status=0 WHERE id=#{id}") - void deactivate(ClusterEntity clusterEntity); + Integer deactivate(ClusterEntity clusterEntity); + + + } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java new file mode 100644 index 00000000..f741ee8b --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java @@ -0,0 +1,65 @@ +/* + * 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.mapper.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity; + +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + +/** + * + */ +@Mapper +public interface ClusterRelationshipMapper { + + + @Insert({ + " insert into cluster_relationship (cluster_type,cluster_id,relationship_type,relationship_id)values( #{clusterType},#{clusterId},", + "#{relationshipType},#{relationshipId})" + }) + Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity); + + @Update("update cluster_relationship set status = 3 where id = #{id} ") + Integer relieveRelationship(ClusterRelationshipEntity clusterRelationshipEntity); + + + @Select({ + "", + }) + List queryClusterAndRelationshipEntityListByClusterId(ClusterRelationshipEntity clusterRelationshipEntity); + + @Select(" select * from cluster_relationship where status = 3") + List selectAll(); + + @Select(" select * from cluster_relationship where update_time = #{updateTime} and status in( 2 ,3)") + List selectNewlyIncreased(); +} 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/cluster/ConnectionMapper.java similarity index 97% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapper.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ConnectionMapper.java index b2c20f07..fee28ef4 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/cluster/ConnectionMapper.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.mapper.connection; +package org.apache.eventmesh.dashboard.console.mapper.cluster; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java similarity index 84% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapper.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java index 86017d76..e5a838e6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/InstanceUserMapper.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.mapper.instanceuser; +package org.apache.eventmesh.dashboard.console.mapper.cluster; -import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; @@ -38,13 +38,13 @@ public interface InstanceUserMapper { + "VALUES (#{id}, #{instanceType}, #{password}, #{clusterId}, #{name}, #{token},1)") void insert(InstanceUserEntity instanceuserEntity); - @Update("UPDATE instance_user SET status=0 WHERE cluster_id=#{clusterId}") - void deleteInstanceUserByCluster(InstanceUserEntity instanceuserEntity); + @Update("UPDATE instance_user SET status=0 WHERE id=#{clusterId}") + void deleteInstanceUserById(InstanceUserEntity instanceuserEntity); @Update("UPDATE instance_user SET password=#{password} WHERE id=#{id}") void updatePasswordById(InstanceUserEntity instanceuserentity); - @Select("SELECT * FROM instance_user WHERE status=1") + @Select("select * from instance_user where status=1") List selectAll(); @Select("SELECT * FROM instance_user WHERE id=#{id} AND status=1") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java new file mode 100644 index 00000000..e6fea127 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/NetConnectionMapper.java @@ -0,0 +1,40 @@ +/* + * 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.mapper.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.NetConnectionEntity; + +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 网络连接就三个方法 + * 1. 添加 and 修改。没有控制层接口 + * 2. 按照 cluster or runtime id and client(host and port) 查询 + * 3. 按照时间进行统计 + */ +@Mapper +public interface NetConnectionMapper { + + + Integer batchInsert(List netConnectionEntityList); + + List queryNetConnectionEntityListByFrom(NetConnectionEntity netConnectionEntity); + +} 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/cluster/RuntimeMapper.java similarity index 91% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/runtime/RuntimeMapper.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/RuntimeMapper.java index c1e910f5..f27977d3 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/cluster/RuntimeMapper.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.mapper.runtime; +package org.apache.eventmesh.dashboard.console.mapper.cluster; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; @@ -56,9 +56,13 @@ public interface RuntimeMapper { @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") void addRuntime(RuntimeEntity runtimeEntity); - @Select("SELECT * FROM runtime WHERE cluster_id=#{clusterId} AND status=1") + @Select("select * from runtime where cluster_id=#{clusterid} and status=1") List selectRuntimeByCluster(RuntimeEntity runtimeEntity); + + @Select("select * from runtime where id=#{id} and status=1") + RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity); + @Select({ ""}) - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void batchInsert(List groupEntities); @Select("SELECT * FROM `group` WHERE status=1") List selectAll(); @@ -81,11 +67,27 @@ public interface OprGroupMapper { " cluster_id=#{clusterId}", " ", " ", - " AND name LIKE concat('%',#{name},'%')", + " name LIKE concat('%',#{name},'%')", " ", " AND status=1", " ", ""}) List selectGroup(GroupEntity groupEntity); + + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List groupEntities); + + @Insert("INSERT INTO `group` (cluster_id, name, member_count, members, type, state)" + + "VALUE (#{clusterId},#{name},#{memberCount},#{members},#{type},#{state}) " + + "ON DUPLICATE KEY UPDATE status=1") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void addGroup(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/message/OprGroupMemberMapper.java similarity index 96% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/groupmember/OprGroupMemberMapper.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/OprGroupMemberMapper.java index bbfd99d6..0acba5dd 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/message/OprGroupMemberMapper.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.mapper.groupmember; +package org.apache.eventmesh.dashboard.console.mapper.message; -import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; 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/message/TopicMapper.java similarity index 68% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/topic/TopicMapper.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/message/TopicMapper.java index 34b36a98..fd17db2c 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/message/TopicMapper.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.mapper.topic; +package org.apache.eventmesh.dashboard.console.mapper.message; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; @@ -35,46 +35,10 @@ @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} AND status=1") Integer selectTopicNumByCluster(TopicEntity topicEntity); - @Select({ - ""}) - List getTopicList(TopicEntity topicEntity); - - @Insert("INSERT INTO topic (cluster_id, topic_name, storage_id, retention_ms, type, description, create_progress) " - + "VALUE (#{clusterId},#{topicName},#{storageId},#{retentionMs},#{type},#{description},#{createProgress})" - + "ON DUPLICATE KEY UPDATE status = 1") - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - void addTopic(TopicEntity topicEntity); - - @Select("SELECT * FROM topic WHERE status=1 AND cluster_id=#{clusterId}") - List selectAllByClusterId(TopicEntity topicEntity); - @Select({ ""}) - List getTopicsToFrontByClusterId(@Param("topicEntity") TopicEntity topicEntity); + List queryTopicsToFrontByClusterId(@Param("topicEntity") TopicEntity topicEntity); + + + @Select("SELECT * FROM topic WHERE cluster_id=#{clusterId} and status = 1") + List selectTopicByCluster(TopicEntity topicEntity); + + + @Select("SELECT * FROM topic WHERE status=1") + List selectAll(); + + @Select("SELECT * FROM topic WHERE id=#{id}") + TopicEntity selectTopicById(TopicEntity topicEntity); + @Update("UPDATE topic SET type=#{type},description=#{description} WHERE id=#{id}") void updateTopic(TopicEntity topicEntity); @@ -94,15 +70,22 @@ public interface TopicMapper { void updateTopicCreateProgress(TopicEntity topicEntity); @Update("UPDATE `topic` SET status=0 WHERE id=#{id}") - void deleteTopic(TopicEntity topicEntity); - - @Select("SELECT * FROM topic WHERE cluster_id=#{clusterId} AND topic_name=#{topicName}") - TopicEntity selectTopicByUnique(TopicEntity topicEntity); + Integer deleteTopic(TopicEntity topicEntity); - @Select("SELECT * FROM topic WHERE id=#{id}") - TopicEntity selectTopicById(TopicEntity topicEntity); + @Insert({ + ""}) + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void batchInsert(List topicEntities); - @Select("SELECT * FROM topic WHERE cluster_id=#{clusterId}") - List selectTopicByCluster(TopicEntity topicEntity); + @Insert("INSERT INTO topic (cluster_id, topic_name, retention_ms, type, description, create_progress) " + + "VALUE (#{clusterId},#{topicName},#{storageId},#{retentionMs},#{type},#{description},#{createProgress})" + + "ON DUPLICATE KEY UPDATE status = 1") + @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") + void addTopic(TopicEntity topicEntity); } \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java deleted file mode 100644 index 6d4f8d6a..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.mapper.meta; - -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; - -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Options; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; - -import java.util.List; - -/** - * Mybatis Mapper for the table of meta. - */ -@Mapper -public interface MetaMapper { - - @Select("SELECT * FROM meta WHERE status=1") - List selectAll(); - - @Insert({ - ""}) - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - List batchInsert(List metaEntities); - - @Select("SELECT * FROM meta WHERE id = #{id}") - MetaEntity selectById(MetaEntity metaEntity); - - @Select("SELECT * FROM meta WHERE cluster_id = #{clusterId} LIMIT 1") - List selectByClusterId(MetaEntity metaEntity); - - @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") - @Insert("INSERT INTO meta (name, type, version, cluster_id, host, port, role, username, params, status)" - + " VALUES ( #{name}, #{type}, #{version}, #{clusterId}, #{host}, #{port}, #{role}, #{username}, #{params}, 1)") - Long insert(MetaEntity metaEntity); - - @Update("UPDATE meta SET status = 0 WHERE id = #{id}") - void deactivate(MetaEntity metaEntity); -} 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 2449a106..ede3d0d9 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 @@ -17,7 +17,7 @@ package org.apache.eventmesh.dashboard.console.mapper.storage; -import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; +import org.apache.eventmesh.dashboard.console.entity.StoreEntity; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java new file mode 100644 index 00000000..2de3f0b5 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClientDataControllerMapper.java @@ -0,0 +1,35 @@ +/* + * 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.mapstruct.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity; +import org.apache.eventmesh.dashboard.console.modle.cluster.client.SelectByClusterIdDTO; + +import org.mapstruct.factory.Mappers; + +/** + * + */ +public interface ClientDataControllerMapper { + + ClientDataControllerMapper INSTANCE = Mappers.getMapper(ClientDataControllerMapper.class); + + + ClientEntity selectByClusterIdDTO(SelectByClusterIdDTO selectByClusterIdDTO); + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java new file mode 100644 index 00000000..08ca20c4 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/ClusterControllerMapper.java @@ -0,0 +1,37 @@ +/* + * 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.mapstruct.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; +import org.apache.eventmesh.dashboard.console.modle.cluster.CreateClusterDTO; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + */ +@Mapper +public interface ClusterControllerMapper { + + ClusterControllerMapper INSTANCE = Mappers.getMapper(ClusterControllerMapper.class); + + + ClusterEntity createCluster(CreateClusterDTO createClusterDTO); + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java new file mode 100644 index 00000000..1b2eab83 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/GroupControllerMapper.java @@ -0,0 +1,38 @@ +/* + * 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.mapstruct.cluster; + +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; +import org.apache.eventmesh.dashboard.console.modle.IdDTO; + +import org.mapstruct.factory.Mappers; + +/** + * + */ +public interface GroupControllerMapper { + + GroupControllerMapper INSTANCE = Mappers.getMapper(GroupControllerMapper.class); + + + GroupEntity queryGroupListByClusterId(ClusterIdDTO clusterId); + + GroupEntity deleteGroupById(IdDTO idDTO); + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.java new file mode 100644 index 00000000..eccf8508 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/cluster/RuntimeControllerMapper.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.mapstruct.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; +import org.apache.eventmesh.dashboard.console.modle.IdDTO; +import org.apache.eventmesh.dashboard.console.modle.cluster.runtime.CrateRuntimeDTO; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * + */ +@Mapper +public interface RuntimeControllerMapper { + + RuntimeControllerMapper INSTANCE = Mappers.getMapper(RuntimeControllerMapper.class); + + + RuntimeEntity queryRuntimeListByClusterId(ClusterIdDTO clusterIdDTO); + + RuntimeEntity queryRuntimeListById(IdDTO idDTO); + + RuntimeEntity crateRuntime(CrateRuntimeDTO crateRuntimeDTO); + + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.java new file mode 100644 index 00000000..6f44f3b7 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/message/TopicControllerMapper.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.mapstruct.message; + +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; +import org.apache.eventmesh.dashboard.console.modle.IdDTO; +import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO; +import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO; + +import org.mapstruct.factory.Mappers; + +/** + * + */ +public interface TopicControllerMapper { + + TopicControllerMapper INSTANCE = Mappers.getMapper(TopicControllerMapper.class); + + + TopicEntity queryTopicListByClusterId(GetTopicListDTO getTopicListDTO); + + TopicEntity queryTopicListById(IdDTO idDTO); + + TopicEntity deleteTopic(IdDTO idDTO); + + TopicEntity createTopic(CreateTopicDTO createTopicDTO); + + TopicEntity getTopicDetailGroups(Long topicId); +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java new file mode 100644 index 00000000..d6f008a5 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/ClusterIdDTO.java @@ -0,0 +1,30 @@ +/* + * 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.modle; + +import javax.validation.constraints.NotNull; + +import lombok.Data; + +@Data +public class ClusterIdDTO { + + @NotNull + private Long clusterId; + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java new file mode 100644 index 00000000..adc36993 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/IdDTO.java @@ -0,0 +1,26 @@ +/* + * 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.modle; + +import lombok.Data; + +@Data +public class IdDTO { + + private Long id; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java new file mode 100644 index 00000000..3eaa45b0 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java @@ -0,0 +1,35 @@ +/* + * 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.modle.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; + +import lombok.Data; + +@Data +public class ClusterHomeListVO { + + + @Data + public static class ClusterHomeListData { + + private ClusterEntity clusterEntity; + + } + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java new file mode 100644 index 00000000..2102c5c5 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java @@ -0,0 +1,50 @@ +/* + * 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.modle.cluster; + +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; + +import javax.validation.constraints.NotNull; + +import lombok.Data; + +@Data +public class CreateClusterDTO { + + @NotNull + private String name; + + @NotNull + private ClusterTrusteeshipType trusteeshipType; + + @NotNull + private ClusterType clusterType; + + @NotNull + private String version; + + + private String jmxProperties = ""; + + private String description = ""; + + + private Integer authType = 0; + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java new file mode 100644 index 00000000..268aeacd --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/client/SelectByClusterIdDTO.java @@ -0,0 +1,25 @@ +/* + * 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.modle.cluster.client; + + +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; + +public class SelectByClusterIdDTO extends ClusterIdDTO { + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java new file mode 100644 index 00000000..c08eeb7b --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/CrateRuntimeDTO.java @@ -0,0 +1,42 @@ +/* + * 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.modle.cluster.runtime; + +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; + +import java.time.LocalDateTime; + +import lombok.Data; + +@Data +public class CrateRuntimeDTO extends ClusterIdDTO { + + private String name; + + private String host; + + private Integer port; + + private Integer jmxPort; + + private LocalDateTime startTimestamp = LocalDateTime.now(); + + private String rack = ""; + + private String endpointMap; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/GetRuntimeListDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java similarity index 82% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/GetRuntimeListDTO.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java index 6465418c..0e6eab28 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/runtime/GetRuntimeListDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/runtime/QueryRuntimeListByClusterIdDTO.java @@ -15,7 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.modle.dto.runtime; +package org.apache.eventmesh.dashboard.console.modle.cluster.runtime; + +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; import lombok.AllArgsConstructor; import lombok.Data; @@ -24,9 +26,7 @@ @NoArgsConstructor @AllArgsConstructor @Data -public class GetRuntimeListDTO { - - private Long clusterId; +public class QueryRuntimeListByClusterIdDTO extends ClusterIdDTO { private String host; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java index fe99cf97..8ffc2cec 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.dashboard.console.modle.dto.connection; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java new file mode 100644 index 00000000..1edd8df9 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewDTO.java @@ -0,0 +1,32 @@ +/* + * 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.modle.function; + +import org.apache.eventmesh.dashboard.console.modle.IdDTO; + +import javax.validation.constraints.NotNull; + +import lombok.Data; + +@Data +public class OverviewDTO extends IdDTO { + + @NotNull + private OverviewType overviewType; + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java new file mode 100644 index 00000000..33172446 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/function/OverviewType.java @@ -0,0 +1,26 @@ +/* + * 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.modle.function; + +public enum OverviewType { + + GROUP; + + + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java new file mode 100644 index 00000000..3e59a03a --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.java @@ -0,0 +1,33 @@ +/* + * 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.modle.message.offset; + + +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; + +import lombok.Data; + +@Data +public class QueryOffsetByMessageMetadataDTO extends ClusterIdDTO { + + + private String groupName; + + private String topicName; + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java new file mode 100644 index 00000000..ca3b9d87 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java @@ -0,0 +1,39 @@ +/* + * 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.modle.message.offset; + + +import org.apache.eventmesh.dashboard.common.enums.ResetOffsetMode; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; + +import lombok.Data; + +@Data +public class ResetOffsetDTO extends ClusterIdDTO { + + private Long groupId; + + private String groupName; + + private Integer partitionId; + + private ResetOffsetMode resetOffsetMode; + + private String modeValue; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/DataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/DataServiceWrapper.java index f353c8c4..a687b3bc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/DataServiceWrapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/DataServiceWrapper.java @@ -18,18 +18,17 @@ package org.apache.eventmesh.dashboard.console.service; -import org.apache.eventmesh.dashboard.console.service.client.ClientDataService; +import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; -import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; +import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService; +import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService; import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService; -import org.apache.eventmesh.dashboard.console.service.group.GroupService; -import org.apache.eventmesh.dashboard.console.service.groupmember.GroupMemberService; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; -import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; +import org.apache.eventmesh.dashboard.console.service.function.ConfigService; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; +import org.apache.eventmesh.dashboard.console.service.message.GroupMemberService; +import org.apache.eventmesh.dashboard.console.service.message.GroupService; +import org.apache.eventmesh.dashboard.console.service.message.TopicService; import org.apache.eventmesh.dashboard.console.service.store.StoreService; -import org.apache.eventmesh.dashboard.console.service.topic.TopicService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -67,9 +66,6 @@ public class DataServiceWrapper { @Autowired private HealthDataService healthDataService; - @Autowired - private RegistryDataService registryDataService; - @Autowired private RuntimeService runtimeDataService; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java new file mode 100644 index 00000000..e966e280 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java @@ -0,0 +1,29 @@ +/* + * 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; + +import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO; + +/** + * + */ +public interface OverviewService { + + + Object overview(OverviewDTO overviewDTO); +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/AclService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/AclService.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/AclService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/AclService.java index b92af3ad..8702d758 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/AclService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/AclService.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.acl; +package org.apache.eventmesh.dashboard.console.service.cluster; -import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity; import java.util.List; 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/cluster/ClientDataService.java similarity index 85% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/ClientDataService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClientDataService.java index 422a72ac..e5739446 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/cluster/ClientDataService.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.client; +package org.apache.eventmesh.dashboard.console.service.cluster; -import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity; import java.util.List; @@ -26,8 +26,6 @@ */ public interface ClientDataService { - List selectAll(); - void deActive(ClientEntity clientEntity); void deActiveByHostPort(ClientEntity clientEntity); @@ -37,4 +35,6 @@ public interface ClientDataService { void batchInsert(List clientEntityList); List selectByHostPort(ClientEntity clientEntity); + + List selectByClusterId(ClientEntity clientEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java new file mode 100644 index 00000000..9f81f132 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java @@ -0,0 +1,42 @@ +/* + * 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.cluster; + +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity; + +import java.util.List; + +/** + * + */ +public interface ClusterRelationshipService { + + + Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity); + + Integer relieveRelationship(ClusterRelationshipEntity clusterRelationshipEntity); + + List queryClusterAndRelationshipEntityListByClusterId(ClusterRelationshipEntity clusterRelationshipEntity); + + List selectAll(); + + List selectNewlyIncreased(ClusterRelationshipEntity clusterRelationshipEntity); + + +} 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 f3ba8411..a3e00b6b 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 @@ -18,31 +18,38 @@ package org.apache.eventmesh.dashboard.console.service.cluster; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO; -import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO; import java.util.List; +import java.util.Map; /** * cluster data service */ public interface ClusterService { - GetClusterBaseMessageVO getClusterBaseMessage(Long clusterId); - ResourceNumVO getResourceNumByCluster(Long clusterId); + void createCluster(ClusterEntity clusterEntity); - void batchInsert(List clusterEntities); + GetClusterBaseMessageVO getClusterBaseMessage(ClusterIdDTO clusterIdDTO); + + + Map queryHomeClusterData(ClusterIdDTO clusterIdDTO); + + Integer batchInsert(List clusterEntities); List selectAll(); + List selectNewlyIncreased(ClusterEntity clusterEntity); + void addCluster(ClusterEntity cluster); List selectAllCluster(); ClusterEntity selectClusterById(ClusterEntity cluster); - void updateClusterById(ClusterEntity cluster); + Integer updateClusterById(ClusterEntity cluster); - void deactivate(ClusterEntity cluster); + Integer deactivate(ClusterEntity cluster); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionDataService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java index 37fac862..b1f159e6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/ConnectionDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.connection; +package org.apache.eventmesh.dashboard.console.service.cluster; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/InstanceUserService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/InstanceUserService.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/InstanceUserService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/InstanceUserService.java index 8b512c45..6958480d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/InstanceUserService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/InstanceUserService.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.instanceuser; +package org.apache.eventmesh.dashboard.console.service.cluster; -import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity; import java.util.List; 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/cluster/RuntimeService.java similarity index 74% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/RuntimeService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/RuntimeService.java index f5ea5edc..ff7f4f62 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/cluster/RuntimeService.java @@ -15,11 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.runtime; +package org.apache.eventmesh.dashboard.console.service.cluster; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.runtime.GetRuntimeListDTO; +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; import java.util.List; @@ -28,17 +27,17 @@ */ public interface RuntimeService { - List getRuntimeToFrontByClusterId(Long clusterId, GetRuntimeListDTO getRuntimeListDTO); + RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity); + + List getRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity); void batchInsert(List runtimeEntities); List selectAll(); - List getRuntimeByClusterId(Long cluster); - List selectByHostPort(RuntimeEntity runtimeEntity); - void addRuntime(RuntimeEntity runtimeEntity); + void insertRuntime(RuntimeEntity runtimeEntity); void updateRuntimeByCluster(RuntimeEntity runtimeEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/Impl/AclServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/AclServiceImpl.java similarity index 85% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/Impl/AclServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/AclServiceImpl.java index 94d15194..80fb0740 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/acl/Impl/AclServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/AclServiceImpl.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.acl.Impl; +package org.apache.eventmesh.dashboard.console.service.cluster.impl; -import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity; -import org.apache.eventmesh.dashboard.console.mapper.acl.AclMapper; -import org.apache.eventmesh.dashboard.console.service.acl.AclService; +import org.apache.eventmesh.dashboard.console.entity.cluster.AclEntity; +import org.apache.eventmesh.dashboard.console.mapper.cluster.AclMapper; +import org.apache.eventmesh.dashboard.console.service.cluster.AclService; import java.util.List; 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/cluster/impl/ClientDataServiceImpl.java similarity index 80% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/client/Impl/ClientDataServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClientDataServiceImpl.java index 7847651e..7e375ab2 100644 --- 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/cluster/impl/ClientDataServiceImpl.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.client.Impl; +package org.apache.eventmesh.dashboard.console.service.cluster.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 org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity; +import org.apache.eventmesh.dashboard.console.mapper.cluster.ClientMapper; +import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService; import java.util.List; @@ -32,11 +32,6 @@ public class ClientDataServiceImpl implements ClientDataService { @Autowired private ClientMapper clientMapper; - @Override - public List selectAll() { - return clientMapper.selectAll(); - } - @Override public void deActive(ClientEntity clientEntity) { clientMapper.deactivate(clientEntity); @@ -61,4 +56,10 @@ public void batchInsert(List clientEntityList) { public List selectByHostPort(ClientEntity clientEntity) { return clientMapper.selectByHostPort(clientEntity); } + + @Override + public List selectByClusterId(ClientEntity clientEntity) { + return this.clientMapper.selectByClusterId(clientEntity); + } + } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java new file mode 100644 index 00000000..44cb33d6 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java @@ -0,0 +1,60 @@ +/* + * 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.cluster.impl; + +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterAndRelationshipEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity; +import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterRelationshipMapper; +import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ClusterRelationshipServiceImpl implements ClusterRelationshipService { + + @Autowired + private ClusterRelationshipMapper clusterRelationshipMapper; + + @Override + public Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity) { + return this.clusterRelationshipMapper.addClusterRelationshipEntry(clusterRelationshipEntity); + } + + @Override + public Integer relieveRelationship(ClusterRelationshipEntity clusterRelationshipEntity) { + return clusterRelationshipMapper.relieveRelationship(clusterRelationshipEntity); + } + + @Override + public List queryClusterAndRelationshipEntityListByClusterId(ClusterRelationshipEntity clusterRelationshipEntity) { + return this.clusterRelationshipMapper.queryClusterAndRelationshipEntityListByClusterId(clusterRelationshipEntity); + } + + @Override + public List selectAll() { + return this.clusterRelationshipMapper.selectAll(); + } + + @Override + public List selectNewlyIncreased(ClusterRelationshipEntity clusterRelationshipEntity) { + return this.clusterRelationshipMapper.selectNewlyIncreased(); + } +} 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 49fd2af0..abcc6d9b 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 @@ -17,29 +17,31 @@ package org.apache.eventmesh.dashboard.console.service.cluster.impl; -import org.apache.eventmesh.dashboard.console.cache.ClusterCache; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterMapper; -import org.apache.eventmesh.dashboard.console.mapper.connection.ConnectionMapper; -import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper; -import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper; -import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper; +import org.apache.eventmesh.dashboard.console.mapper.cluster.ConnectionMapper; +import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper; +import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMapper; +import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; +import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO; import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO; -import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO; +import org.apache.eventmesh.dashboard.console.service.OverviewService; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; import java.util.List; +import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -public class ClusterServiceImpl implements ClusterService { +public class ClusterServiceImpl implements ClusterService, OverviewService { @Autowired private ConnectionMapper connectionMapper; @@ -58,7 +60,13 @@ public class ClusterServiceImpl implements ClusterService { @Override - public GetClusterBaseMessageVO getClusterBaseMessage(Long clusterId) { + public void createCluster(ClusterEntity clusterEntity) { + + } + + @Override + public GetClusterBaseMessageVO getClusterBaseMessage(ClusterIdDTO clusterIdDTO) { + Long clusterId = clusterIdDTO.getClusterId(); GetClusterBaseMessageVO getClusterBaseMessageVO = new GetClusterBaseMessageVO(); TopicEntity topicEntity = new TopicEntity(); topicEntity.setClusterId(clusterId); @@ -76,22 +84,14 @@ public GetClusterBaseMessageVO getClusterBaseMessage(Long clusterId) { } @Override - public ResourceNumVO getResourceNumByCluster(Long clusterId) { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setClusterId(clusterId); - Integer connectionNumByCluster = connectionMapper.selectConnectionNumByCluster(connectionEntity); - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setClusterId(clusterId); - Integer topicNumByCluster = topicMapper.selectTopicNumByCluster(topicEntity); - ResourceNumVO resourceNumVO = new ResourceNumVO(topicNumByCluster, connectionNumByCluster); - return resourceNumVO; + public Map queryHomeClusterData(ClusterIdDTO clusterIdDTO) { + return null; } @Override - public void batchInsert(List clusterEntities) { - clusterMapper.batchInsert(clusterEntities); - updateClusterCache(); + public Integer batchInsert(List clusterEntities) { + return clusterMapper.batchInsert(clusterEntities); } @Override @@ -99,10 +99,14 @@ public List selectAll() { return clusterMapper.selectAllCluster(); } + @Override + public List selectNewlyIncreased(ClusterEntity clusterEntity) { + return clusterMapper.selectAllCluster(); + } + @Override public void addCluster(ClusterEntity cluster) { - clusterMapper.addCluster(cluster); - updateClusterCache(); + clusterMapper.insertCluster(cluster); } @Override @@ -115,19 +119,19 @@ public ClusterEntity selectClusterById(ClusterEntity cluster) { return clusterMapper.selectClusterById(cluster); } + @Override - public void updateClusterById(ClusterEntity cluster) { - clusterMapper.updateClusterById(cluster); - updateClusterCache(); + public Integer updateClusterById(ClusterEntity cluster) { + return clusterMapper.updateClusterById(cluster); } @Override - public void deactivate(ClusterEntity cluster) { - clusterMapper.deactivate(cluster); + public Integer deactivate(ClusterEntity cluster) { + return clusterMapper.deactivate(cluster); } - private void updateClusterCache() { - List clusters = selectAll(); - ClusterCache.getINSTANCE().syncClusters(clusters); + @Override + public Object overview(OverviewDTO overviewDTO) { + return null; } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/Impl/InstanceUserServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/InstanceUserServiceImpl.java similarity index 83% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/Impl/InstanceUserServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/InstanceUserServiceImpl.java index 4b9fe1b2..716e1d4f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/instanceuser/Impl/InstanceUserServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/InstanceUserServiceImpl.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.instanceuser.Impl; +package org.apache.eventmesh.dashboard.console.service.cluster.impl; -import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity; -import org.apache.eventmesh.dashboard.console.mapper.instanceuser.InstanceUserMapper; -import org.apache.eventmesh.dashboard.console.service.instanceuser.InstanceUserService; +import org.apache.eventmesh.dashboard.console.entity.cluster.InstanceUserEntity; +import org.apache.eventmesh.dashboard.console.mapper.cluster.InstanceUserMapper; +import org.apache.eventmesh.dashboard.console.service.cluster.InstanceUserService; import java.util.List; @@ -42,7 +42,7 @@ public void insert(InstanceUserEntity instanceuserEntity) { @Override public void deleteInstanceUserByCluster(InstanceUserEntity instanceuserEntity) { - instanceUserMapper.deleteInstanceUserByCluster(instanceuserEntity); + instanceUserMapper.deleteInstanceUserById(instanceuserEntity); } @Override 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/cluster/impl/RuntimeServiceImpl.java similarity index 67% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/RuntimeServiceImpl.java index 27fb7d80..68dc66a9 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/cluster/impl/RuntimeServiceImpl.java @@ -15,15 +15,14 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.runtime.Impl; +package org.apache.eventmesh.dashboard.console.service.cluster.impl; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache; -import org.apache.eventmesh.dashboard.console.mapper.health.HealthCheckResultMapper; -import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper; -import org.apache.eventmesh.dashboard.console.modle.dto.runtime.GetRuntimeListDTO; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; +import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper; +import org.apache.eventmesh.dashboard.console.mapper.function.HealthCheckResultMapper; +import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService; import java.util.List; @@ -39,16 +38,14 @@ public class RuntimeServiceImpl implements RuntimeService { @Autowired private HealthCheckResultMapper healthCheckResultMapper; - public RuntimeEntity setSearchCriteria(GetRuntimeListDTO getRuntimeListDTO, RuntimeEntity runtimeEntity) { - runtimeEntity.setHost(getRuntimeListDTO.getHost()); - return runtimeEntity; + + @Override + public RuntimeEntity queryRuntimeEntityById(RuntimeEntity runtimeEntity) { + return this.runtimeMapper.queryRuntimeEntityById(runtimeEntity); } @Override - public List getRuntimeToFrontByClusterId(Long clusterId, GetRuntimeListDTO getRuntimeListDTO) { - RuntimeEntity runtimeEntity = new RuntimeEntity(); - runtimeEntity.setClusterId(clusterId); - runtimeEntity = this.setSearchCriteria(getRuntimeListDTO, runtimeEntity); + public List getRuntimeToFrontByClusterId(RuntimeEntity runtimeEntity) { List runtimeByClusterId = runtimeMapper.getRuntimesToFrontByCluster(runtimeEntity); runtimeByClusterId.forEach(n -> { n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("runtime", n.getId())); @@ -67,21 +64,13 @@ public List selectAll() { return runtimeMapper.selectAll(); } - @Override - public List getRuntimeByClusterId(Long clusterId) { - RuntimeEntity runtimeEntity = new RuntimeEntity(); - runtimeEntity.setClusterId(clusterId); - - return runtimeMapper.selectRuntimeByCluster(runtimeEntity); - } - @Override public List selectByHostPort(RuntimeEntity runtimeEntity) { return runtimeMapper.selectByHostPort(runtimeEntity); } @Override - public void addRuntime(RuntimeEntity runtimeEntity) { + public void insertRuntime(RuntimeEntity runtimeEntity) { runtimeMapper.addRuntime(runtimeEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java deleted file mode 100644 index c24bb9f4..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncConnectorConfigTask.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.config.synchronous; - -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; -import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigService; -import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService; - -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Synchronous DB To Instance - */ -@Service -public class SyncConnectorConfigTask { - - @Autowired - private ConnectorDataService connectorDataService; - - @Autowired - private ConnectorConfigService connectorConfigService; - @Autowired - private ConfigService configService; - - public void synchronousConnectorConfig(Long clusterId) { - List connectorEntities = connectorDataService.selectConnectorByCluster(clusterId); - for (ConnectorEntity connectorEntity : connectorEntities) { - - ConcurrentHashMap connectorConfigMapFromInstance = this.configListToMap( - connectorConfigService.getConnectorConfigFromInstance(clusterId, connectorEntity.getId())); - - ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, connectorEntity.getId()); - - ConcurrentHashMap connectorConfigMapFromDb = - this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType())); - - ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>(); - - connectorConfigMapFromInstance.entrySet().forEach(n -> { - if (connectorConfigMapFromDb.remove(n.getKey(), n.getValue())) { - connectorConfigMapFromInstance.remove(n.getKey()); - } - if (connectorConfigMapFromDb.get(n.getKey()) != null) { - updateConfigMap.put(n.getKey(), connectorConfigMapFromDb.get(n.getKey())); - connectorConfigMapFromInstance.remove(n.getKey()); - connectorConfigMapFromDb.remove(n.getKey()); - } - }); - //add connectorConfigMapFromDb - - //update updateConfigMap - - //delete connectorConfigMapFromInstance - } - } - - private ConcurrentHashMap configListToMap(List configEntityList) { - ConcurrentHashMap connectorConfigMap = new ConcurrentHashMap<>(); - configEntityList.forEach(n -> { - connectorConfigMap.put(n.getConfigName(), n.getConfigValue()); - } - ); - return connectorConfigMap; - } - - - private ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) { - ConfigEntity configEntity = new ConfigEntity(); - configEntity.setClusterId(clusterId); - configEntity.setInstanceId(id); - configEntity.setInstanceType(2); - return configEntity; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java deleted file mode 100644 index 589a6c86..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncRuntimeConfigTask.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.config.synchronous; - -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; -import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.RuntimeConfigService; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; - -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Synchronous DB To Instance - */ - -@Service -public class SyncRuntimeConfigTask { - - @Autowired - private RuntimeService runtimeService; - - @Autowired - private RuntimeConfigService runtimeConfigService; - - @Autowired - private ConfigService configService; - - public void synchronousRuntimeConfig(Long clusterId) { - List runtimeEntityList = runtimeService.getRuntimeByClusterId(clusterId); - for (RuntimeEntity runtimeEntity : runtimeEntityList) { - - ConcurrentHashMap runtimeConfigMapFromInstance = this.configListToMap( - runtimeConfigService.getRuntimeConfigFromInstance(clusterId, runtimeEntity.getHost())); - - ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, runtimeEntity.getId()); - - ConcurrentHashMap runtimeConfigMapFromDb = - this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType())); - - ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>(); - - runtimeConfigMapFromInstance.entrySet().forEach(n -> { - if (runtimeConfigMapFromDb.remove(n.getKey(), n.getValue())) { - runtimeConfigMapFromInstance.remove(n.getKey()); - } - if (runtimeConfigMapFromDb.get(n.getKey()) != null) { - updateConfigMap.put(n.getKey(), runtimeConfigMapFromDb.get(n.getKey())); - runtimeConfigMapFromInstance.remove(n.getKey()); - runtimeConfigMapFromDb.remove(n.getKey()); - } - }); - //add runtimeConfigMapFromDb - - //update updateConfigMap - - //delete runtimeConfigMapFromInstance - } - } - - private ConcurrentHashMap configListToMap(List configEntityList) { - ConcurrentHashMap runtimeConfigMap = new ConcurrentHashMap<>(); - configEntityList.forEach(n -> { - runtimeConfigMap.put(n.getConfigName(), n.getConfigValue()); - } - ); - return runtimeConfigMap; - } - - - private ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) { - ConfigEntity configEntity = new ConfigEntity(); - configEntity.setClusterId(clusterId); - configEntity.setInstanceId(id); - configEntity.setInstanceType(0); - return configEntity; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java deleted file mode 100644 index 4a5b0209..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncStoreConfigTask.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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.config.synchronous; - -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; -import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.StoreConfigService; -import org.apache.eventmesh.dashboard.console.service.store.StoreService; - -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Synchronous DB To Instance - */ - -@Service -public class SyncStoreConfigTask { - - @Autowired - private StoreService storeService; - - @Autowired - private StoreConfigService storeConfigService; - - @Autowired - private ConfigService configService; - - public void synchronousStoreConfig(Long clusterId) { - StoreEntity storeEntity = storeService.selectStoreByCluster(clusterId); - - ConcurrentHashMap storeConfigMapFromInstance = this.configListToMap( - storeConfigService.getStorageConfigFromInstance(clusterId, storeEntity.getHost())); - - ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, storeEntity.getId()); - - ConcurrentHashMap storeConfigMapFromDb = - this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType())); - - ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>(); - - storeConfigMapFromInstance.entrySet().forEach(n -> { - if (storeConfigMapFromDb.remove(n.getKey(), n.getValue())) { - storeConfigMapFromInstance.remove(n.getKey()); - } - if (storeConfigMapFromDb.get(n.getKey()) != null) { - updateConfigMap.put(n.getKey(), storeConfigMapFromDb.get(n.getKey())); - storeConfigMapFromInstance.remove(n.getKey()); - storeConfigMapFromDb.remove(n.getKey()); - } - }); - //add storeConfigMapFromDb - - //update updateConfigMap - - //delete storeConfigMapFromInstance - - } - - private ConcurrentHashMap configListToMap(List configEntityList) { - ConcurrentHashMap storeConfigMap = new ConcurrentHashMap<>(); - configEntityList.forEach(n -> { - storeConfigMap.put(n.getConfigName(), n.getConfigValue()); - } - ); - return storeConfigMap; - } - - - private ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) { - ConfigEntity configEntity = new ConfigEntity(); - configEntity.setClusterId(clusterId); - configEntity.setInstanceId(id); - configEntity.setInstanceType(1); - return configEntity; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java deleted file mode 100644 index 4df55e05..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SyncTopicConfigTask.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.config.synchronous; - -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; -import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.TopicConfigService; -import org.apache.eventmesh.dashboard.console.service.topic.TopicService; - -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Synchronous DB To Instance - */ - -@Service -public class SyncTopicConfigTask { - - @Autowired - private TopicService topicService; - - @Autowired - private TopicConfigService topicConfigService; - - @Autowired - private ConfigService configService; - - public void synchronousTopicConfig(Long clusterId) { - List topicEntityList = topicService.selectTopiByCluster(clusterId); - for (TopicEntity topicEntity : topicEntityList) { - - ConcurrentHashMap topicConfigMapFromInstance = this.configListToMap( - topicConfigService.getTopicConfigFromInstance(clusterId, topicEntity.getTopicName())); - - ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, topicEntity.getId()); - - ConcurrentHashMap topicConfigMapFromDb = - this.configListToMap(configService.selectByInstanceIdAndType(configEntity.getInstanceId(), configEntity.getInstanceType())); - - ConcurrentHashMap updateConfigMap = new ConcurrentHashMap<>(); - - topicConfigMapFromInstance.entrySet().forEach(n -> { - if (topicConfigMapFromDb.remove(n.getKey(), n.getValue())) { - topicConfigMapFromInstance.remove(n.getKey()); - } - if (topicConfigMapFromDb.get(n.getKey()) != null) { - updateConfigMap.put(n.getKey(), topicConfigMapFromDb.get(n.getKey())); - topicConfigMapFromInstance.remove(n.getKey()); - topicConfigMapFromDb.remove(n.getKey()); - } - }); - //add topicConfigMapFromDb - - //update updateConfigMap - - //delete topicConfigMapFromInstance - } - } - - private ConcurrentHashMap configListToMap(List configEntityList) { - ConcurrentHashMap topicConfigMap = new ConcurrentHashMap<>(); - configEntityList.forEach(n -> { - topicConfigMap.put(n.getConfigName(), n.getConfigValue()); - } - ); - return topicConfigMap; - } - - - private ConfigEntity getConfigEntityBelongInstance(Long clusterId, Long id) { - ConfigEntity configEntity = new ConfigEntity(); - configEntity.setClusterId(clusterId); - configEntity.setInstanceId(id); - configEntity.setInstanceType(1); - return configEntity; - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java deleted file mode 100644 index fc429061..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * 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.connection.impl; - - -import org.apache.eventmesh.dashboard.console.annotation.EmLog; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; -import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; -import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper; -import org.apache.eventmesh.dashboard.console.mapper.connection.ConnectionMapper; -import org.apache.eventmesh.dashboard.console.mapper.connector.ConnectorMapper; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; -import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; -import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ConnectionDataServiceDatabaseImpl implements ConnectionDataService { - - @Autowired - private ConnectionMapper connectionMapper; - - @Autowired - private ConnectorMapper connectorMapper; - - @Autowired - private ConfigMapper configMapper; - - - @Override - public ConnectorEntity getConnectorById(Long connectorId) { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setId(connectorId); - return connectorMapper.selectById(connectorEntity); - } - - @Override - public List getConnectorBusinessType(String type) { - ConfigEntity config = new ConfigEntity(); - config.setBusinessType(type); - return configMapper.selectConnectorBusinessType(config); - } - - @Override - public List getAllConnectionsByClusterId(Long clusterId) { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setClusterId(clusterId); - return connectionMapper.selectByClusterId(connectionEntity); - } - - @Override - public Long insert(ConnectionEntity connectionEntity) { - return connectionMapper.insert(connectionEntity); - } - - - - @EmLog(OprType = "add", OprTarget = "Connection") - @Override - public boolean createConnection(CreateConnectionDTO createConnectionDTO) { - ConnectorEntity sinkConnector = this.createSinkConnector(createConnectionDTO.getClusterId(), createConnectionDTO.getAddConnectionDTO()); - ConnectorEntity sourceConnector = this.createSourceConnector(createConnectionDTO.getClusterId(), createConnectionDTO.getAddConnectionDTO()); - ConnectionEntity connectionEntity = this.setConnection(createConnectionDTO); - connectionEntity.setSinkId(sinkConnector.getId()); - connectionEntity.setSourceId(sourceConnector.getId()); - connectionMapper.insert(connectionEntity); - this.addConnectorConfigs(createConnectionDTO.getAddConnectorConfigDTO().getSinkConnectorConfigs(), sinkConnector); - this.addConnectorConfigs(createConnectionDTO.getAddConnectorConfigDTO().getSourceConnectorConfigs(), sourceConnector); - return false; - } - - private ConnectionEntity setConnection(CreateConnectionDTO createConnectionDTO) { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setClusterId(createConnectionDTO.getClusterId()); - connectionEntity.setSourceType("connector"); - connectionEntity.setSinkType("connector"); - connectionEntity.setRuntimeId(-1L); - connectionEntity.setGroupId(createConnectionDTO.getAddConnectionDTO().getGroupId()); - connectionEntity.setStatus(1); - connectionEntity.setDescription(createConnectionDTO.getAddConnectionDTO().getConnectionDescription()); - connectionEntity.setTopic(createConnectionDTO.getAddConnectionDTO().getTopicName()); - return connectionEntity; - } - - public void addConnectorConfigs(List configEntityList, ConnectorEntity connectorEntity) { - configEntityList.forEach(n -> { - n.setInstanceId(connectorEntity.getId()); - n.setIsDefault(0); - n.setClusterId(connectorEntity.getClusterId()); - }); - configMapper.batchInsert(configEntityList); - } - - public ConnectorEntity createSinkConnector(Long clusterId, AddConnectionDTO addConnectionDTO) { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setName(addConnectionDTO.getSinkName()); - connectorEntity.setHost(addConnectionDTO.getSinkHost()); - connectorEntity.setClusterId(clusterId); - connectorEntity.setClassName(addConnectionDTO.getSinkClass()); - connectorEntity.setType("Connector"); - connectorEntity.setStatus(1); - connectorEntity.setPodState(0); - connectorEntity.setPort(addConnectionDTO.getSinkPort()); - connectorMapper.insert(connectorEntity); - return connectorEntity; - } - - public ConnectorEntity createSourceConnector(Long clusterId, AddConnectionDTO addConnectionDTO) { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setName(addConnectionDTO.getSourceName()); - connectorEntity.setHost(addConnectionDTO.getSourceHost()); - connectorEntity.setClusterId(clusterId); - connectorEntity.setClassName(addConnectionDTO.getSourceClass()); - connectorEntity.setType("Connector"); - connectorEntity.setStatus(1); - connectorEntity.setPodState(0); - connectorEntity.setPort(addConnectionDTO.getSourcePort()); - connectorMapper.insert(connectorEntity); - return connectorEntity; - } - - - @Override - public List getAllConnections() { - return connectionMapper.selectAll(); - } - - public ConnectionEntity setSearchCriteria(GetConnectionListDTO getConnectionListDTO, ConnectionEntity connectionEntity) { - connectionEntity.setTopic(getConnectionListDTO.getTopicName()); - return connectionEntity; - } - - @Override - public List getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO) { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setClusterId(clusterId); - connectionEntity = this.setSearchCriteria(getConnectionListDTO, connectionEntity); - List allConnectionsByClusterId = connectionMapper.selectToFrontByClusterId(connectionEntity); - List connectionListVOs = new ArrayList<>(); - allConnectionsByClusterId.forEach(n -> { - connectionListVOs.add(this.setConnectionListVO(n)); - }); - return connectionListVOs; - } - - private ConnectionListVO setConnectionListVO(ConnectionEntity connectionEntity) { - ConnectionListVO connectionListVO = new ConnectionListVO(); - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setId(connectionEntity.getSinkId()); - ConnectorEntity sinkConnector = connectorMapper.selectById(connectorEntity); - connectorEntity.setId(connectionEntity.getSourceId()); - ConnectorEntity sourceConnector = connectorMapper.selectById(connectorEntity); - connectionListVO.setSinkClass(sinkConnector.getClassName()); - connectionListVO.setSourceClass(sourceConnector.getClassName()); - connectionListVO.setSinkConnectorId(sinkConnector.getId()); - connectionListVO.setSourceConnectorId(sourceConnector.getId()); - connectionListVO.setSinkConnectorName(sinkConnector.getName()); - connectionListVO.setSourceConnectorName(sourceConnector.getName()); - connectionListVO.setTopicName(connectionEntity.getTopic()); - connectionListVO.setStatus(connectionEntity.getStatus()); - return connectionListVO; - } - - - @Override - public List getConnectorConfigsByClassAndVersion(String classType, String version) { - ConfigEntity config = new ConfigEntity(); - config.setBusinessType(classType); - List configEntityList = configMapper.selectConnectorConfigsByBusinessType(config); - configEntityList.forEach(n -> { - if (!n.matchVersion(version)) { - configEntityList.remove(n); - } - }); - return configEntityList; - } -} - 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/function/ConfigService.java similarity index 93% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java index 3be1c537..9f9e126c 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/function/ConfigService.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config; +package org.apache.eventmesh.dashboard.console.service.function; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO; import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; @@ -54,5 +54,4 @@ public interface ConfigService { Map selectDefaultConfig(String version, Long instanceId, Integer instanceType); - } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java index b90c9d26..7469482c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataService.java @@ -15,12 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.health; +package org.apache.eventmesh.dashboard.console.service.function; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; /** @@ -30,7 +31,7 @@ public interface HealthDataService { InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType); - List getInstanceLiveStatusHistory(Integer type, Long clusterId, Timestamp startTime); + List getInstanceLiveStatusHistory(Integer type, Long clusterId, LocalDateTime startTime); HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataServiceMemoryStorage.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataServiceMemoryStorage.java similarity index 83% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataServiceMemoryStorage.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataServiceMemoryStorage.java index 85a2667f..43b99760 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataServiceMemoryStorage.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/HealthDataServiceMemoryStorage.java @@ -15,11 +15,12 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.health; +package org.apache.eventmesh.dashboard.console.service.function; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -36,7 +37,7 @@ public class HealthDataServiceMemoryStorage { public HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity) { lock.writeLock().lock(); try { - healthCheckResultEntity.setCreateTime(new Timestamp(System.currentTimeMillis())); + healthCheckResultEntity.setCreateTime(LocalDateTime.now()); cache.add(healthCheckResultEntity); return healthCheckResultEntity; } finally { @@ -49,7 +50,7 @@ public void batchInsertHealthCheckResult(List healthChe lock.writeLock().lock(); try { for (HealthCheckResultEntity entity : healthCheckResultEntityList) { - entity.setCreateTime(new Timestamp(System.currentTimeMillis())); + entity.setCreateTime(LocalDateTime.now()); cache.add(entity); } } finally { @@ -63,9 +64,10 @@ public List queryHealthCheckResultByClusterIdAndTimeRan try { List result = new ArrayList<>(); for (HealthCheckResultEntity entity : cache) { - if (entity.getClusterId().equals(clusterId) && entity.getCreateTime().after(startTime) && entity.getCreateTime().before(endTime)) { - result.add(entity); - } + result.add(entity); + //if (entity.getClusterId().equals(clusterId) && entity.getCreateTime().after(startTime) && entity.getCreateTime().before(endTime)) { + + //} } return result; } finally { 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/function/Impl/ConfigServiceImpl.java similarity index 96% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/ConfigServiceImpl.java index b3e06d65..90236d4a 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/function/Impl/ConfigServiceImpl.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.Impl; +package org.apache.eventmesh.dashboard.console.service.function.Impl; import org.apache.eventmesh.dashboard.console.annotation.EmLog; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.config.DefaultConfigKey; -import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper; +import org.apache.eventmesh.dashboard.console.entity.DefaultConfigKey; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; +import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper; import org.apache.eventmesh.dashboard.console.modle.dto.config.ChangeConfigDTO; import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; import org.apache.eventmesh.dashboard.console.modle.dto.config.UpdateConfigsLog; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; +import org.apache.eventmesh.dashboard.console.service.function.ConfigService; import java.util.Arrays; import java.util.HashMap; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java similarity index 90% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java index 41e0dfc6..03a36cae 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java @@ -15,19 +15,20 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.health.impl; +package org.apache.eventmesh.dashboard.console.service.function.Impl; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache; -import org.apache.eventmesh.dashboard.console.mapper.health.HealthCheckResultMapper; -import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper; -import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper; +import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper; +import org.apache.eventmesh.dashboard.console.mapper.function.HealthCheckResultMapper; +import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper; import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -93,7 +94,7 @@ public InstanceLiveProportionVo getRuntimeLiveProportion(Long clusterId) { @Override - public List getInstanceLiveStatusHistory(Integer type, Long instanceId, Timestamp startTime) { + public List getInstanceLiveStatusHistory(Integer type, Long instanceId, LocalDateTime startTime) { HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(); healthCheckResultEntity.setType(type); healthCheckResultEntity.setTypeId(instanceId); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java similarity index 86% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java index 33096eeb..7e0f2cf1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/LogServiceImpl.java @@ -15,11 +15,12 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.log; +package org.apache.eventmesh.dashboard.console.service.function.Impl; -import org.apache.eventmesh.dashboard.console.entity.log.LogEntity; -import org.apache.eventmesh.dashboard.console.mapper.log.OprLogMapper; +import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; +import org.apache.eventmesh.dashboard.console.mapper.function.OprLogMapper; import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; +import org.apache.eventmesh.dashboard.console.service.function.LogService; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java similarity index 89% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java index 4db80fed..88d4f1bd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/log/LogService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/LogService.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.log; +package org.apache.eventmesh.dashboard.console.service.function; -import org.apache.eventmesh.dashboard.console.entity.log.LogEntity; +import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; import java.util.List; 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/message/GroupMemberService.java similarity index 87% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/GroupMemberService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupMemberService.java index 25bdbeb1..f2a0aa87 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/message/GroupMemberService.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.groupmember; +package org.apache.eventmesh.dashboard.console.service.message; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity; import java.util.List; 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/message/GroupService.java similarity index 86% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/GroupService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/GroupService.java index 28c43e48..4227d38e 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/message/GroupService.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.group; +package org.apache.eventmesh.dashboard.console.service.message; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity; import java.util.List; 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/message/TopicService.java similarity index 60% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/TopicService.java index e3430527..796ee934 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/message/TopicService.java @@ -15,11 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.topic; +package org.apache.eventmesh.dashboard.console.service.message; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO; import java.util.List; @@ -29,29 +27,25 @@ */ public interface TopicService { - public List getTopicDetailGroups(Long topicId); + List getTopicDetailGroups(Long topicId); - void createTopic(CreateTopicDTO topicRequest); + void createTopic(TopicEntity topicEntity); void batchInsert(List topicEntities); List selectAll(); - List getTopicList(TopicEntity topicEntity); - void addTopic(TopicEntity topicEntity); void updateTopic(TopicEntity topicEntity); void deleteTopicById(TopicEntity topicEntity); - TopicEntity selectTopicById(Long topicId); - - TopicEntity selectTopicByUnique(TopicEntity topicEntity); + TopicEntity selectTopicById(TopicEntity topicEntity); - void deleteTopic(TopicEntity topicEntity); + Integer deleteTopic(TopicEntity topicEntity); - List selectTopiByCluster(Long clusterId); + List selectTopiByCluster(TopicEntity topicEntity); - List getTopicListToFront(Long clusterId, GetTopicListDTO getTopicListDTO); + List getTopicListToFront(TopicEntity topicEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/Impl/GroupMemberServiceImp.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java similarity index 88% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/Impl/GroupMemberServiceImp.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java index 2ce9fac1..9d85ac61 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/groupmember/Impl/GroupMemberServiceImp.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupMemberServiceImp.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.groupmember.Impl; +package org.apache.eventmesh.dashboard.console.service.message.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 org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity; +import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMemberMapper; +import org.apache.eventmesh.dashboard.console.service.message.GroupMemberService; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java similarity index 83% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java index c50ca055..c3c1a40f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/GroupServiceImpl.java @@ -15,16 +15,16 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.group.Impl; +package org.apache.eventmesh.dashboard.console.service.message.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 org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity; +import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMapper; +import org.apache.eventmesh.dashboard.console.service.message.GroupMemberService; +import org.apache.eventmesh.dashboard.console.service.message.GroupService; -import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -34,10 +34,10 @@ public class GroupServiceImpl implements GroupService { @Autowired - OprGroupMapper oprGroupMapper; + private OprGroupMapper oprGroupMapper; @Autowired - GroupMemberService groupMemberService; + private GroupMemberService groupMemberService; @Override public List selectAll() { @@ -88,7 +88,7 @@ public Integer insertMemberToGroup(GroupMemberEntity groupMemberEntity) { groupEntity1.setMembers(groupMemberEntity.getId() + "" + "," + groupEntity1.getMembers()); //Concatenate the members of the group groupEntity1.setMemberCount(groupEntity1.getMemberCount() + 1); - groupEntity1.setUpdateTime(new Timestamp(System.currentTimeMillis())); + groupEntity1.setUpdateTime(LocalDateTime.now()); oprGroupMapper.updateGroup(groupEntity1); return 1; //Modify the group member information @@ -104,7 +104,7 @@ public Integer deleteMemberFromGroup(GroupMemberEntity groupMemberEntity) { //^Obtain the group to which the member belongs groupEntity1.setMembers(groupEntity1.getMembers().replaceAll(groupMemberEntity.getId() + "" + ",", "")); groupEntity1.setMemberCount(groupEntity1.getMemberCount() - 1); - groupEntity1.setUpdateTime(new Timestamp(System.currentTimeMillis())); + groupEntity1.setUpdateTime(LocalDateTime.now()); oprGroupMapper.updateGroup(groupEntity1); return 1; } 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/message/impl/TopicServiceImpl.java similarity index 64% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/topic/TopicServiceImpl.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/message/impl/TopicServiceImpl.java index a9a88e22..47065762 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/message/impl/TopicServiceImpl.java @@ -15,25 +15,24 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.topic; +package org.apache.eventmesh.dashboard.console.service.message.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.entity.storage.StoreEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupMemberEntity; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache; -import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper; -import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper; -import org.apache.eventmesh.dashboard.console.mapper.groupmember.OprGroupMemberMapper; -import org.apache.eventmesh.dashboard.console.mapper.health.HealthCheckResultMapper; -import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper; +import org.apache.eventmesh.dashboard.console.mapper.cluster.RuntimeMapper; +import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper; +import org.apache.eventmesh.dashboard.console.mapper.function.HealthCheckResultMapper; +import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMapper; +import org.apache.eventmesh.dashboard.console.mapper.message.OprGroupMemberMapper; +import org.apache.eventmesh.dashboard.console.mapper.message.TopicMapper; import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper; -import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper; -import org.apache.eventmesh.dashboard.console.modle.dto.topic.CreateTopicDTO; import org.apache.eventmesh.dashboard.console.modle.dto.topic.GetTopicListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.topic.TopicDetailGroupVO; +import org.apache.eventmesh.dashboard.console.service.message.TopicService; import java.util.ArrayList; import java.util.List; @@ -68,12 +67,15 @@ public class TopicServiceImpl implements TopicService { @Override public List getTopicDetailGroups(Long topicId) { - TopicEntity topicEntity = this.selectTopicById(topicId); + TopicEntity topicEntity = new TopicEntity(); + topicEntity.setId(topicId); + topicEntity = this.selectTopicById(topicEntity); GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); groupMemberEntity.setClusterId(topicEntity.getClusterId()); groupMemberEntity.setTopicName(topicEntity.getTopicName()); List groupNamelist = oprGroupMemberMapper.selectGroupNameByTopicName(groupMemberEntity); ArrayList topicDetailGroupVOList = new ArrayList<>(); + TopicEntity finalTopicEntity = topicEntity; groupNamelist.forEach(n -> { TopicDetailGroupVO topicDetailGroupVO = new TopicDetailGroupVO(); topicDetailGroupVO.setGroupName(n); @@ -81,7 +83,7 @@ public List getTopicDetailGroups(Long topicId) { List list = oprGroupMemberMapper.selectTopicsByGroupNameAndClusterId(groupMemberEntity); topicDetailGroupVO.setTopics(list); GroupEntity groupEntity = new GroupEntity(); - groupEntity.setClusterId(topicEntity.getClusterId()); + groupEntity.setClusterId(finalTopicEntity.getClusterId()); groupEntity.setName(n); GroupEntity group = groupMapper.selectGroupByNameAndClusterId(groupEntity); topicDetailGroupVO.setMemberNum(group.getMemberCount()); @@ -93,16 +95,7 @@ public List getTopicDetailGroups(Long topicId) { @EmLog(OprType = "add", OprTarget = "topic") @Override - public void createTopic(CreateTopicDTO createTopicDTO) { - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setType(0); - topicEntity.setClusterId(createTopicDTO.getClusterId()); - topicEntity.setTopicName(createTopicDTO.getName()); - topicEntity.setDescription(createTopicDTO.getDescription()); - topicEntity.setRetentionMs(createTopicDTO.getSaveTime()); - StoreEntity storeEntity = new StoreEntity(); - storeEntity.setClusterId(topicEntity.getClusterId()); - topicEntity.setStorageId(storeMapper.selectStoreByCluster(storeEntity).getId()); + public void createTopic(TopicEntity topicEntity) { topicEntity.setCreateProgress(1); topicMapper.addTopic(topicEntity); } @@ -118,11 +111,6 @@ public List selectAll() { } - @Override - public List getTopicList(TopicEntity topicEntity) { - return topicMapper.getTopicList(topicEntity); - } - @Override public void addTopic(TopicEntity topicEntity) { GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); @@ -143,27 +131,18 @@ public void deleteTopicById(TopicEntity topicEntity) { } @Override - public TopicEntity selectTopicById(Long topicId) { - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setId(topicId); + public TopicEntity selectTopicById(TopicEntity topicEntity) { return topicMapper.selectTopicById(topicEntity); } - @Override - public TopicEntity selectTopicByUnique(TopicEntity topicEntity) { - return topicMapper.selectTopicByUnique(topicEntity); - } - @Override - public void deleteTopic(TopicEntity topicEntity) { - topicMapper.deleteTopic(topicEntity); + public Integer deleteTopic(TopicEntity topicEntity) { + return topicMapper.deleteTopic(topicEntity); } @Override - public List selectTopiByCluster(Long clusterId) { - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setClusterId(clusterId); + public List selectTopiByCluster(TopicEntity topicEntity) { return topicMapper.selectTopicByCluster(topicEntity); } @@ -174,11 +153,8 @@ public TopicEntity setSearchCriteria(GetTopicListDTO getTopicListDTO, TopicEntit } @Override - public List getTopicListToFront(Long clusterId, GetTopicListDTO getTopicListDTO) { - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setClusterId(clusterId); - topicEntity = this.setSearchCriteria(getTopicListDTO, topicEntity); - List topicEntityList = topicMapper.getTopicsToFrontByClusterId(topicEntity); + public List getTopicListToFront(TopicEntity topicEntity) { + List topicEntityList = topicMapper.queryTopicsToFrontByClusterId(topicEntity); topicEntityList.forEach(n -> { n.setStatus(CheckResultCache.getINSTANCE().getLastHealthyCheckResult("topic", n.getId())); }); 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 f88d33d8..5fa6a87e 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 @@ -17,7 +17,7 @@ package org.apache.eventmesh.dashboard.console.service.store.Impl; -import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; +import org.apache.eventmesh.dashboard.console.entity.StoreEntity; import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper; import org.apache.eventmesh.dashboard.console.service.store.StoreService; 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 3442f721..14f8c521 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 @@ -17,7 +17,7 @@ package org.apache.eventmesh.dashboard.console.service.store; -import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; +import org.apache.eventmesh.dashboard.console.entity.StoreEntity; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java index fada3ea8..9a785fb7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java @@ -20,7 +20,6 @@ import org.apache.eventmesh.dashboard.console.config.FunctionManagerConfigs; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache; import org.apache.eventmesh.dashboard.console.function.health.HealthService; -import org.apache.eventmesh.dashboard.console.function.metadata.MetadataManager; import lombok.Getter; import lombok.Setter; @@ -42,10 +41,6 @@ public class FunctionManager { @Getter private HealthService healthService; - @Setter - @Getter - private MetadataManager metadataManager; - public void initFunctionManager() { //Health Check healthService = new HealthService(); @@ -54,10 +49,6 @@ public void initFunctionManager() { configs.getHealthCheck().getUpdateConfig().getPeriod(), properties.getDataServiceContainer()); healthService.startScheduledExecution(configs.getHealthCheck().getDoCheck().getInitialDelay(), configs.getHealthCheck().getDoCheck().getPeriod()); - - metadataManager = new MetadataManager(); - metadataManager.setUpSyncMetadataManager(properties.getSyncDataServiceWrapper(), properties.getMetadataHandlerWrapper()); - metadataManager.init(configs.getSync().getInitialDelay(), configs.getSync().getPeriod()); } } diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql index b8ed61b9..50056d01 100644 --- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql +++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql @@ -1,419 +1,325 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * 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 + * 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 + * 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. + * 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. */ -DROP TABLE IF EXISTS `cluster`; +drop table if exists `cluster`; create table cluster ( - id bigint unsigned auto_increment comment '集群id' - primary key, - name varchar(128) default '' not null comment '集群名称', - registry_address varchar(4096) default '' not null comment '注册中心名字', - bootstrap_servers varchar(2048) default '' not null comment 'server地址', - eventmesh_version varchar(32) default '' not null comment 'eventmesh版本', - client_properties text null comment 'EventMesh客户端配置', - jmx_properties text null comment 'JMX配置', - reg_properties text null comment '注册中心配置', - description text null comment '备注', - auth_type int default 0 not null comment '认证类型,-1未知,0:无认证,', - 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 '修改时间', - status int default 1 not null comment '0', - store_type int default 0 not null, - constraint uniq_name - unique (name) + id bigint unsigned primary key auto_increment comment '集群id', + name varchar(128) not null comment '集群名称', + cluster_type varchar(16) not null comment '集群类型', + trusteeship_type varchar(16) not null comment '托管类型', + version varchar(32) not null comment 'eventmesh版本', + jmx_properties text comment 'jmx配置', + description text comment '备注', + auth_type int not null default 0 comment '认证类型,-1未知,0:无认证,', + run_state tinyint not null default 1 comment '运行状态, 0表示未监控, 1监控中,有注册中心,2:监控中,无注册中心', + status int not null default 1 comment '0', + 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 comment '数据逻辑标记', + unique key uniq_name (name) ) comment '物理集群信息表'; -create index idx_uniq_name - on cluster (name); - -DROP TABLE IF EXISTS `config`; +drop table if exists `cluster_relationship`; +create table `cluster_relationship` +( + id bigint unsigned primary key auto_increment, + cluster_type varchar(16) not null comment '集群类型', + cluster_id bigint not null comment '集群id', + relationship_type varchar(16) not null comment '集群类型', + relationship_id bigint not null comment '集群id', + create_time timestamp not null default current_timestamp comment '创建时间', + update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间', + status int not null default 1 comment '0', + is_delete int not null default 0 comment '0', + unique key cluster_id_relationship_id_unique (`cluster_id`, `relationship_id`), + key cluster_id_key (`cluster_id`), + key relationship_id_key (`relationship_id`) +); + +drop table if exists `config`; create table config ( - id bigint unsigned auto_increment - primary key, - cluster_id bigint default -1 not null comment '集群ID', - business_type varchar(64) default '' not null comment '业务类型,storage:可选值(rocketmq,pravega,mongodb,pulsar,redis,kafka - ,knative,rabbitmq),sinkConnector:可选值(rocketmq,spring,pravega,wechat,openfunction,file,knative,pulsar,lark,slack,rabbitmq,redis,mongodb,dingtalk) - ,sourceConnector:可选值(rocketmq,spring,pravega,openfunction,jdbc,file,http,wecom,knative,pulsar,prometheus,rabbitmq,redis,mongodb)', - instance_type tinyint not null comment '实例类型 0:runtime,1:storage,2:connector,3:topic', - instance_id bigint default -1 not null comment '实例ID,上面配置对应的(比如runtime)的id', - 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 '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_modify int default 0 not null, - already_update int default 0 not null comment '0:no,1:yes', - eventmesh_version varchar(64) default ' ' not null, - constraint uniq_cluster_id_instance_type_instance_id_config_name - unique (instance_id, config_name, instance_type, cluster_id) -) - comment '配置信息表'; - -create index idx_phy_id_instance_id - on config (cluster_id, instance_id); - + id bigint unsigned auto_increment primary key, + cluster_id bigint not null comment '集群id', + instance_type tinyint not null comment '实例类型 0:runtime,1:storage,2:connector,3:topic', + instance_id bigint not null default -1 comment '实例id,上面配置对应的(比如runtime)的id,如果是-1,是cluster的配置', + config_type varchar(31) not null default '' comment '配置类型', + config_name varchar(192) not null comment '配置名称', + config_value text not null comment '配置值', + start_version varchar(64) not null default '' comment '配置开始使用的版本', + end_version varchar(64) not null default '' comment '配置结束使用的版本', + status int not null default 1 comment '0 关闭 1 开启 ', + is_default int not null default 1, + diff_type int not null default -1 comment '差异类型', + description varchar(1000) not null default '' comment '备注', + edit int not null default 1 comment '是否可以编辑 1 不可编辑(程序获取) 2 可编辑', + create_time timestamp not null default current_timestamp comment '创建时间', + update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间', + is_modify int not null default 0, + already_update int not null default 0 comment '0:no,1:yes', + is_delete int not null default 0 comment '0', + unique key uniq_cluster_id_instance_type_instance_id_config_name (instance_id, config_name, instance_type, cluster_id) +) comment '配置信息表'; 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); + id bigint unsigned primary key auto_increment comment 'id', + cluster_id bigint not null comment '集群id', + name varchar(192) not null comment 'group名称', + member_count int unsigned not null default '0' comment '成员数', + members text null comment 'group的member列表', + type tinyint not null comment 'group类型 0:consumer 1:producer', + 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 '修改时间', + status int not null default 1, + is_delete int not null default 0 comment '0', + unique key uniq_cluster_phy_id_name (cluster_id, name) +) comment 'group信息表'; 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); - + id bigint unsigned primary key auto_increment comment 'id', + 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 on update current_timestamp not null comment '修改时间', + status int default 1 not null, + is_delete int not null default 0 comment '0', + unique key uniq_cluster_topic_group (cluster_id, topic_name, group_name) +) comment 'groupmember信息表'; drop table if exists runtime; create table runtime ( - id bigint auto_increment comment 'id' - primary key, - cluster_id bigint default -1 not null comment '物理集群ID', - host varchar(128) default '' not null comment 'runtime主机名', - storage_cluster_id bigint default -1 not null comment 'storageId', - port int default -1 not null comment '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 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 '监听信息', - constraint uniq_cluster_phy_id__host_port - unique (cluster_id, host) -) comment 'Runtime信息表'; - -create index idx_phy_id_host_storage_id - on runtime (cluster_id, storage_cluster_id); - - -DROP TABLE IF EXISTS `store`; -create table store -( - id bigint unsigned auto_increment comment 'id' - primary key, - cluster_id bigint default -1 not null comment '物理集群ID', - store_type int default 0 not null comment 'Store类型, (0, "Standalone"), (1, "RocketMQ"), (2, "Kafka"), (3, "Pulsar"), (4, "RabbitMQ"), (5, "Redis");', - host varchar(128) default '' not null comment 'store主机名', - topic_list varchar(4096) default '' not null comment 'topicName列表', - diff_type int default -1 not null comment '差异类型', - port int default -1 not null comment '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 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 '监听信息' -) comment 'Store信息表'; - - -DROP TABLE IF EXISTS `instance_user`; -CREATE TABLE `instance_user` + id bigint primary key auto_increment comment 'id', + cluster_id bigint not null comment '物理集群id', + `name` varchar(128) not null comment 'runtime名称', + host varchar(128) not null comment 'runtime主机名', + port varchar(128) not null comment 'runtime端口', + jmx_port int not null default -1 comment 'jmx端口', + start_timestamp timestamp not null default current_timestamp comment '启动时间', + rack varchar(128) not null default '' comment 'rack信息', + status int not null default 1 comment '状态: 1启用,0未启用', + create_time timestamp not null default current_timestamp comment '创建时间', + update_time timestamp not null default current_timestamp on update current_timestamp comment '修改时间', + endpoint_map varchar(1024) not null default '' comment '监听信息', + is_delete int not null default 0 comment '0', + unique key uniq_cluster_phy_id__host_port (cluster_id, host) +) comment 'runtime信息表'; + +drop table if exists `client`; +create table `client` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `instance_type` int(255) NOT NULL DEFAULT 0 COMMENT '区分不同软件', - `password` varchar(100) NOT NULL DEFAULT '' COMMENT '密码', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '物理集群ID', - `name` varchar(192) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT '名称', - `token` varchar(8192) NOT NULL DEFAULT '' COMMENT '密钥', - `status` int default 1 not null comment '状态: 1启用,0未启用', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8 COMMENT ='Instance_User信息表'; - - - -DROP TABLE IF EXISTS `acl`; -CREATE TABLE `acl` + `id` bigint primary key auto_increment comment 'id', + `cluster_id` bigint not null default '-1' comment '集群id', + `name` varchar(192) not null default '' comment '客户端名称', + `platform` varchar(192) not null default '' comment '客户端平台', + `language` varchar(192) not null default '' comment '客户端语言', + `pid` bigint(22) not null default '-1' comment '客户端进程id', + `host` varchar(128) not null default '' comment '客户端地址', + `port` int(16) not null default -1 comment '客户端端口', + `protocol` varchar(192) not null default '' comment '协议类型', + `status` tinyint(4) unsigned not null default 1 comment '状态: 1启用,0未启用', + `config_ids` varchar(1024) not null default '' comment 'csv config id list, like:1,3,7', + `description` varchar(1024) not null default '' comment '客户端描述', + `create_time` timestamp not null default current_timestamp comment '创建时间', + `end_time` timestamp not null default current_timestamp comment '结束时间', + `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间', + index `idx_cluster_id` (`cluster_id`) +) comment ='client'; + +drop table if exists `net_connection`; +create table `net_connection` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', - `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群id', - `pattern` varchar(192) NOT NULL DEFAULT '' COMMENT 'Service User Pattern', - `operation` int(11) NOT NULL DEFAULT '0' COMMENT '操作,', - `permission_type` int(11) NOT NULL DEFAULT '0' COMMENT '权限类型(0:未知,1:任意,2:拒绝,3:允许)', - `host` varchar(192) NOT NULL DEFAULT '' COMMENT '', - `resource_type` int(11) NOT NULL DEFAULT '0' COMMENT '资源类型(0:未知,1:任意,10:Kafka Topic,11:Kafka Group;21:Rocketmq topic)', - `resource_name` varchar(192) NOT NULL DEFAULT '' COMMENT '资源名称', - `pattern_type` tinyint(4) NOT NULL COMMENT '匹配类型(0:未知,1:任意,2:Match,3:Literal,4:prefixed)', - `status` int NOT NULL DEFAULT 1 COMMENT '状态(0:删除,1:存在)', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`), - INDEX `idx_cluster_phy_id_principal_res_name` (`cluster_id`, `pattern`, `resource_name`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='ACL信息表'; - - - -DROP TABLE IF EXISTS `group`; -CREATE TABLE `group` + `id` bigint unsigned primary key auto_increment comment 'id', + `cluster_id` bigint unsigned not null default 0 comment '集群id', + `client_id` bigint unsigned not null comment '', + `client_host` varchar(192) not null comment 'client地址', + `client_port` int not null comment 'client 端口', + `runtime_id` bigint unsigned not null default 0 comment '对应runtime id', + `runtime_host` varchar(192) not null comment 'runtime地址', + `runtime_port` int not null comment 'runtime 端口', + `status` tinyint(4) unsigned not null default 1 comment '状态: 1 连接中, 2 断连', + `description` varchar(1024) not null default '' comment '客户端描述', + `connection_time` timestamp not null comment '连接时间', + `disconnect_time` timestamp not null comment '断连时间', + `create_time` timestamp not null default current_timestamp comment '创建时间', + `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间', + index `idx_cluster_id` (`cluster_id`), + index `idx_client_id` (`client_id`), + index `idx_runtime_id` (`runtime_id`) +) comment ='net_connection '; + +drop table if exists `instance_user`; +create table `instance_user` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群id', - `name` varchar(192) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'Group名称', - `member_count` int unsigned NOT NULL DEFAULT '0' COMMENT '成员数', - `members` varchar(1024) COMMENT 'group的member列表', - `type` tinyint NOT NULL COMMENT 'group类型 0:consumer 1:producer', - `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 '修改时间', - `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`) -) ENGINE = InnoDB - AUTO_INCREMENT = 322 - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='Group信息表'; - - -DROP TABLE IF EXISTS `group_member`; -CREATE TABLE `group_member` + `id` bigint unsigned primary key auto_increment comment 'id', + `instance_type` int(255) not null default 0 comment '区分不同软件', + `password` varchar(100) not null default '' comment '密码', + `cluster_id` bigint unsigned not null comment '物理集群id', + `name` varchar(192) not null default '' comment '名称', + `token` varchar(8192) not null default '' comment '密钥', + `status` int default 1 not null comment '状态: 1启用,0未启用', + `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 comment '0', + unique unique_cluster_name (cluster_id, name) +) engine = innodb + default charset = utf8 comment ='instance_user信息表'; + + + +drop table if exists `acl`; +create table `acl` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID', - `topic_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Topic名称', - `group_name` varchar(192) NOT NULL DEFAULT '' COMMENT 'Group名称', - `eventmesh_user` varchar(192) NOT NULL DEFAULT '' COMMENT 'EventMesh用户', - `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 '修改时间', - `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`) -) ENGINE = InnoDB - AUTO_INCREMENT = 257 - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='GroupMember信息表'; - - -DROP TABLE IF EXISTS `operation_log`; -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 '操作类型,如:启动,停止,重启,添加,删除,修改', - `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 '结束时间', - `operation_user` varchar(192) DEFAULT NULL, - `result` varchar(1024), - `target_type` varchar(192) NOT NULL, - `is_delete` int NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `idx_cluster_phy_id` (`cluster_id`), - KEY `idx_state` (`state`) -) ENGINE = InnoDB - AUTO_INCREMENT = 68 - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='操作记录信息表'; - - -DROP TABLE IF EXISTS `topic`; -CREATE TABLE `topic` + `id` bigint unsigned primary key auto_increment comment '自增id', + `cluster_id` bigint not null default '0' comment '集群id', + `pattern` varchar(192) not null default '' comment 'service user pattern', + `operation` int(11) not null default '0' comment '操作,', + `permission_type` int(11) not null default '0' comment '权限类型(0:未知,1:任意,2:拒绝,3:允许)', + `host` varchar(192) not null default '' comment '', + `resource_type` int(11) not null default '0' comment '资源类型(0:未知,1:任意,10:kafka topic,11:kafka group;21:rocketmq topic)', + `resource_name` varchar(192) not null default '' comment '资源名称', + `pattern_type` tinyint(4) not null comment '匹配类型(0:未知,1:任意,2:match,3:literal,4:prefixed)', + `status` int not null default 1 comment '状态(0:删除,1:存在)', + `create_time` timestamp not null default current_timestamp comment '创建时间', + `update_time` timestamp not null default current_timestamp on update current_timestamp comment '更新时间', + index `idx_cluster_phy_id_principal_res_name` (`cluster_id`, `pattern`, `resource_name`) +) comment ='acl信息表'; + + + +drop table if exists `group`; +create table `group` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint NOT NULL DEFAULT '-1' COMMENT '集群ID', - `topic_name` varchar(192) CHARACTER SET utf8mb4 - COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT 'Topic名称', - `storage_id` varchar(2048) NOT NULL DEFAULT '' COMMENT 'StorageId', - `retention_ms` bigint NOT NULL DEFAULT '-2' COMMENT '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms', - `type` tinyint NOT NULL DEFAULT '0' COMMENT 'Topic类型,默认0,0:普通,1:EventMesh内部', - `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实际创建时间一致)', - `status` int NOT NULL DEFAULT 1, - create_progress int NOT NULL DEFAULT 1 COMMENT '0:创建成功,1:创建中,2:创建失败', - PRIMARY KEY (`id`), - UNIQUE KEY `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`), - KEY `cluster_id` (`cluster_id`, `topic_name`) -) ENGINE = InnoDB - AUTO_INCREMENT = 562 - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='Topic信息表'; - - -DROP TABLE IF EXISTS `client`; -CREATE TABLE `client` + `id` bigint unsigned primary key auto_increment comment 'id', + `cluster_id` bigint not null default '-1' comment '集群id', + `name` varchar(192) not null default '' comment 'group名称', + `member_count` int unsigned not null default '0' comment '成员数', + `members` varchar(1024) not null default '' comment 'group的member列表', + `type` tinyint not null comment 'group类型 0:consumer 1:producer', + `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 '修改时间', + `status` int not null default 1, + unique key `uniq_cluster_phy_id_name` (`cluster_id`, `name`), + key `cluster_id` (`cluster_id`, `name`) +) comment ='group信息表'; + + +drop table if exists `group_member`; +create table `group_member` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', - `name` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端名称', - `platform` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端平台', - `language` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端语言', - `pid` bigint(22) NOT NULL DEFAULT '-1' COMMENT '客户端进程ID', - `host` varchar(128) NOT NULL DEFAULT '' COMMENT '客户端地址', - `port` int(16) NOT NULL DEFAULT '-1' COMMENT '客户端端口', - `protocol` varchar(192) NOT NULL DEFAULT '' COMMENT '协议类型', - `status` tinyint(4) unsigned NOT NULL DEFAULT 1 COMMENT '状态: 1启用,0未启用', - `config_ids` varchar(1024) NOT NULL DEFAULT '' COMMENT 'csv config id list, like:1,3,7', - `description` varchar(1024) NOT NULL DEFAULT '' COMMENT '客户端描述', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间', - `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - - PRIMARY KEY (`id`), - INDEX `idx_cluster_id` (`cluster_id`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='client is an SDK application that can produce or consume events.'; - - - -DROP TABLE IF EXISTS `connector`; -CREATE TABLE `connector` + `id` bigint unsigned primary key auto_increment comment 'id', + `cluster_id` bigint not null default '-1' comment '集群id', + `client_id` bigint unsigned not null comment '客服端id', + `topic_name` varchar(192) not null default '' comment 'topic名称', + `group_name` varchar(192) not null default '' comment 'group名称', + `eventmesh_user` varchar(192) not null default '' comment 'eventmesh用户', + `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 '修改时间', + `status` int not null default 1, + unique key `uniq_cluster_topic_group` (`cluster_id`, `topic_name`, `group_name`), + key `cluster_id` (`cluster_id`, `topic_name`, `group_name`) +) comment ='groupmember信息表'; + + +drop table if exists `operation_log`; +create table `operation_log` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', - `name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector名称', - `class_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector类', - `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Connector类型', - `host` varchar(128) NOT NULL DEFAULT '' COMMENT 'Connector地址', - `port` int(16) NOT NULL DEFAULT '-1' COMMENT 'Connector端口', - `status` tinyint(4) unsigned NOT NULL DEFAULT 1 COMMENT '状态: 1启用,0未启用', - `pod_state` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'k8s pod状态。0: pending;1: running;2: success;3: failed;4: unknown', - `config_ids` varchar(1024) NOT NULL DEFAULT '' COMMENT 'csv config id list, like:1,3,7', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - INDEX `idx_cluster_id` (`cluster_id`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='Connector信息表'; - -DROP TABLE IF EXISTS `connection`; -CREATE TABLE `connection` + `id` bigint unsigned primary key auto_increment, + `cluster_id` bigint not null default '-1' comment '物理集群id', + `operation_type` varchar(192) not null default '' comment '操作类型,如:启动,停止,重启,添加,删除,修改', + `state` int not null default '0' comment '操作状态 0:未知,1:执行中,2:成功,3:失败', + `content` varchar(1024) not null comment '备注信息', + `operation_user` varchar(192) not null comment '操作用', + `result` varchar(1024) not null comment '方法返回的 内容', + `target_type` varchar(192) not null comment '目标类型。group,topic', + `create_time` timestamp not null default current_timestamp comment '创建时间', + `end_time` timestamp not null default current_timestamp on update current_timestamp comment '结束时间', + `is_delete` int not null default '0', + key `idx_cluster_phy_id` (`cluster_id`) +) comment ='操作记录信息表'; + + +drop table if exists `topic`; +create table `topic` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', - `source_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'source类型,可以为client或source connector', - `source_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'client或source connector ID', - `sink_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'sink类型,可以为client或sink connector', - `sink_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'client或sink connector ID', - `runtime_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '对应runtime id', - `status` tinyint(4) unsigned NOT NULL DEFAULT 1 COMMENT '状态: 1启用,0未启用', - `topic` varchar(192) NOT NULL DEFAULT '' COMMENT 'topic name', - `group_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'GroupID', - `description` varchar(1024) NOT NULL DEFAULT '' COMMENT '客户端描述', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '结束时间', - `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - - PRIMARY KEY (`id`), - INDEX `idx_cluster_id` (`cluster_id`), - INDEX `idx_group_id` (`group_id`), - INDEX `idx_topic` (`topic`), - INDEX `idx_source_id` (`source_id`), - INDEX `idx_sink_id` (`sink_id`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='connection from event source to event sink. event source can be a source connector or a producer client.'; - -DROP TABLE IF EXISTS `health_check_result`; -CREATE TABLE `health_check_result` + `id` bigint unsigned primary key auto_increment comment 'id', + `cluster_id` bigint not null default '-1' comment '集群id', + `topic_name` varchar(192) not null default '' comment 'topic名称', + `status` int not null default 1, + `create_progress` int not null default 1 comment '0:创建成功,1:创建中,2:创建失败', + `retention_ms` bigint not null default '-2' comment '保存时间,-2:未知,-1:无限制,>=0对应时间,单位ms', + `type` tinyint not null default '0' comment 'topic类型,默认0,0:普通,1:eventmesh内部', + `description` varchar(1024) default '' comment '备注信息', + `create_time` timestamp not null default current_timestamp comment '创建时间(尽量与topic实际创建时间一致)', + `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间(尽量与topic实际创建时间一致)', + `is_delete` int not null default '0', + unique key `uniq_cluster_phy_id_topic_name` (`cluster_id`, `topic_name`) +) comment ='topic信息表'; + + + +drop table if exists `connector`; +create table `connector` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', - `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', - `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 '更新时间', - PRIMARY KEY (`id`), - INDEX `idx_cluster_id` (`cluster_id`), - INDEX `idx_type` (`type`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='健康检查结果'; - -DROP TABLE IF EXISTS `meta`; -CREATE TABLE `meta` + `id` bigint unsigned primary key auto_increment comment 'id', + `cluster_id` bigint not null default '-1' comment '集群id', + `name` varchar(512) not null default '' comment 'connector名称', + `class_name` varchar(512) not null default '' comment 'connector类', + `type` varchar(32) not null default '' comment 'connector类型', + `host` varchar(128) not null default '' comment 'connector地址', + `port` int(16) not null default '-1' comment 'connector端口', + `status` tinyint(4) unsigned not null default 1 comment '状态: 1启用,0未启用', + `pod_state` tinyint(4) unsigned not null default '0' comment 'k8s pod状态。0: pending;1: running;2: success;3: failed;4: unknown', + `config_ids` varchar(1024) not null default '' comment 'csv config id list, like:1,3,7', + `create_time` timestamp not null default current_timestamp comment '创建时间', + `update_time` timestamp not null default current_timestamp on update current_timestamp comment '修改时间', + index `idx_cluster_id` (`cluster_id`) +) comment ='connector信息表'; + + + +drop table if exists `health_check_result`; +create table `health_check_result` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `name` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心名称', - `type` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心类型,nacos,etcd,zookeeper', - `version` varchar(128) NOT NULL DEFAULT '' COMMENT '注册中心版本', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', - `host` varchar(128) NOT NULL DEFAULT '' COMMENT '注册中心地址', - `port` int(16) NOT NULL DEFAULT '-1' COMMENT '注册中心端口', - `role` varchar(16) NOT NULL DEFAULT '-1' COMMENT '角色, leader follower observer', - `username` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心用户名', - `params` varchar(192) NOT NULL DEFAULT '' COMMENT '注册中心启动参数', - `status` tinyint(4) unsigned NOT NULL DEFAULT 1 COMMENT '状态: 1启用,0未启用', - - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - UNIQUE KEY `uniq_cluster_host_port` (`cluster_id`, `host`, `port`), - PRIMARY KEY (`id`), - INDEX `idx_cluster_id` (`cluster_id`) - -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4, - DEFAULT COLLATE = utf8mb4_bin COMMENT ='注册中心信息表'; + `id` bigint unsigned primary key auto_increment comment '自增id', + `type` tinyint(4) not null default '0' comment '检查维度(0:未知, 1:cluster, 2:runtime, 3:topic)', + `type_id` bigint unsigned not null comment '对应检查维度的实例id', + `cluster_id` bigint not null default '0' comment '集群id', + `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 '更新时间', + index `idx_cluster_id` (`cluster_id`), + index `idx_type` (`type`) +) comment ='健康检查结果'; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java index 1f7fb0db..a2f3ac4d 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java @@ -17,38 +17,11 @@ package org.apache.eventmesh.dashboard.console; -import org.apache.eventmesh.dashboard.common.enums.RecordStatus; - -import java.sql.Timestamp; - -import static org.mockito.ArgumentMatchers.any; - -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResponse; -import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult; -import org.apache.eventmesh.dashboard.console.cache.ClusterCache; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.RuntimeSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; -import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; -import org.apache.eventmesh.dashboard.service.remoting.MetaRemotingService; - -import java.util.ArrayList; -import java.util.List; import java.util.Objects; -import java.util.concurrent.CompletableFuture; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.jdbc.Sql; @@ -74,15 +47,13 @@ }) class EventMeshDashboardApplicationTest { - @Autowired - private RegistryDataService registryDataService; @Test public void IntegrationTest() throws InterruptedException { //To make a test, add cluster with registry address ip:port in web endpoint if (Objects.equals(System.getenv("APPLICATION_TEST"), "on")) { - EventMeshDashboardApplication.main(new String[]{}); + EventMeshDashboardApplication.main(new String[] {}); Thread.sleep(1000 * 60 * 10); } } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java deleted file mode 100644 index d9e02025..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.cache; - -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; - -import org.junit.jupiter.api.BeforeAll; - -public class ClusterCacheBase { - @BeforeAll - public static void addTestCluster() { - ClusterEntity clusterEntity = new ClusterEntity(); - clusterEntity.setName("cluster1"); - clusterEntity.setRegistryAddress("registryList"); - clusterEntity.setBootstrapServers("server"); - clusterEntity.setEventmeshVersion("1.7.0"); - clusterEntity.setClientProperties(""); - clusterEntity.setJmxProperties(""); - clusterEntity.setRegProperties(""); - clusterEntity.setDescription(""); - clusterEntity.setAuthType(0); - clusterEntity.setRunState(0); - clusterEntity.setStatus(0); - clusterEntity.setStoreType(0); - clusterEntity.setId(0L); - clusterEntity.setClusterId(0L); - - clusterEntity.setId(1L); - ClusterCache.getINSTANCE().addCluster(clusterEntity); - } -} diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java deleted file mode 100644 index 04ec8b8d..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.cache; -import java.sql.Timestamp; - -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public class ClusterCacheTest { - - @Test - public void testInsertAndDelete() { - ClusterEntity clusterEntity = new ClusterEntity(); - clusterEntity.setName("cl1"); - clusterEntity.setRegistryAddress("registryList"); - clusterEntity.setBootstrapServers("server"); - clusterEntity.setEventmeshVersion("1.7.0"); - clusterEntity.setClientProperties(""); - clusterEntity.setJmxProperties(""); - clusterEntity.setRegProperties(""); - clusterEntity.setDescription(""); - clusterEntity.setAuthType(0); - clusterEntity.setRunState(0); - clusterEntity.setStatus(0); - clusterEntity.setStoreType(0); - clusterEntity.setId(0L); - clusterEntity.setClusterId(0L); - - ClusterCache.getINSTANCE().addCluster(clusterEntity); - ClusterEntity clusterEntity1 = ClusterCache.getINSTANCE().getClusterById(clusterEntity.getId()); - ClusterEntity clusterEntity2 = ClusterCache.getINSTANCE().getClusterByName(clusterEntity.getName()); - Assertions.assertEquals(clusterEntity1, clusterEntity2); - Assertions.assertEquals(clusterEntity1.getName(), clusterEntity.getName()); - Assertions.assertEquals("registryList", clusterEntity1.getRegistryAddress()); - } -} \ No newline at end of file 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 000abbcb..964126ef 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 @@ -25,13 +25,11 @@ import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckStatus; import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback; import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService; import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; -import org.apache.eventmesh.dashboard.console.spring.support.FunctionManager; -import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; import java.util.concurrent.CompletableFuture; @@ -45,7 +43,6 @@ import org.mockito.stubbing.Answer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -58,20 +55,16 @@ @Timeout(value = 5) class HealthExecutorTest { - private HealthExecutor healthExecutor = new HealthExecutor(); - private CheckResultCache memoryCache = CheckResultCache.getINSTANCE(); - @Autowired HealthDataService healthDataService; - @Mock AbstractHealthCheckService successHealthCheckService; - @Mock AbstractHealthCheckService failHealthCheckService; - @Mock AbstractHealthCheckService timeoutHealthCheckService; + private HealthExecutor healthExecutor = new HealthExecutor(); + private CheckResultCache memoryCache = CheckResultCache.getINSTANCE(); @BeforeEach public void initMock() { diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthServiceTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthServiceTest.java index 2c30f32a..0d5f5bd2 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthServiceTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthServiceTest.java @@ -20,7 +20,7 @@ import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback; import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService; import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManagerTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManagerTest.java deleted file mode 100644 index f283489c..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManagerTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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.function.metadata; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.MetadataServiceWrapper.SingleMetadataServiceWrapper; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.RuntimeMetadataHandlerToDbImpl; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster.RuntimeSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.function.optration.TopicMetadataHandlerToClusterImpl; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; - -import java.util.Collections; -import java.util.List; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mockito; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import lombok.extern.slf4j.Slf4j; - -@ExtendWith(MockitoExtension.class) -@ExtendWith(SpringExtension.class) -@ActiveProfiles("test") -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Slf4j -class MetadataManagerTest extends ClusterCacheBase { - - private final MetadataManager metadataManager = new MetadataManager(); - private static RuntimeMetadata runtimeMetadata = new RuntimeMetadata(); - private static TopicEntity topicEntity = new TopicEntity(); - - private SyncDataService sourceService1 = Mockito.mock(RuntimeSyncFromClusterService.class); - @Autowired - private RuntimeMetadataHandlerToDbImpl targetService1; - - @Autowired - private SyncDataService sourceService2; - - MetadataHandler targetService2 = Mockito.mock(TopicMetadataHandlerToClusterImpl.class); - @Autowired - private RuntimeService runtimeService; - - @BeforeAll - public static void init() { - topicEntity.setClusterId(0L); - topicEntity.setTopicName(""); - topicEntity.setStorageId(0L); - topicEntity.setRetentionMs(0L); - topicEntity.setType(0); - topicEntity.setDescription(""); - topicEntity.setId(0L); - topicEntity.setClusterId(0L); - - runtimeMetadata.setHost("0.0.0.0"); - runtimeMetadata.setPort(1000); - runtimeMetadata.setJmxPort(0); - runtimeMetadata.setRack(""); - runtimeMetadata.setEndpointMap(""); - runtimeMetadata.setStorageClusterId(0L); - runtimeMetadata.setStartTimestamp(0L); - runtimeMetadata.setClusterName(""); - runtimeMetadata.setRegistryAddress(""); - runtimeMetadata.setClusterId(0L); - - } - - @BeforeEach - public void initManager() { - - Mockito.when(sourceService1.getData()).thenReturn(Collections.singletonList(runtimeMetadata)); - - Mockito.doNothing().when(targetService2).addMetadataObject(Mockito.any()); - Mockito.doNothing().when(targetService2).addMetadata(Mockito.any(List.class)); - - MetadataServiceWrapper metadataServiceWrapper = new MetadataServiceWrapper(); - metadataServiceWrapper.setDbToService( - new MetadataServiceWrapper.SingleMetadataServiceWrapper(true, sourceService1, targetService1)); - - metadataServiceWrapper.setServiceToDb(new SingleMetadataServiceWrapper(true, sourceService1, targetService1)); - metadataServiceWrapper.setServiceToDb(new SingleMetadataServiceWrapper(false, sourceService2, targetService2)); - - metadataManager.addMetadataService(metadataServiceWrapper); - } - - @Test - public void testMetadataToDb() throws InterruptedException { - metadataManager.run(true, false); - Thread.sleep(2000); - List runtimeEntities = runtimeService.selectAll(); - assertEquals(1000, runtimeEntities.get(runtimeEntities.size() - 1).getPort()); - } - - @Test - public void testMetadataToService() throws InterruptedException { - metadataManager.run(false, true); - Thread.sleep(2000); - } - - @Test - public void testUpdateMetadata() throws InterruptedException { - metadataManager.run(true, false); - Thread.sleep(2000); - - runtimeMetadata.setHost("1.1.1.1"); - Mockito.when(sourceService1.getData()).thenReturn(Collections.emptyList()); - metadataManager.run(true, false); - Thread.sleep(2000); - - metadataManager.run(true, false); - Thread.sleep(2000); - List runtimeEntities = runtimeService.selectAll(); - assertEquals(1, runtimeEntities.size()); - } - - @Test - public void testDeleteMetadata() throws InterruptedException { - metadataManager.run(true, false); - Thread.sleep(2000); - runtimeMetadata.setHost("1.1.1.1"); - Mockito.when(sourceService1.getData()).thenReturn(Collections.singletonList(runtimeMetadata)); - metadataManager.run(true, false); - Thread.sleep(2000); - List runtimeEntities = runtimeService.selectAll(); - assertEquals(1, runtimeEntities.size()); - } - -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java deleted file mode 100644 index ae0bb206..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.function.metadata.handler.db; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.apache.eventmesh.dashboard.common.enums.StoreType; -import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; - -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@ActiveProfiles("test") -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:client-test.sql") -class ClusterMetadataHandlerToDbImplTest { - - @Autowired - MetadataHandler clusterMetadataHandlerToDb; - - @Autowired - ClusterService clusterDataService; - - @Test - public void testAddMetadata() { - ClusterMetadata clusterMetadata = new ClusterMetadata(); - clusterMetadata.setClusterName("cluster"); - clusterMetadata.setDescription(""); - clusterMetadata.setAuthType(0); - clusterMetadata.setRunState(0); - clusterMetadata.setBootstrapServers(""); - clusterMetadata.setRegistryAddress(""); - clusterMetadata.setClientProperties("test-property"); - clusterMetadata.setJmxProperties(""); - clusterMetadata.setEventmeshVersion(""); - clusterMetadata.setStoreType(StoreType.REDIS); - clusterMetadataHandlerToDb.addMetadata(clusterMetadata); - List results = clusterDataService.selectAll(); - assertEquals("test-property", results.get(results.size() - 1).getClientProperties()); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImplTest.java index e2ed477e..ca25df2d 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImplTest.java @@ -19,7 +19,7 @@ import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; +import org.apache.eventmesh.dashboard.console.service.function.ConfigService; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java index 36ba8f2d..1057cab5 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java @@ -21,13 +21,13 @@ import org.apache.eventmesh.dashboard.common.model.metadata.ConnectionMetadata; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ClientEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.client.ClientDataService; -import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; +import org.apache.eventmesh.dashboard.console.service.cluster.ClientDataService; +import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService; import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java index 883e08be..acfacb2f 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java @@ -21,9 +21,9 @@ import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.group.GroupService; +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.service.message.GroupService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java deleted file mode 100644 index cb47f977..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.function.metadata.handler.db; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.apache.eventmesh.dashboard.common.model.metadata.RegistryMetadata; -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; - -import java.util.List; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@ActiveProfiles("test") -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:meta-test.sql") -class RegistryMetadataHandlerToDbImplTest extends ClusterCacheBase { - - @Autowired - private MetadataHandler registryMetadataHandlerToDb; - - private RegistryMetadata registryMetadata; - - @Autowired - private RegistryDataService registryDataService; - - @BeforeEach - public void initData() { - registryMetadata = new RegistryMetadata(); - registryMetadata.setClusterName("cluster1"); - registryMetadata.setClusterId(1L); - registryMetadata.setName("registry1"); - registryMetadata.setType("nacos"); - registryMetadata.setVersion("1.0.0"); - registryMetadata.setHost("192.168.3.10"); - registryMetadata.setPort(8848); - registryMetadata.setRole("leader"); - registryMetadata.setUsername("nacos"); - registryMetadata.setParams("a=1&b=2"); - } - - @Test - public void testAddMetadata() { - registryMetadataHandlerToDb.addMetadata(registryMetadata); - List metaEntities = registryDataService.selectAll(); - MetaEntity meta = metaEntities.get(metaEntities.size() - 1); - assertEquals("registry1", meta.getName()); - assertEquals(1L, meta.getClusterId()); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java index 26bf690f..f87cc141 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java @@ -21,10 +21,10 @@ import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; +import org.apache.eventmesh.dashboard.console.entity.cluster.RuntimeEntity; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; +import org.apache.eventmesh.dashboard.console.service.cluster.RuntimeService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java index 0d5efad6..0e996c93 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java @@ -23,8 +23,9 @@ import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandler; -import org.apache.eventmesh.dashboard.console.service.topic.TopicService; +import org.apache.eventmesh.dashboard.console.entity.message.TopicEntity; +import org.apache.eventmesh.dashboard.console.service.message.TopicService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -61,9 +62,10 @@ public void testAddMetadata() { topicMetadata.setDescription("function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java"); topicMetadata.setRetentionMs(-1L); topicMetadataHandlerToDb.addMetadata(topicMetadata); - + TopicEntity topicEntity = new TopicEntity(); + topicEntity.setId(135L); assertEquals("function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java", - topicService.selectTopiByCluster(135L).get(0).getDescription()); + topicService.selectTopiByCluster(topicEntity).get(0).getDescription()); } } \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterServiceTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterServiceTest.java deleted file mode 100644 index 68bcbd02..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterServiceTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.function.metadata.syncservice.cluster; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResponse; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult; -import org.apache.eventmesh.dashboard.console.cache.RuntimeCache; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; - -import java.util.Arrays; -import java.util.concurrent.CompletableFuture; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mockito; -import org.mockito.junit.jupiter.MockitoExtension; - -@ExtendWith(MockitoExtension.class) -class TopicSyncFromClusterServiceTest { - - private static TopicSyncFromClusterService topicSyncFromManagerService = new TopicSyncFromClusterService(); - - private static TopicRemotingService topicRemotingService = Mockito.mock(TopicRemotingService.class); - - @BeforeAll - public static void initMock() { - Mockito.when(topicRemotingService.getAllTopics(Mockito.any())).thenAnswer(invocation -> { - GetTopicsResponse getTopicsResponse = new GetTopicsResponse(); - getTopicsResponse.setTopicMetadataList(Arrays.asList(new TopicMetadata())); - GetTopicsResult getTopicsResult = new GetTopicsResult(); - getTopicsResult.setGetTopicsResponseFuture(CompletableFuture.completedFuture(getTopicsResponse) - .thenApply(response -> { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return response; - })); - return getTopicsResult; - }); - topicSyncFromManagerService.setTopicRemotingService(topicRemotingService); - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime2"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime3"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime4"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime5"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - } - - @Test - public void testGetData() { - long start = System.nanoTime(); - topicSyncFromManagerService.getData(); - long end = System.nanoTime(); - assertTrue((end - start) < 2000_000_000L); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java index 98b5b268..1a16de2c 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java @@ -18,11 +18,11 @@ package org.apache.eventmesh.dashboard.console.integration.health; import org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; +import org.apache.eventmesh.dashboard.console.entity.function.HealthCheckResultEntity; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache; import org.apache.eventmesh.dashboard.console.function.health.HealthService; import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig; -import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; +import org.apache.eventmesh.dashboard.console.service.function.HealthDataService; import java.util.List; @@ -41,13 +41,11 @@ @Timeout(value = 10) public class HealthServiceIntegrateTest { + private final CheckResultCache checkResultCache = CheckResultCache.getINSTANCE(); HealthService healthService = new HealthService(); - @Autowired private HealthDataService healthDataService; - private final CheckResultCache checkResultCache = CheckResultCache.getINSTANCE(); - @BeforeEach void init() { healthService.createExecutor(healthDataService, checkResultCache); @@ -56,12 +54,12 @@ void init() { @Test void testStorageRedis() throws InterruptedException { HealthCheckObjectConfig config = HealthCheckObjectConfig.builder() - .clusterId(1L) - .instanceId(1L) - .healthCheckResourceType("storage") - .healthCheckResourceSubType("redis") - .connectUrl("redis://localhost:6379") - .build(); + .clusterId(1L) + .instanceId(1L) + .healthCheckResourceType("storage") + .healthCheckResourceSubType("redis") + .connectUrl("redis://localhost:6379") + .build(); healthService.insertCheckService(config); healthService.executeAll(); Thread.sleep(1000); 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 82ae51e9..ad7c44af 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 @@ -18,11 +18,11 @@ package org.apache.eventmesh.dashboard.console.linkage.log; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.console.entity.log.LogEntity; +import org.apache.eventmesh.dashboard.console.entity.message.GroupEntity; +import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; -import org.apache.eventmesh.dashboard.console.service.group.GroupService; -import org.apache.eventmesh.dashboard.console.service.log.LogService; +import org.apache.eventmesh.dashboard.console.service.message.GroupService; +import org.apache.eventmesh.dashboard.console.service.function.LogService; import java.util.List; @@ -45,9 +45,18 @@ public class TestOprLog { @Test public void testGroupServiceOprLog() { - GroupEntity groupEntity = new GroupEntity(null, 1L, "logTest", 0, null, 1, "OK", null, null, 0); + GroupEntity groupEntity = new GroupEntity(); + groupEntity.setClusterId(1L); + groupEntity.setName("logTest"); + groupEntity.setStatus(1); + groupEntity.setType(0); + groupEntity.setState("OS"); groupService.addGroup(groupEntity); - LogEntity logEntity = new LogEntity(null, 1L, "add", "Group", 2, groupEntity.toString(), null, null, null, null); + LogEntity logEntity = new LogEntity(); + logEntity.setClusterId(1L); + logEntity.setOperationType("add"); + logEntity.setOperationUser("Group"); + logEntity.setContent(groupEntity.toString()); logEntity.setResult(groupEntity.toString()); logEntity.setId(groupEntity.getId()); List logListByCluster = logService.getLogListByCluster(new GetLogListDTO()); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java deleted file mode 100644 index b9edc8ef..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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.mapper.acl; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:acl-test.sql") - -public class AclMapperTest { - - @Autowired - private AclMapper aclMapper; - - @Test - public void testBatchInsert() { - - List aclEntities = new ArrayList<>(); - for (int i = 7; i < 10; i++) { - AclEntity aclEntity = new AclEntity(); - - aclEntity.setClusterId(1L); - aclEntity.setPattern("pattern1"); - aclEntity.setOperation(0); - aclEntity.setPermissionType(1); - aclEntity.setHost("127.0.0.1"); - aclEntity.setResourceType(1); - aclEntity.setResourceName("2"); - aclEntity.setPatternType(1); - aclEntities.add(aclEntity); - } - - aclMapper.batchInsert(aclEntities); - assertEquals(3, aclEntities.size()); - // aclEntities.size()返回的是新加的size,是3,而不是acl表中总的size,是5 - } - - @Test - public void testInsert() { -// AclEntity aclEntity = new AclEntity("", 0, "0", "", "0", "source_name", 1); - AclEntity aclEntity = new AclEntity(); - aclEntity.setClusterId(0L); - aclEntity.setPattern("pattern1"); - aclEntity.setOperation(0); - aclEntity.setPermissionType(1); - aclEntity.setHost("host"); - aclEntity.setResourceType(1); - aclEntity.setResourceName("resn"); - aclEntity.setPatternType(0); - aclEntity.setStatus(0); - aclEntity.setId(0L); - aclEntity.setClusterId(0L); - - aclMapper.insert(aclEntity); - assertNotNull(aclEntity); - assertEquals(5, aclEntity.getId()); - } - - @Test - public void testDelete() { - AclEntity aclEntity = new AclEntity(); - aclEntity.setId(4L); - aclMapper.deleteById(aclEntity); - assertEquals(4, aclEntity.getId()); - // 删除的就是id=4这条数据 - // 通过改status为0,实现删除 - } - - @Test - public void testUpdate() { - AclEntity aclEntity = new AclEntity(); - aclEntity.setId(3L); - aclEntity.setResourceType(10); - aclMapper.updateResourceTypeById(aclEntity); - aclEntity = aclMapper.selectById(aclEntity); - assertEquals(10, aclEntity.getResourceType()); - } - - @Test - public void testSelect() { - AclEntity aclEntity = new AclEntity(); - aclEntity.setId(3L); - aclMapper.selectById(aclEntity); - assertEquals(3, aclEntity.getId()); - } - -} diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapperTest.java deleted file mode 100644 index 58af7835..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/client/ClientMapperTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.mapper.client; - -import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; - -import java.util.List; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:client-test.sql") -class ClientMapperTest { - - @Autowired - private ClientMapper clientMapper; - - @Test - public void testSelectById() { - ClientEntity clientEntity = new ClientEntity(); - clientEntity.setId(1L); - ClientEntity result = clientMapper.selectById(clientEntity); - Assertions.assertEquals("java", result.getLanguage()); - Assertions.assertEquals(3, result.getClusterId()); - } - - @Test - public void testSelectByClusterId() { - ClientEntity clientEntity = new ClientEntity(); - clientEntity.setClusterId(3L); - List results = clientMapper.selectByClusterId(clientEntity); - Assertions.assertEquals(3, results.size()); - Assertions.assertEquals("java", results.get(0).getLanguage()); - Assertions.assertEquals("go", results.get(2).getLanguage()); - } - - @Test - public void testInsert() { - ClientEntity clientEntity = new ClientEntity(); - clientEntity.setHost("127.0.0.1"); - clientEntity.setClusterId(4L); - clientEntity.setName("clientName"); - clientEntity.setDescription(""); - clientEntity.setPid(1L); - clientEntity.setPort(8080); - clientEntity.setStatusEntity(RecordStatus.ACTIVE); - clientEntity.setConfigIds(""); - clientEntity.setLanguage("rust"); - clientEntity.setPlatform(""); - clientEntity.setProtocol("http"); - clientMapper.insert(clientEntity); - - ClientEntity result = clientMapper.selectById(clientEntity); - Assertions.assertEquals("127.0.0.1", result.getHost()); - - Assertions.assertEquals(2, clientMapper.selectByClusterId(clientEntity).size()); - } - - @Test - public void testDeactivate() { - ClientEntity clientEntity = new ClientEntity(); - clientEntity.setId(1L); - clientMapper.deactivate(clientEntity); - ClientEntity result = clientMapper.selectById(clientEntity); - Assertions.assertEquals(0, result.getStatus()); - Assertions.assertNotEquals(result.getCreateTime(), result.getEndTime()); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java deleted file mode 100644 index 400fe29b..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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.mapper.connection; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; - -import java.util.Arrays; -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:connection-test.sql") -class ConnectionMapperTest { - - @Autowired - private ConnectionMapper connectionMapper; - - @Test - public void testSelectAll() { - assertEquals(6, connectionMapper.selectAll().size()); - } - - @Test - public void testSelectByClusterId() { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setClusterId(1L); - assertEquals(3, connectionMapper.selectByClusterId(connectionEntity).size()); - } - - @Test - public void testSelectByClusterIdSourceTypeAndSourceId() { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setClusterId(1L); - connectionEntity.setSourceId(1L); - connectionEntity.setSourceType("connector"); - List results = connectionMapper.selectByClusterIdSourceTypeAndSourceId(connectionEntity); - assertEquals(1, results.size()); - assertEquals("connector", results.get(0).getSinkType()); - assertEquals(1, results.get(0).getSinkId()); - } - - @Test - public void testSelectByClusterIdSinkTypeAndSinkId() { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setClusterId(1L); - connectionEntity.setSinkId(2L); - connectionEntity.setSinkType("connector"); - List results = connectionMapper.selectByClusterIdSinkTypeAndSinkId(connectionEntity); - assertEquals(1, results.size()); - assertEquals("connector", results.get(0).getSourceType()); - assertEquals(2, results.get(0).getSourceId()); - } - - @Test - public void testInsert() { - ConnectionEntity connectionEntity = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 1, "topic", 3L, null, "description"); - connectionMapper.insert(connectionEntity); - assertEquals(7, connectionMapper.selectAll().size()); - } - - @Test - public void testBatchInsert() { - ConnectionEntity connectionEntity1 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 1, "topic", 3L, null, "description"); - ConnectionEntity connectionEntity2 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 1, "topic", 3L, null, "description"); - connectionMapper.batchInsert(Arrays.asList(connectionEntity1, connectionEntity2)); - assertEquals(8, connectionMapper.selectAll().size()); - } - - @Test - public void testEndConnectionById() { - ConnectionEntity connectionEntity = new ConnectionEntity(); - connectionEntity.setId(1L); - connectionMapper.endConnectionById(connectionEntity); - List results = connectionMapper.selectAll(); - ConnectionEntity result = results.get(0); - assertEquals(1, result.getStatus()); - assertNotNull(result.getEndTime()); - } - - @Test - public void testBatchEndConnection() { - ConnectionEntity connectionEntity1 = new ConnectionEntity(); - connectionEntity1.setId(1L); - ConnectionEntity connectionEntity2 = new ConnectionEntity(); - connectionEntity2.setId(2L); - connectionMapper.batchEndConnectionById(Arrays.asList(connectionEntity1, connectionEntity2)); - - List all = connectionMapper.selectAll(); - assertEquals(1, all.get(0).getStatus()); - assertEquals(1, all.get(1).getStatus()); - assertNotEquals(all.get(0).getCreateTime(), all.get(0).getEndTime()); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java deleted file mode 100644 index 52f2fcdd..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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.mapper.connector; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:connector-test.sql") -class ConnectorMapperTest { - - @Autowired - private ConnectorMapper connectorMapper; - - @Test - public void testSelectById() { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setId(1L); - - connectorEntity = connectorMapper.selectById(connectorEntity); - - assertNotNull(connectorEntity); - assertEquals(1L, connectorEntity.getClusterId()); - assertEquals("the", connectorEntity.getClassName()); - } - - @Test - public void testSelectByClusterId() { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setClusterId(1L); - - List results = connectorMapper.selectByClusterId(connectorEntity); - - assertEquals(3, results.size()); - assertEquals("quick", results.get(1).getClassName()); - } - - @Test - public void testInsert() { - ConnectorEntity connectorEntity = new ConnectorEntity(1L, "test", "test", "test", 0, "127.0.0.1", 80808, 2, "test"); - connectorMapper.insert(connectorEntity); - - assertNotNull(connectorEntity); - assertEquals(6, connectorEntity.getId()); - } - - @Test - public void testBatchInsert() { - ConnectorEntity connectorEntity1 = new ConnectorEntity(1L, "test", "test", "test", 0, "127.0.0.1", 80808, 2, "test"); - ConnectorEntity connectorEntity2 = new ConnectorEntity(1L, "test", "test", "test", 1, "127.0.0.1", 80808, 2, "test"); - ConnectorEntity connectorEntity3 = new ConnectorEntity(1L, "test", "test", "test", 0, "127.0.0.1", 80808, 2, "test"); - List connectorEntityList = new ArrayList<>(); - connectorEntityList.add(connectorEntity1); - connectorEntityList.add(connectorEntity2); - connectorEntityList.add(connectorEntity3); - - connectorMapper.batchInsert(connectorEntityList); - - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setClusterId(1L); - List results = connectorMapper.selectByClusterId(connectorEntity); - assertEquals(4, results.size()); - } - - @Test - public void testUpdateK8sStatus() { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setId(1L); - connectorEntity.setPodState(3); - connectorMapper.updatePodState(connectorEntity); - - connectorEntity = connectorMapper.selectById(connectorEntity); - assertEquals(3, connectorEntity.getPodState()); - } - - @Test - public void testUpdateConfigIds() { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setId(1L); - connectorEntity.setConfigIds("1,3,4,5,6,7"); - connectorMapper.updateConfigIds(connectorEntity); - - connectorEntity = connectorMapper.selectById(connectorEntity); - assertEquals("1,3,4,5,6,7", connectorEntity.getConfigIds()); - } - - @Test - public void testDeActiveByClusterId() { - ConnectorEntity connectorEntity = new ConnectorEntity(); - connectorEntity.setClusterId(1L); - connectorMapper.deactivateByClusterId(connectorEntity); - - assertEquals(2, connectorMapper.selectAll().size()); - } -} \ No newline at end of file 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 deleted file mode 100644 index 39e7ecfb..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.mapper.health; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; - -import java.sql.Timestamp; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:health-test.sql") -class HealthCheckResultMapperTest { - - @Autowired - private HealthCheckResultMapper healthCheckResultMapper; - - @Test - public void testSelectById() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(); - healthCheckResultEntity.setId(1L); - healthCheckResultEntity = healthCheckResultMapper.selectById(healthCheckResultEntity); - assertEquals(1, healthCheckResultEntity.getId()); - assertEquals(0, healthCheckResultEntity.getState()); - } - - @Test - public void testSelectByClusterIdAndTypeAndTypeId() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "", 1); - healthCheckResultEntity = healthCheckResultMapper.selectByClusterIdAndTypeAndTypeId(healthCheckResultEntity).get(0); - assertEquals(1, healthCheckResultEntity.getId()); - assertEquals(0, healthCheckResultEntity.getState()); - } - - @Test - public void testSelectByClusterIdAndType() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "", 1); - List results = healthCheckResultMapper.selectByClusterIdAndType(healthCheckResultEntity); - assertEquals(2, results.size()); - } - - @Test - public void testSelectByClusterIdAndTimeRange() throws ParseException { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - Date startDate = dateFormat.parse("2024-02-02 10:56:50"); - Timestamp startTimestamp = new Timestamp(startDate.getTime()); - Date endDate = dateFormat.parse("2024-02-03 10:56:52"); - Timestamp endTimestamp = new Timestamp(endDate.getTime()); - List results = healthCheckResultMapper.selectByClusterIdAndCreateTimeRange(1L, startTimestamp, endTimestamp); - assertEquals(4, results.size()); - } - - @Test - public void testInsert() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(5L, 1, 5L, "", 1); - healthCheckResultMapper.insert(healthCheckResultEntity); - healthCheckResultEntity = healthCheckResultMapper.selectById(healthCheckResultEntity); - assertEquals(7, healthCheckResultEntity.getId()); - } - - @Test - public void testBatchInsert() { - HealthCheckResultEntity healthCheckResultEntity1 = new HealthCheckResultEntity(1L, 1, 5L, "", 1); - HealthCheckResultEntity healthCheckResultEntity2 = new HealthCheckResultEntity(1L, 1, 6L, "", 1); - healthCheckResultMapper.batchInsert(Arrays.asList(healthCheckResultEntity1, healthCheckResultEntity2)); - List results = healthCheckResultMapper.selectByClusterIdAndType(healthCheckResultEntity1); - assertEquals(4, results.size()); - } - - @Test - public void testUpdate() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "reason", 0); - healthCheckResultMapper.update(healthCheckResultEntity); - healthCheckResultEntity = healthCheckResultMapper.selectByClusterIdAndTypeAndTypeId(healthCheckResultEntity).get(0); - assertEquals(0, healthCheckResultEntity.getState()); - } - - @Test - public void testBatchUpdate() { - HealthCheckResultEntity healthCheckResultEntity1 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 0); - healthCheckResultEntity1.setId(1L); - HealthCheckResultEntity healthCheckResultEntity2 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 0); - healthCheckResultEntity2.setId(2L); - healthCheckResultMapper.batchUpdate(Arrays.asList(healthCheckResultEntity1, healthCheckResultEntity2)); - healthCheckResultEntity1 = healthCheckResultMapper.selectById(healthCheckResultEntity1); - healthCheckResultEntity2 = healthCheckResultMapper.selectById(healthCheckResultEntity2); - - assertEquals(0, healthCheckResultEntity1.getState()); - assertEquals(0, healthCheckResultEntity2.getState()); - } - - @Test - public void testUpdateByClusterIdAndTypeAndTypeId() { - HealthCheckResultEntity entity1 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 2); - HealthCheckResultEntity entity2 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 2); - healthCheckResultMapper.batchInsert(Arrays.asList(entity1, entity2)); - - List toBeUpdate = healthCheckResultMapper.getIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId( - Arrays.asList(entity1, entity2)); - - toBeUpdate.forEach(entity -> entity.setState(2)); - - healthCheckResultMapper.batchUpdate(toBeUpdate); - entity1.setId(7L); - assertEquals(2, healthCheckResultMapper.selectById(entity1).getState()); - entity2.setId(1L); - 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/mapper/instanceuser/InstanceUserMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java deleted file mode 100644 index d2539abd..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.mapper.instanceuser; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.instanceuser.InstanceUserEntity; - -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:instance-user-test.sql") -class InstanceUserMapperTest { - - @Autowired - private InstanceUserMapper instanceUserMapper; - - @Test - public void testSelectAll() { - List instanceUserEntities = instanceUserMapper.selectAll(); - assertEquals(3, instanceUserEntities.size()); - } - - @Test - public void testSelectById() { - InstanceUserEntity instanceUserEntity1 = new InstanceUserEntity(); - instanceUserEntity1.setId(3L); - InstanceUserEntity instanceUserEntity = instanceUserMapper.selectById(instanceUserEntity1); - assertEquals(3, instanceUserEntity.getId()); - } - - @Test - public void testSelectByName() { - InstanceUserEntity instanceUserEntity1 = new InstanceUserEntity(); - instanceUserEntity1.setName("name01"); - List instanceUserEntities = instanceUserMapper.selectByName(instanceUserEntity1); - assertEquals(1, instanceUserEntities.size()); - } - - @Test - public void testInsert() { - InstanceUserEntity instanceUserEntity = new InstanceUserEntity(0, "pwd", 13L, "name4", "11", 1); - instanceUserMapper.insert(instanceUserEntity); - assertNotNull(instanceUserEntity); - assertEquals(4, instanceUserEntity.getId()); - // instanceuser.sql中新加三条数据,这条数据id自增为4 - } - - @Test - public void testUpdateNameById() { - InstanceUserEntity instanceUserEntity = new InstanceUserEntity(); - instanceUserEntity.setId(3L); - instanceUserEntity.setPassword("123"); - instanceUserMapper.updatePasswordById(instanceUserEntity); - instanceUserEntity = instanceUserMapper.selectById(instanceUserEntity); - assertEquals("123", instanceUserEntity.getPassword()); - } - -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java deleted file mode 100644 index 5888edae..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.mapper.meta; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:meta-test.sql") -class MetaMapperTest { - - @Autowired - private MetaMapper metaMapper; - - @Test - public void testSelectByClusterId() { - MetaEntity metaEntity = new MetaEntity(); - metaEntity.setClusterId(1L); - metaEntity = metaMapper.selectByClusterId(metaEntity).get(0); - Assertions.assertEquals("nacos", metaEntity.getType()); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java index 641b5d38..b01940a1 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java @@ -19,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; import java.util.List; @@ -32,7 +32,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; - @ExtendWith(SpringExtension.class) @ActiveProfiles("test") @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:connection-test.sql") diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java index 89e6d9c8..5a1b63c2 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java @@ -30,7 +30,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit.jupiter.SpringExtension; 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 deleted file mode 100644 index f4787073..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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.unit.cluster; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterMapper; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TestClusterMapper { - - @Autowired - private ClusterMapper clusterMapper; - - @Test - public void testAddCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - clusterEntity1.setUpdateTime(null); - clusterEntity1.setCreateTime(null); - Assert.assertEquals(clusterEntity1, clusterEntity); - } - - @Test - public void testSelectAllCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, 0); - ClusterEntity clusterEntity1 = - new ClusterEntity("c1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - clusterMapper.addCluster(clusterEntity1); - List clusterEntities = clusterMapper.selectAllCluster(); - Assert.assertEquals(clusterEntities.size(), 2); - } - - @Test - public void testSelectClusterById() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - clusterEntity1.setCreateTime(null); - clusterEntity1.setUpdateTime(null); - Assert.assertEquals(clusterEntity1, clusterEntity); - } - - @Test - public void testUpdateCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - clusterEntity.setDescription("nothing"); - clusterEntity.setName("cl2"); - clusterEntity.setAuthType(1); - clusterEntity.setBootstrapServers("1999"); - clusterEntity.setClientProperties("nothing"); - clusterEntity.setEventmeshVersion("1.10.0"); - clusterEntity.setJmxProperties("nothing"); - clusterEntity.setRegistryAddress("1.23.18"); - clusterEntity.setRunState(1); - clusterEntity.setRegProperties("nothing"); - clusterMapper.updateClusterById(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - clusterEntity1.setCreateTime(null); - clusterEntity1.setUpdateTime(null); - Assert.assertEquals(clusterEntity1, clusterEntity); - } - - @Test - public void testDeleteCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - clusterMapper.deactivate(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - Assert.assertEquals(clusterEntity1, null); - } -} diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java deleted file mode 100644 index 06250ef9..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.unit.config; - - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TestConfigMapper { - - @Autowired - private ConfigMapper configMapper; - - @Test - public void testAddConfig() throws IllegalAccessException { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); - configMapper.addConfig(config); - ConfigEntity configEntity = configMapper.selectByUnique(config); - configEntity.setUpdateTime(null); - configEntity.setCreateTime(null); - Assert.assertEquals(config.getId(), configEntity.getId()); - Assert.assertEquals(config, configEntity); - } - - @Test - public void testDeleteConfig() { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); - configMapper.addConfig(config); - configMapper.deleteConfig(config); - ConfigEntity config1 = configMapper.selectByUnique(config); - Assert.assertEquals(config1, null); - } - - @Test - public void testSelectByInstanceId() { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); - ConfigEntity config1 = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "name", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); - configMapper.addConfig(config1); - configMapper.addConfig(config); - List configEntityList = new ArrayList<>(); - configEntityList.add(config1); - configEntityList.add(config); - List configEntityList1 = configMapper.selectByInstanceId(config1); - configEntityList1.forEach(n -> { - n.setCreateTime(null); - n.setUpdateTime(null); - }); - Assert.assertEquals(configEntityList, configEntityList1); - } - - @Test - public void testSelectDefaultConfig() { - ConfigEntity config = new ConfigEntity(); - config.setBusinessType("rocketmq"); - config.setInstanceType(1); - List configEntityList = configMapper.selectDefaultConfig(config); - Assert.assertNotEquals(configEntityList.size(), 0); - } - - @Test - public void testUpdateConfig() { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", - 2, null, null, 0, 0, 0); - configMapper.addConfig(config); - config.setConfigValue("127.1.1.1"); - configMapper.updateConfig(config); - ConfigEntity configEntity = configMapper.selectByUnique(config); - configEntity.setUpdateTime(null); - configEntity.setCreateTime(null); - Assert.assertEquals(configEntity, config); - } -} - 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 deleted file mode 100644 index 6f26339a..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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.unit.group; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.console.mapper.group.OprGroupMapper; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class GroupMapperTest { - - @Autowired - private OprGroupMapper groupMapper; - - 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, 0); - groupMapper.addGroup(groupEntity); - groupEntities.add(groupEntity); - } - return groupEntities; - } - - public List getRemovedTimeList(String name) { - GroupEntity groupEntity = new GroupEntity(); - groupEntity.setName(name); - List groupEntities = groupMapper.selectGroup(groupEntity); - for (GroupEntity groupEntity1 : groupEntities) { - groupEntity1.setCreateTime(null); - groupEntity1.setUpdateTime(null); - } - return groupEntities; - } - - @Test - public void testAddGroup() { - List groupEntities = this.insertGroupData("addGroup"); - GroupEntity groupEntity = new GroupEntity(); - groupEntity.setName("addGroup"); - List groupEntities1 = groupMapper.selectGroup(groupEntity); - Assert.assertEquals(groupEntities, this.getRemovedTimeList("addGroup")); - } - - @Test - public void testUpdateGroupById() { - List groupEntities = this.insertGroupData("updateById2"); - GroupEntity groupEntity = groupEntities.get(9); - groupEntity.setType(3); - groupEntity.setMembers("1,"); - groupEntity.setState("fail"); - groupEntity.setMemberCount(1); - groupMapper.updateGroup(groupEntity); - Assert.assertEquals(groupEntities, this.getRemovedTimeList("updateById2")); - } - - @Test - public void testDeleteGroupById() { - List groupEntities = this.insertGroupData("deleteById"); - GroupEntity groupEntity = groupEntities.get(9); - groupMapper.deleteGroup(groupEntity); - groupEntities.remove(9); - Assert.assertEquals(groupEntities, this.getRemovedTimeList("deleteById")); - } - - @Test - public void testSelectGroupById() { - List groupEntities = this.insertGroupData("selectById"); - GroupEntity groupEntity = groupMapper.selectGroupById(groupEntities.get(0)); - groupEntity.setCreateTime(null); - groupEntity.setUpdateTime(null); - Assert.assertEquals(groupEntities.get(0), groupEntity); - } - - @Test - public void testSelectGroupByClusterId() { - List groupEntities = this.insertGroupData("selectByUnique"); - GroupEntity groupEntity1 = new GroupEntity(); - groupEntity1.setClusterId(groupEntities.get(0).getClusterId()); - groupEntity1.setName(groupEntities.get(0).getName()); - GroupEntity groupEntity = groupMapper.selectGroupByUnique(groupEntity1); - groupEntity.setCreateTime(null); - groupEntity.setUpdateTime(null); - Assert.assertEquals(groupEntities.get(0), groupEntity); - } - - @Test - public void testSelectGroup() { - List groupEntities = this.insertGroupData("selectByDynamic1"); - Assert.assertEquals(groupEntities, this.getRemovedTimeList("Dynamic1")); - } -} 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 deleted file mode 100644 index 31d4ce45..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * 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.unit.groupmember; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.groupmember.GroupMemberEntity; -import org.apache.eventmesh.dashboard.console.mapper.groupmember.OprGroupMemberMapper; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class GroupMemberMapperTest { - - @Autowired - OprGroupMemberMapper groupMemberMapper; - - 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, 0); - groupMemberMapper.addGroupMember(groupMemberEntity); - groupMemberEntities.add(groupMemberEntity); - } - return groupMemberEntities; - } - - public List getRemovedTimeList(String topicName, String groupName) { - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); - groupMemberEntity.setTopicName(topicName); - groupMemberEntity.setGroupName(groupName); - List groupEntities = groupMemberMapper.selectMember(groupMemberEntity); - for (GroupMemberEntity groupEntity1 : groupEntities) { - groupEntity1.setCreateTime(null); - groupEntity1.setUpdateTime(null); - } - return groupEntities; - } - - @Test - public void testAddGroupMember() { - List add1 = this.insertGroupData("add1", "groupMember"); - Assert.assertEquals(add1, this.getRemovedTimeList("add1", "groupMember")); - } - - @Test - public void testGetGroupMemberByClusterId() { - List add1 = this.insertGroupData("getByCluster", "groupMember"); - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); - groupMemberEntity.setClusterId(add1.get(1).getClusterId()); - List groupByClusterId = groupMemberMapper.getGroupByClusterId(groupMemberEntity); - GroupMemberEntity groupMemberEntity1 = groupByClusterId.get(0); - groupMemberEntity1.setCreateTime(null); - groupMemberEntity1.setUpdateTime(null); - Assert.assertEquals(1, groupByClusterId.size()); - Assert.assertEquals(add1.get(1), groupMemberEntity1); - } - - @Test - public void testDeleteGroupMemberById() { - List add1 = this.insertGroupData("getById", "groupMember"); - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); - groupMemberEntity.setId(add1.get(2).getId()); - GroupMemberEntity groupMemberEntity1 = groupMemberMapper.selectGroupMemberById(groupMemberEntity); - groupMemberEntity1.setUpdateTime(null); - groupMemberEntity1.setCreateTime(null); - Assert.assertEquals(groupMemberEntity1, add1.get(2)); - } - - @Test - public void testUpdateGroupMemberById() { - List add1 = this.insertGroupData("updateById", "groupMember"); - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); - add1.get(1).setState("fail1"); - groupMemberEntity.setState("fail1"); - groupMemberEntity.setId(add1.get(1).getId()); - groupMemberMapper.updateGroupMember(groupMemberEntity); - GroupMemberEntity groupMemberEntity1 = groupMemberMapper.selectGroupMemberById(add1.get(1)); - groupMemberEntity1.setUpdateTime(null); - groupMemberEntity1.setCreateTime(null); - Assert.assertEquals(groupMemberEntity1, add1.get(1)); - } - - @Test - public void testSelectGroupMemberByUnique() { - List groupMemberEntities = this.insertGroupData("selectByUnique", "groupMember"); - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); - groupMemberEntity.setClusterId(groupMemberEntities.get(1).getClusterId()); - groupMemberEntity.setTopicName(groupMemberEntities.get(1).getTopicName()); - groupMemberEntity.setGroupName(groupMemberEntities.get(1).getGroupName()); - GroupMemberEntity groupMemberEntity1 = groupMemberMapper.selectGroupMemberByUnique(groupMemberEntity); - groupMemberEntity1.setUpdateTime(null); - groupMemberEntity1.setCreateTime(null); - Assert.assertEquals(groupMemberEntity1, groupMemberEntities.get(1)); - } - - @Test - public void testSelectGroupMemberByGroup() { - List groupMemberEntities = this.insertGroupData("selectByGroup1", "groupMember1"); - List removedTimeList = this.getRemovedTimeList(null, "groupMember1"); - Assert.assertEquals(groupMemberEntities, removedTimeList); - } - - @Test - public void testSelectGroupMemberByTopic() { - List groupMemberEntities = this.insertGroupData("selectByTopic1", "groupMember2"); - List removedTimeList = this.getRemovedTimeList("selectByTopic1", null); - Assert.assertEquals(groupMemberEntities, removedTimeList); - } - - @Test - public void testUpdateGroupMemberByTopic() { - List groupMemberEntities = this.insertGroupData("updateByTopic1", "groupMember2"); - for (GroupMemberEntity groupMemberEntity : groupMemberEntities) { - groupMemberEntity.setState("fail2"); - } - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); - groupMemberEntity.setState("fail2"); - groupMemberEntity.setTopicName("updateByTopic1"); - groupMemberMapper.updateMemberByTopic(groupMemberEntity); - Assert.assertEquals(this.getRemovedTimeList("updateByTopic1", null), groupMemberEntities); - } - - @Test - public void testSelectGroupMemberById() { - List groupMemberEntities = this.insertGroupData("updateById1", "groupMember2"); - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); - groupMemberEntity.setId(groupMemberEntities.get(5).getId()); - GroupMemberEntity groupMemberEntity1 = groupMemberMapper.selectGroupMemberById(groupMemberEntity); - groupMemberEntity1.setCreateTime(null); - groupMemberEntity1.setUpdateTime(null); - Assert.assertEquals(groupMemberEntity1, groupMemberEntities.get(5)); - } - -} diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java deleted file mode 100644 index 47aa0266..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.unit.runtime; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.mapper.runtime.RuntimeMapper; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TestRuntimeMapper { - - @Autowired - private RuntimeMapper runtimeMapper; - - @Test - public void testAddRuntimeMapper() { - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); - runtimeMapper.addRuntime(runtimeEntity); - List runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity); - RuntimeEntity runtimeEntity1 = runtimeEntities.get(0); - runtimeEntity1.setCreateTime(null); - runtimeEntity1.setUpdateTime(null); - Assert.assertEquals(runtimeEntity1, runtimeEntity); - } - - @Test - public void testUpdateRuntimeByCluster() { - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); - runtimeMapper.addRuntime(runtimeEntity); - runtimeEntity.setPort(1000); - runtimeEntity.setJmxPort(1099); - runtimeEntity.setStatus(0); - runtimeMapper.updateRuntimeByCluster(runtimeEntity); - List runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity); - RuntimeEntity runtimeEntity1 = runtimeEntities.get(0); - runtimeEntity1.setCreateTime(null); - runtimeEntity1.setUpdateTime(null); - Assert.assertEquals(runtimeEntity, runtimeEntity1); - } - - @Test - public void testDeleteRuntime() { - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); - runtimeMapper.addRuntime(runtimeEntity); - runtimeMapper.deleteRuntimeByCluster(runtimeEntity); - List runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity); - Assert.assertEquals(runtimeEntities.size(), 0); - } -} diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java deleted file mode 100644 index 16d79f06..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.unit.store; - -import org.apache.eventmesh.dashboard.common.enums.StoreType; -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; -import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TestStoreMapper { - - @Autowired - private StoreMapper storeMapper; - - @Test - public void testAddStore() { - StoreEntity storeEntity = - new StoreEntity(1L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", - 1L); - StoreEntity storeEntity1 = - new StoreEntity(2L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", - 1L); - - storeMapper.addStore(storeEntity); - storeMapper.addStore(storeEntity1); - StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity); - - storeEntities.setUpdateTime(null); - storeEntities.setCreateTime(null); - - - } - - @Test - public void testDeleteStoreByUnique() { - StoreEntity storeEntity = - new StoreEntity(2L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L); - storeMapper.addStore(storeEntity); - storeMapper.deleteStoreByUnique(storeEntity); - StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity); - Assert.assertEquals(storeEntities, null); - } - - @Test - public void testUpdateStoreByUnique() { - StoreEntity storeEntity = - new StoreEntity(1L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L); - storeMapper.addStore(storeEntity); - storeEntity.setStatus((short) 5); - storeMapper.updateStoreByUnique(storeEntity); - StoreEntity storeEntity1 = storeMapper.selectStoreByCluster(storeEntity); - Assert.assertEquals(storeEntity1.getStatus(), storeEntity.getStatus()); - } -} 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 deleted file mode 100644 index f0debdbe..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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.unit.topic; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.mapper.topic.TopicMapper; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TopicMapperTest { - - @Autowired - private TopicMapper topicMapper; - - public List insertGroupData(String topicName) { - List topicEntities = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - TopicEntity topicEntity = new TopicEntity(null, (long) i, topicName, 10L, 100L, 1, "testTopic", null, null, 0, 0); - topicMapper.addTopic(topicEntity); - topicEntities.add(topicEntity); - } - return topicEntities; - } - - public List getRemovedTimeList(String topicName, Long clusterId) { - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setTopicName(topicName); - topicEntity.setClusterId(clusterId); - List topicEntities = topicMapper.getTopicList(topicEntity); - for (TopicEntity topic : topicEntities) { - topic.setCreateTime(null); - topic.setUpdateTime(null); - } - return topicEntities; - } - - @Test - public void testSelectTopicByClusterId() { - List topicEntities = this.insertGroupData("SelectById111"); - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setClusterId(topicEntities.get(9).getClusterId()); - List topicEntity1 = topicMapper.getTopicList(topicEntity); - topicEntity1.get(0).setCreateTime(null); - topicEntity1.get(0).setUpdateTime(null); - Assert.assertEquals(topicEntity1.get(0), topicEntities.get(9)); - Assert.assertEquals(1, topicEntity1.size()); - } - - @Test - public void testAddTopic() { - List topicEntities = this.insertGroupData("add111"); - List add111 = this.getRemovedTimeList("add111", null); - Assert.assertEquals(add111, topicEntities); - } - - @Test - public void testUpdateTopic() { - List topicEntities = this.insertGroupData("update2"); - topicEntities.get(5).setDescription("updateTest1"); - topicEntities.get(5).setType(-1); - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setDescription("updateTest1"); - topicEntity.setType(-1); - topicEntity.setId(topicEntities.get(5).getId()); - topicMapper.updateTopic(topicEntity); - TopicEntity topicEntity1 = topicMapper.selectTopicById(topicEntity); - topicEntity1.setUpdateTime(null); - topicEntity1.setCreateTime(null); - Assert.assertEquals(topicEntity1, topicEntities.get(5)); - } - - @Test - public void testDeleteTopic() { - List topicEntities = this.insertGroupData("update72"); - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setId(topicEntities.get(5).getId()); - topicEntity.setClusterId(topicEntities.get(5).getClusterId()); - topicEntity.setTopicName("update72"); - topicMapper.deleteTopic(topicEntity); - List topicEntity1 = topicMapper.getTopicList(topicEntity); - Assert.assertEquals(true, topicEntity1.isEmpty()); - } - - @Test - public void testSelectTopicByUnique() { - List topicEntities = this.insertGroupData("unique11"); - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setTopicName("unique11"); - topicEntity.setClusterId(topicEntities.get(1).getClusterId()); - TopicEntity topicEntity1 = topicMapper.selectTopicByUnique(topicEntity); - topicEntity1.setUpdateTime(null); - topicEntity1.setCreateTime(null); - Assert.assertEquals(topicEntity1, topicEntities.get(1)); - } - - @Test - public void testSelectTopicById() { - List topicEntities = this.insertGroupData("id1"); - TopicEntity topicEntity = new TopicEntity(); - topicEntity.setId(topicEntities.get(2).getId()); - TopicEntity topicEntity1 = topicMapper.selectTopicById(topicEntity); - topicEntity1.setCreateTime(null); - topicEntity1.setUpdateTime(null); - Assert.assertEquals(topicEntity1, topicEntities.get(2)); - } - -} diff --git a/eventmesh-dashboard-core/pom.xml b/eventmesh-dashboard-core/pom.xml index 135ba00d..787e8fbb 100644 --- a/eventmesh-dashboard-core/pom.xml +++ b/eventmesh-dashboard-core/pom.xml @@ -95,12 +95,12 @@ org.apache.rocketmq rocketmq-client - 4.9.8 + 5.2.0 org.apache.rocketmq rocketmq-tools - 4.9.8 + 5.2.0 @@ -121,4 +121,4 @@ provided - + \ No newline at end of file diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java new file mode 100644 index 00000000..20621ae7 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java @@ -0,0 +1,35 @@ +/* + * 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.core.cluster; + +import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; +import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import lombok.Data; + +@Data +public class ClusterDO { + + private ClusterMetadata clusterInfo; + + private Map runtimeMap = new ConcurrentHashMap<>(); + +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java new file mode 100644 index 00000000..61ac242f --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java @@ -0,0 +1,94 @@ +/* + * 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.core.cluster; + + +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class ClusterDoCache { + + private static final ClusterDoCache INSTANCE = new ClusterDoCache(); + private Map> clusterDoMap = new HashMap<>(); + + { + this.clusterDoMap = this.getClusterDoMap(); + } + + + private ClusterDoCache() { + } + + public static final ClusterDoCache getInstance() { + return INSTANCE; + } + + public Map> getClusterDoMap() { + Map> clusterDoMap = new HashMap<>(); + for (ClusterType clusterType : ClusterType.values()) { + clusterDoMap.put(clusterType, new HashMap<>()); + } + return clusterDoMap; + } + + + public void setClusterDoMap(Map> clusterDoMap) { + this.clusterDoMap = clusterDoMap; + } + + + public List getEventMeshClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterate(ClusterType.EVENTMESH, clusterTrusteeshipType); + } + + public List getMetaNacosClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterate(ClusterType.EVENTMESH_META_NACOS, clusterTrusteeshipType); + } + + public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterate(ClusterType.EVENTMESH_META_ETCD, clusterTrusteeshipType); + } + + public List getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterate(ClusterType.STORAGE_ROCKETMQ, clusterTrusteeshipType); + } + + + private List filterate(ClusterType clusterType, ClusterTrusteeshipType... clusterTrusteeshipTypes) { + Map> clusterDoMap = new HashMap<>(); + Map clusterDOList = clusterDoMap.get(clusterType); + + if (Objects.isNull(clusterTrusteeshipTypes) || clusterTrusteeshipTypes.length == 0) { + return new ArrayList<>(clusterDOList.values()); + } + List newClusterDOList = new ArrayList<>(); + for (ColonyDO clusterDO : clusterDOList.values()) { + + newClusterDOList.add(clusterDO); + } + return newClusterDOList; + } + + +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java new file mode 100644 index 00000000..b2218695 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java @@ -0,0 +1,56 @@ +/* + * 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.core.cluster; + +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; + +import lombok.Data; + +/** + * eventmesh ClusterDO meta ClusterDO runtime ClusterDO storage ClusterDO meta(注册中心,zk,) ClusterDO runtime(broker) ClusterDO + */ +@Data +public class ColonyDO { + + private Long superiorId; + + private ClusterDO clusterDO; + + // 双活集群 所以是可以是一个list的 + // 可以默认一个集群 + private Map runtimeColonyDOList = new ConcurrentHashMap<>(); + + // 只有 eventmesh 集群有这个点,其他没有。 + private Map storageColonyDOList = new ConcurrentHashMap<>(); + + /** + * A(nameserver cluster) a1 a2 a3 B(nameserver cluster) b1 b2 b3 + *

+ * rocketmq a1,a2,a3,b1,b2,b3 + */ + private Map metaColonyDOList = new ConcurrentHashMap<>(); + + + public Long getClusterId() { + return Objects.nonNull(this.clusterDO.getClusterInfo().getClusterId()) ? this.clusterDO.getClusterInfo().getClusterId() + : this.clusterDO.getClusterInfo().getId(); + } + +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java index 127d2e3c..66f1420c 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java @@ -47,6 +47,7 @@ public static class MetaProperties { @Data public static class NacosProperties { + private String addr = "127.0.0.1:8848"; private String namespace = ""; private boolean authEnabled = false; @@ -59,6 +60,7 @@ public static class NacosProperties { @Data public static class EtcdProperties { + private String addr; } } @@ -72,6 +74,7 @@ public static class StoreProperties { @Data public static class RocketMQProperties { + private String namesrvAddr; private String clusterName = ""; private String accessKey = ""; @@ -80,6 +83,7 @@ public static class RocketMQProperties { @Data public static class KafkaProperties { + private String namesrvAddr; private int partitions = 1; private int replicationFactors = 1; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java index f4f8a8af..823af69e 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java @@ -23,17 +23,18 @@ import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosNamingSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.operation.NacosSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.operation.RedisSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RocketMQProduceSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RocketMQPushConsumerSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RocketMQRemotingSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeGrpcConsumerSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeGrpcProducerSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeHttpConsumerSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeHttpProducerSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeTcpCloudEventSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeTcpEventMeshSDKOperation; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.RuntimeTcpOpenMessageSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQAdminOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQProduceSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQPushConsumerSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq.RocketMQRemotingSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcConsumerSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcProducerSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpConsumerSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpProducerSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpCloudEventSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpEventMeshSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpOpenMessageSDKOperation; import java.util.AbstractMap.SimpleEntry; import java.util.Map; @@ -46,37 +47,24 @@ */ public class SDKManager { - private static volatile SDKManager INSTANCE = null; - - public static synchronized SDKManager getInstance() { - if (INSTANCE == null) { - synchronized (SDKManager.class) { - if (INSTANCE == null) { - INSTANCE = new SDKManager(); - } - } - } - return INSTANCE; - } - /** * inner key is the unique key of a client, such as (ip + port) they are defined in CreateClientConfig *

- * key: SDKTypeEnum - * value: A map collection is used with key being (ip+port) and value being client. + * key: SDKTypeEnum value: A map collection is used with key being (ip+port) and value being client. + * * @see CreateSDKConfig#getUniqueKey() */ private static final Map> clientMap = new ConcurrentHashMap<>(); - /** * Initialise the SDKOperation object instance according to SDKTypeEnum. *

- * key: SDKTypeEnum - * value: SDKOperation + * key: SDKTypeEnum value: SDKOperation + * * @see SDKTypeEnum * @see SDKOperation */ private static final Map> clientCreateOperationMap = new ConcurrentHashMap<>(); + private static volatile SDKManager INSTANCE = null; // register all client create operation static { @@ -90,6 +78,7 @@ public static synchronized SDKManager getInstance() { clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, new RocketMQRemotingSDKOperation()); clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_PRODUCER, new RocketMQProduceSDKOperation()); clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_CONSUMER, new RocketMQPushConsumerSDKOperation()); + clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN, new RocketMQAdminOperation()); // nacos clientCreateOperationMap.put(SDKTypeEnum.META_NACOS, new NacosSDKOperation()); @@ -119,6 +108,17 @@ public static synchronized SDKManager getInstance() { private SDKManager() { } + public static synchronized SDKManager getInstance() { + if (INSTANCE == null) { + synchronized (SDKManager.class) { + if (INSTANCE == null) { + INSTANCE = new SDKManager(); + } + } + } + return INSTANCE; + } + /** * Create SDK client through (SDKTypeEnum) clientTypeEnum, (CreateSDKConfig) config. */ diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java index b10cde9f..4950eb1e 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKTypeEnum.java @@ -23,6 +23,8 @@ public enum SDKTypeEnum { STORAGE_ROCKETMQ_REMOTING, + STORAGE_ROCKETMQ_ADMIN, + STORAGE_ROCKETMQ_PRODUCER, STORAGE_ROCKETMQ_CONSUMER, diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java new file mode 100644 index 00000000..f9d7833a --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java @@ -0,0 +1,34 @@ +/* + * 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.core.function.SDK.config; + +import lombok.Data; + +@Data +public class CreateRocketmqAdminSDKConfig implements CreateSDKConfig { + + private String nameServerUrl; + + private String clusterName; + + + @Override + public String getUniqueKey() { + return nameServerUrl; + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java index 19ea6d49..3670d648 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqConfig.java @@ -18,7 +18,7 @@ package org.apache.eventmesh.dashboard.core.function.SDK.config; import org.apache.rocketmq.client.consumer.listener.MessageListener; -import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; +import org.apache.rocketmq.remoting.protocol.heartbeat.MessageModel; import lombok.Data; @@ -27,10 +27,12 @@ public class CreateRocketmqConfig implements CreateSDKConfig { // common private String nameServerUrl; + private String brokerUrl; //consumer private String consumerGroup; + private MessageModel messageModel = MessageModel.CLUSTERING; //producer @@ -38,11 +40,15 @@ public class CreateRocketmqConfig implements CreateSDKConfig { //topic private String topic; + private String subExpression = "*"; private MessageListener messageListener; + private String clusterName; + + @Override public String getUniqueKey() { if (nameServerUrl != null) { diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java index 98f88bdd..29e3fb35 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java @@ -33,6 +33,10 @@ @Slf4j public class EtcdSDKOperation extends AbstractSDKOperation { + private static String[] getSplitEndpoints(CreateEtcdConfig etcdConfig) { + return etcdConfig.getEtcdServerAddress().split(";"); + } + @Override public SimpleEntry createClient(CreateSDKConfig clientConfig) { final CreateEtcdConfig etcdConfig = (CreateEtcdConfig) clientConfig; @@ -49,10 +53,6 @@ public SimpleEntry createClient(CreateSDKConfig clientConfig) { return new SimpleEntry<>(clientConfig.getUniqueKey(), kvClient); } - private static String[] getSplitEndpoints(CreateEtcdConfig etcdConfig) { - return etcdConfig.getEtcdServerAddress().split(";"); - } - @Override public void close(Object client) { castClient(client).close(); diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java new file mode 100644 index 00000000..f655fe13 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java @@ -0,0 +1,54 @@ +/* + * 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.core.function.SDK.operation.rocketmq; + +import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; + +import org.apache.rocketmq.client.exception.MQClientException; +import org.apache.rocketmq.client.producer.DefaultMQProducer; +import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; + +import java.util.AbstractMap.SimpleEntry; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class RocketMQAdminOperation extends AbstractSDKOperation { + + @Override + public SimpleEntry createClient(CreateSDKConfig clientConfig) { + DefaultMQAdminExt admin = null; + try { + + CreateRocketmqConfig config = (CreateRocketmqConfig) clientConfig; + admin = new DefaultMQAdminExt(); + admin.setNamesrvAddr(config.getNameServerUrl()); + admin.start(); + } catch (MQClientException e) { + log.error("create rocketmq producer failed", e); + } + return new SimpleEntry<>(clientConfig.getUniqueKey(), admin); + } + + @Override + public void close(Object client) { + ((DefaultMQProducer) client).shutdown(); + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQProduceSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQProduceSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQProduceSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQProduceSDKOperation.java index c1f46a74..a31aede0 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQProduceSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQProduceSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq; import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQPushConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java similarity index 96% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQPushConsumerSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java index b55a6632..37d71c25 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQPushConsumerSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq; import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; @@ -40,7 +40,7 @@ public SimpleEntry createClient(CreateSDKConfig c consumer.setMessageModel(config.getMessageModel()); consumer.setNamesrvAddr(config.getNameServerUrl()); consumer.subscribe(config.getTopic(), config.getSubExpression()); - consumer.registerMessageListener(config.getMessageListener()); + //consumer.registerMessageListener(config.getMessageListener()); consumer.start(); } catch (MQClientException e) { log.error("create rocketmq push consumer failed", e); diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQRemotingSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQRemotingSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQRemotingSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQRemotingSDKOperation.java index f98dc724..00ad867e 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RocketMQRemotingSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQRemotingSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq; import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcConsumerSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcConsumerSDKOperation.java index 63e26a3b..1386020a 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcConsumerSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshGrpcConsumerConfig; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcProducerSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcProducerSDKOperation.java index 2c46a6b8..2c4c8460 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeGrpcProducerSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshGrpcProducerConfig; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpConsumerSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpConsumerSDKOperation.java index e6c026af..553ed3c7 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpConsumerSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshHttpConsumerConfig; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpProducerSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpProducerSDKOperation.java index 79071c7d..6caa0b1a 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeHttpProducerSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshHttpProducerConfig; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java index 8ef5b81f..a51bb8ad 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer; import org.apache.eventmesh.client.grpc.producer.EventMeshGrpcProducer; @@ -54,7 +54,7 @@ public SimpleEntry createClient(CreateSDKConfig clien final String protocolName = ((CreateRuntimeConfig) clientConfig).getProtocolName(); final String clientType = ((CreateRuntimeConfig) clientConfig).getClientType(); - SimpleEntry cloudSimpleEntry = null; + SimpleEntry cloudSimpleEntry = null; SimpleEntry eventMeshMessageSimpleEntry = null; SimpleEntry openMessageSimpleEntry = null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpCloudEventSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpCloudEventSDKOperation.java index e097e2c9..1b8dd730 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpCloudEventSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshTCPClientConfig; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildUserAgent; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpEventMeshSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpEventMeshSDKOperation.java index 45f71526..e13843b9 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpEventMeshSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshTCPClientConfig; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildUserAgent; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpOpenMessageSDKOperation.java similarity index 99% rename from eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperation.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpOpenMessageSDKOperation.java index 0a281068..5086ce97 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeTcpOpenMessageSDKOperation.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.core.function.SDK.operation; +package org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildEventMeshTCPClientConfig; import static org.apache.eventmesh.dashboard.core.function.SDK.util.RuntimeSDKOperationUtils.buildUserAgent; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java index 60f9022d..617331db 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java @@ -28,11 +28,11 @@ @AllArgsConstructor public class NacosSDKWrapper { + private ConfigService configService; + private NamingService namingService; + public void shutdown() throws NacosException { configService.shutDown(); namingService.shutDown(); } - - private ConfigService configService; - private NamingService namingService; } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java index 0d665c69..db6d5053 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java @@ -58,14 +58,11 @@ @Slf4j public class NacosSubscriptionCore implements SubscriptionCore { + private static String HTTP_PREFIX = ConfigConst.HTTP_PREFIX; AdminProperties adminProperties; - Properties nacosProps = new Properties(); - RestTemplate restTemplate = new RestTemplate(); - private static String HTTP_PREFIX = ConfigConst.HTTP_PREFIX; - public NacosSubscriptionCore(AdminProperties adminProperties) { this.adminProperties = adminProperties; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandler.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataHandler.java similarity index 70% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandler.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataHandler.java index f0715249..86419bd1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/MetadataHandler.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataHandler.java @@ -15,19 +15,21 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.metadata.handler; +package org.apache.eventmesh.dashboard.core.metadata; + +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import java.util.List; /** - * @param metadata type or entity type, {@code } is the source type of handler, there should be a converter in the handler to convert - * {@code } to the target type.

method in this interface should be implemented as async method, if the method is eventmesh manage + * @param metadata type or entity type, {@code } is the source type of handler, there should be a converter in the handler to convert + * {@code } to the target type.

method in this interface should be implemented as async method, if the method is eventmesh manage * operation. */ -public interface MetadataHandler { +public interface MetadataHandler { - default void handleAll(List addData, List updateData, List deleteData) { + default void handleAll(List addData, List updateData, List deleteData) { if (addData != null) { addData.forEach(this::addMetadata); } @@ -40,36 +42,36 @@ default void handleAll(List addData, List updateData, List deleteData) } default void handleAllObject(List addData, List updateData, List deleteData) { - handleAll((List) addData, (List) updateData, (List) deleteData); + handleAll((List) addData, (List) updateData, (List) deleteData); } //metaData: topic, center, etc. add meta is to create a topic. - void addMetadata(S meta); + void addMetadata(T meta); - default void addMetadata(List meta) { + default void addMetadata(List meta) { if (meta != null) { meta.forEach(this::addMetadata); } } default void addMetadataObject(Object meta) { - addMetadata((S) meta); + addMetadata((T) meta); } default void addMetadataObject(List meta) { if (meta != null) { - meta.forEach(t -> addMetadata((S) t)); + meta.forEach(t -> addMetadata((T) t)); } } default void replaceMetadata(List meta) { if (meta != null) { - deleteMetadata((List) meta); + deleteMetadata((List) meta); addMetadataObject(meta); } } - default void updateMetadata(S meta) { + default void updateMetadata(T meta) { this.addMetadata(meta); } @@ -78,27 +80,30 @@ default void updateMetadata(S meta) { * * @param meta */ - default void updateMetadata(List meta) { + default void updateMetadata(List meta) { if (meta != null) { meta.forEach(this::updateMetadata); } } default void updateMetadataObject(Object meta) { - this.addMetadata((S) meta); + this.addMetadata((T) meta); } - void deleteMetadata(S meta); + void deleteMetadata(T meta); - default void deleteMetadata(List meta) { + default void deleteMetadata(List meta) { if (meta != null) { meta.forEach(this::deleteMetadata); } } default void deleteMetadataObject(Object meta) { - deleteMetadata((S) meta); + deleteMetadata((T) meta); } + List getData(); + + List getData(GlobalRequest globalRequest); } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java new file mode 100644 index 00000000..481e88bd --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java @@ -0,0 +1,245 @@ +/* + * 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.core.metadata; + +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.model.metadata.MetadataConfig; +import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import lombok.Data; +import lombok.Setter; + +/** + * 启动应该进行差异化对比。进行差异化增量,差异化删除 表 -> increment-> remote -> function -> data -> conver -> request + */ +public class MetadataSyncManager { + + private final ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor(2); + private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(32, 32, 10, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), + new ThreadFactory() { + final AtomicInteger counter = new AtomicInteger(0); + + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "metadata-manager-" + counter.incrementAndGet()); + } + }); + @Setter + private Map, MetadataSyncWrapper> metadataSyncWrapperMap = new HashMap<>(); + @Setter + private RemotingManager remotingManager; + + + public void register(MetadataSyncConfig metadataSyncConfig) { + MetadataSyncWrapper metadataSyncWrapper = new MetadataSyncWrapper(); + metadataSyncWrapper.setMetadataClass(metadataSyncConfig.getMetadataClass()); + metadataSyncWrapper.setEntityClass(metadataSyncConfig.getEntityClass()); + metadataSyncWrapper.setDataBasesHandler(metadataSyncConfig.getDataBasesHandler()); + metadataSyncWrapper.setClusterService(metadataSyncConfig.getClusterService()); + metadataSyncWrapperMap.put(metadataSyncWrapper.getMetadataClass(), metadataSyncWrapper); + } + + public void init(Integer initialDelay, Integer period) { + scheduledExecutorService.scheduleAtFixedRate(this::run, initialDelay, period, TimeUnit.SECONDS); + } + + + public void run() { + for (MetadataSyncWrapper metadataSyncWrapper : metadataSyncWrapperMap.values()) { + // 一个MetadataSyncWrapper 一个线程 + threadPoolExecutor.execute(metadataSyncWrapper); + } + } + + + @Data + public static class MetadataSyncConfig { + + private Class metadataClass; + + private Class entityClass; + + private MetadataHandler dataBasesHandler; + + // 直接映射 api? config 是直接读取整个runtime 里面的数据 + // 还是封装一层? + // 这里如何变简单。直接 remote api? + private MetadataHandler clusterService; + } + + @Data + public class MetadataSyncWrapper implements Runnable { + + private Class metadataClass; + + private Class entityClass; + + private MetadataHandler dataBasesHandler; + + // 直接映射 api? config 是直接读取整个runtime 里面的数据 + // 还是封装一层? + // 这里如何变简单。直接 remote api? + private MetadataHandler clusterService; + + private CountDownLatch countDownLatch = new CountDownLatch(2); + + + private Map clusterData = new HashMap<>(); + + private Map dataBasesData = new HashMap<>(); + + private List toClusterUpdate = new ArrayList<>(); + + + private List toDataUpdate = new ArrayList<>(); + + private List toDelete = new ArrayList<>(); + + private List toInsert = new ArrayList<>(); + + private long lastTime = System.currentTimeMillis(); + + @Override + public void run() { + + try { + // 全程托管,托管都需要,异步 读取 cluster 信息 + threadPoolExecutor.execute(this::syncClusterData); + // 异步 读取数据库信息。是否进行增量处理 + threadPoolExecutor.execute(this::syncDatabasesData); + this.lastTime = System.currentTimeMillis(); + countDownLatch.await(); + // 对读取的数据进行分类, + this.difference(); + // 托管的进行差异化之后。进行写库。 + if (this.toInsert.isEmpty() && this.toClusterUpdate.isEmpty() && this.toDelete.isEmpty() && this.toDataUpdate.isEmpty()) { + return; + } + this.toTrusteeship(); + this.toFullTrusteeship(); + // 全程托管的 cluster 存在,数据库不存在就删除。 进行删除, 新增的直接操作 cluster + + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + countDownLatch = new CountDownLatch(2); + clusterData.clear(); + dataBasesData.clear(); + } + + + } + + public void syncClusterData() { + try { + List metadataConfigList = this.clusterService.getData(); + this.arrange(this.clusterData, metadataConfigList); + } finally { + countDownLatch.countDown(); + } + + } + + public void syncDatabasesData() { + try { + List metadataConfigList = this.dataBasesHandler.getData(); + this.arrange(this.dataBasesData, metadataConfigList); + } finally { + countDownLatch.countDown(); + } + } + + public void arrange(Map data, List metadataConfigList) { + for (MetadataConfig metadataConfig : metadataConfigList) { + data.put(metadataConfig.getUnique(), metadataConfig); + } + } + + /** + * TODO 一定要注意。这个就得是 cluster 的差集。如果要对 database 操作 就要反翻过啦 + */ + public void difference() { + + this.toDataUpdate = new ArrayList<>(); + this.toClusterUpdate = new ArrayList<>(); + this.toDelete = new ArrayList<>(); + this.toInsert = new ArrayList<>(); + Map newClusterData = new HashMap<>(this.clusterData); + Map newDataBasesData = new HashMap<>(this.dataBasesData); + for (Map.Entry entry : newClusterData.entrySet()) { + MetadataConfig serviceObject = newDataBasesData.remove(entry.getKey()); + if (Objects.isNull(serviceObject)) { + toDelete.add(entry.getValue()); + } else { + if (!serviceObject.equals(entry.getValue())) { + this.toClusterUpdate.add(entry.getValue()); + this.toDataUpdate.add(serviceObject); + } + } + } + this.toInsert = new ArrayList<>(newDataBasesData.values()); + + } + + public void toTrusteeship() { + // 如果 update 中 cluster 与 databases 数据不一致。 以谁为主 + // + this.dataBasesHandler.updateMetadata(this.filterTrusteeship(this.toClusterUpdate)); + this.dataBasesHandler.addMetadata(this.filterTrusteeship(this.toDelete)); + } + + public void toFullTrusteeship() { + // + this.clusterService.addMetadata(this.filterFullTrusteeship(this.toInsert)); + this.clusterService.addMetadata(this.filterFullTrusteeship(this.toDataUpdate)); + this.clusterService.deleteMetadata(this.filterTrusteeship(this.toDelete)); + } + + private List filterFullTrusteeship(List metadataConfigList) { + return this.filter(metadataConfigList, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP); + } + + private List filterTrusteeship(List metadataConfigList) { + return this.filter(metadataConfigList, ClusterTrusteeshipType.TRUSTEESHIP); + } + + private List filter(List metadataConfigList, ClusterTrusteeshipType clusterTrusteeshipType) { + List newMetadataConfigList = new ArrayList<>(); + for (MetadataConfig metadataConfig : metadataConfigList) { + if (remotingManager.isClusterTrusteeshipType(metadataConfig.getClusterId(), clusterTrusteeshipType)) { + newMetadataConfigList.add(metadataConfig); + } + } + return newMetadataConfigList; + } + } + +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java new file mode 100644 index 00000000..939dd8ad --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java @@ -0,0 +1,57 @@ +/* + * 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.core.metadata.cluster; + +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; +import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; + +import java.util.ArrayList; +import java.util.List; + +import lombok.Setter; + +public abstract class AbstractMetadataHandler implements MetadataHandler, RemotingManager.RemotingRequestWrapper { + + + protected S request; + @Setter + private RemotingManager remotingManager; + + public void init() { + this.request = (S) remotingManager.getProxyObject(); + } + + + /** + * 同步的时候,只同步runtime 的数据,还是会同步 storage 的数据。这个可以进行配置。 + * + * @return + */ + @Override + public List getData() { + List remotingWrapperList = new ArrayList<>(); + remotingWrapperList.addAll( + remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); + remotingWrapperList.addAll( + remotingManager.getStorageCluster(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); + return remotingManager.request(this, + remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); + } + +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/AclSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java similarity index 60% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/AclSyncFromClusterService.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java index 97e43a3c..98ec6aad 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/AclSyncFromClusterService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java @@ -15,11 +15,12 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster; +package org.apache.eventmesh.dashboard.core.metadata.cluster; import org.apache.eventmesh.dashboard.common.model.metadata.AclMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsRequest; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataService; import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService; import java.util.List; @@ -29,15 +30,32 @@ import lombok.Setter; @Service -public class AclSyncFromClusterService implements SyncDataService { +public class AclSyncFromClusterService extends AbstractMetadataHandler { @Setter private AclRemotingService aclRemotingService; @Override - public List getData() { + public void addMetadata(AclMetadata meta) { + + } + + @Override + public void deleteMetadata(AclMetadata meta) { + + } + + + @Override + public List getData(GlobalRequest globalRequest) { GetAclsRequest getAclsRequest = new GetAclsRequest(); - // aclRemotingService.getAllAcls(getAclsRequest). - return null; + getAclsRequest.setClusterId(globalRequest.getClusterId()); + return (List) this.request(this.request, getAclsRequest).getData(); + } + + + @Override + public GlobalResult request(AclRemotingService key, GetAclsRequest getAclsRequest) { + return key.getAllAcls(getAclsRequest); } } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java new file mode 100644 index 00000000..b8ffab6f --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java @@ -0,0 +1,70 @@ +/* + * 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.core.metadata.cluster; + +import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; +import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest; +import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class ConfigSyncFromClusterService extends AbstractMetadataHandler { + + @Setter + ConfigRemotingService configRemotingService; + + @Override + public void addMetadata(ConfigMetadata meta) { + + } + + @Override + public void deleteMetadata(ConfigMetadata meta) { + + } + + @Override + public List getData() { + // topic + // group + // runtime + // broker + + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } + + + @Override + public GlobalResult request(ConfigRemotingService configRemotingService, GetConfigRequest key) { + return null; + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java new file mode 100644 index 00000000..bae1ad1b --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java @@ -0,0 +1,65 @@ +/* + * 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.core.metadata.cluster; + +import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; +import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest; +import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; +import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class GroupSyncFromClusterService extends AbstractMetadataHandler { + + @Autowired + private RemotingManager remotingManager; + + @Override + public void addMetadata(GroupMetadata meta) { + + } + + @Override + public void deleteMetadata(GroupMetadata meta) { + + } + + @Override + public List getData() { + List eventMeshGroupList = this.remotingManager.request(this, remotingManager.getEventMeshClusterDO()); + //List rocketMQMeshGroupList = this.remotingManager.request(this,remotingManager.getRocketMQClusterDO() ); + //eventMeshGroupList.addAll(rocketMQMeshGroupList); + return eventMeshGroupList; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } + + @Override + public GlobalResult request(GroupRemotingService groupRemotingService, GetGroupsRequest key) { + return null; + } +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/InstanceUserFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java similarity index 91% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/InstanceUserFromClusterService.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java index 88b4808d..5d6ddb81 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/InstanceUserFromClusterService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/InstanceUserFromClusterService.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.function.metadata.syncservice.cluster; +package org.apache.eventmesh.dashboard.core.metadata.cluster; import org.springframework.stereotype.Service; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java new file mode 100644 index 00000000..f9d32491 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java @@ -0,0 +1,58 @@ +/* + * 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.core.metadata.cluster; + +import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; +import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; +import org.apache.eventmesh.dashboard.service.remoting.RuntimeRemotingService; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class RuntimeSyncFromClusterService extends AbstractMetadataHandler { + + + @Override + public void addMetadata(RuntimeMetadata meta) { + + } + + @Override + public void deleteMetadata(RuntimeMetadata meta) { + + } + + @Override + public List getData(GlobalRequest globalRequest) { + GetRuntimeRequest getRuntimeRequest = new GetRuntimeRequest(); + getRuntimeRequest.setClusterId(globalRequest.getClusterId()); + return (List) this.request(this.request, getRuntimeRequest).getData(); + } + + @Override + public GlobalResult request(RuntimeRemotingService runtimeRemotingService, GetRuntimeRequest key) { + return runtimeRemotingService.getRuntimeMetadata(key); + } +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java similarity index 50% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java index 741a326b..a12dee50 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java @@ -15,39 +15,43 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.registry.impl; +package org.apache.eventmesh.dashboard.core.metadata.cluster; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import org.apache.eventmesh.dashboard.console.mapper.meta.MetaMapper; -import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; +import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest; +import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import lombok.extern.slf4j.Slf4j; + +@Slf4j @Service -public class RegistryDataServiceImpl implements RegistryDataService { +public class TopicSyncFromClusterService extends AbstractMetadataHandler { - @Autowired - MetaMapper metaMapper; + @Override + public void addMetadata(TopicMetadata meta) { - public List selectAll() { - return metaMapper.selectAll(); } @Override - public void batchInsert(List metaEntities) { - metaMapper.batchInsert(metaEntities); + public void deleteMetadata(TopicMetadata meta) { + } + @Override - public void insert(MetaEntity metaEntity) { - metaMapper.insert(metaEntity); + public List getData(GlobalRequest globalRequest) { + return null; } + @Override - public void deactivate(MetaEntity metaEntity) { - metaMapper.deactivate(metaEntity); + public GlobalResult request(TopicRemotingService topicRemotingService, GetTopicsRequest key) { + return null; } } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java new file mode 100644 index 00000000..f15ee089 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java @@ -0,0 +1,99 @@ +/* + * 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.core.remoting; + +import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; +import org.apache.eventmesh.dashboard.core.cluster.ClusterDO; +import org.apache.eventmesh.dashboard.core.cluster.ColonyDO; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.alibaba.fastjson.JSONObject; + +import lombok.Setter; + +/** + * 默认是一个集群,操作是基于集群操作还是单个操作 + */ +public abstract class AbstractRemotingService { + + @Setter + protected ColonyDO colonyDO; + + protected ClusterDO clusterDO; + + + public void init() { + this.clusterDO = colonyDO.getClusterDO(); + this.createConfig(); + this.doInit(); + } + + public abstract void createConfig(); + + public List getMeta() { + List list = new ArrayList<>(); + for (ColonyDO c : colonyDO.getMetaColonyDOList().values()) { + for (RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()) { + list.add(runtimeMetadata.getHost() + ":" + runtimeMetadata.getPort()); + } + } + return list; + } + + public String getMetaString() { + StringBuilder sb = new StringBuilder(); + List list = new ArrayList<>(); + for (ColonyDO c : colonyDO.getMetaColonyDOList().values()) { + for (RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()) { + sb.append(runtimeMetadata.getHost() + ":" + runtimeMetadata.getPort()); + sb.append(";"); + } + } + return sb.substring(0, sb.length() - 1); + } + + public void update() { + + } + + public Long getClusterId() { + return clusterDO.getClusterInfo().getClusterId(); + } + + public Long getId() { + return clusterDO.getClusterInfo().getId(); + } + + public T toDataOjbect(Object object, Class clazz) { + if (object instanceof JSONObject) { + JSONObject jsonObject = (JSONObject) object; + return (T) jsonObject.toJavaObject(clazz); + } else if (object instanceof String) { + return (T) JSONObject.parseObject((String) object, clazz); + } else if (object instanceof Map) { + return null; + } + return null; + } + + + protected abstract void doInit(); +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java new file mode 100644 index 00000000..8e95d5a9 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java @@ -0,0 +1,391 @@ +/* + * 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.core.remoting; + +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; +import org.apache.eventmesh.dashboard.common.enums.RemotingType; +import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; +import org.apache.eventmesh.dashboard.common.model.metadata.ClusterRelationshipMetadata; +import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; +import org.apache.eventmesh.dashboard.common.model.remoting.RemotingAction; +import org.apache.eventmesh.dashboard.core.cluster.ClusterDO; +import org.apache.eventmesh.dashboard.core.cluster.ColonyDO; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQAclRemotingService; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQClientRemotingService; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQConfigRemotingService; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQGroupRemotingService; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQOffsetRemotingService; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQSubscriptionRemotingService; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQTopicRemotingService; +import org.apache.eventmesh.dashboard.core.remoting.rocketmq.RocketMQUserRemotingService; +import org.apache.eventmesh.dashboard.service.remoting.RemotingIntegrationService; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Proxy; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicBoolean; + +import lombok.Data; +import lombok.Getter; + + +/** + * + */ +public class RemotingManager { + + + private final Map>> remotingServiceClasses = new HashMap<>(); + + /** + * key clusterId + */ + private final Map remotingWrapperMap = new ConcurrentHashMap<>(); + + @Getter + private final Object proxyObject; + + + /** + * Long key is clusterId + */ + private final Map colonyDOMap = new HashMap<>(); + + private final AtomicBoolean loading = new AtomicBoolean(true); + + + { + for (RemotingType remotingType : RemotingType.values()) { + remotingServiceClasses.put(remotingType, new ArrayList<>()); + } + this.registerService(RemotingType.ROCKETMQ, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class, + RocketMQClientRemotingService.class, RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class, + RocketMQSubscriptionRemotingService.class, RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class); + + this.registerService(RemotingType.EVENT_MESH_RUNTIME, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class, + RocketMQClientRemotingService.class, RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class, + RocketMQSubscriptionRemotingService.class, RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class); + + RemotingServiceHandler remotingServiceHandler = new RemotingServiceHandler(); + Class[] clazzList = new Class[] {RemotingIntegrationService.class}; + proxyObject = Proxy.newProxyInstance(this.getClass().getClassLoader(), clazzList, remotingServiceHandler); + } + + public void registerService(RemotingType remotingType, Class... clazzs) { + List> serviceList = this.remotingServiceClasses.get(remotingType); + Collections.addAll(serviceList, clazzs); + } + + + public void registerColony(ColonyDO colonyDO) throws Exception { + if (loading.get()) { + return; + } + + if (colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster()) { + ClusterType clusterType = colonyDO.getClusterDO().getClusterInfo().getClusterType(); + RemotingType remotingType = clusterType.getRemotingType(); + List> remotingServersClassList = remotingServiceClasses.get(remotingType); + Map, Object> remotingServersMap = new HashMap<>(); + for (Class clazz : remotingServersClassList) { + AbstractRemotingService abstractRemotingService = (AbstractRemotingService) clazz.newInstance(); + abstractRemotingService.setColonyDO(colonyDO); + abstractRemotingService.init(); + remotingServersMap.put(clazz.getInterfaces()[0], abstractRemotingService); + } + RemotingWrapper remotingWrapper = new RemotingWrapper(); + remotingWrapper.setColonyDO(colonyDO); + remotingWrapper.setObject(remotingServersMap); + this.remotingWrapperMap.put(colonyDO.getClusterId(), remotingWrapper); + } else { + this.updateColony(colonyDO); + } + + } + + public void updateColony(ColonyDO colonyDO) { + RemotingWrapper remotingWrapper = this.getMainRemotingWrapper(colonyDO); + /* + There is a delay + */ + if (Objects.isNull(remotingWrapper)) { + return; + } + ColonyDO mainColonyDO = this.getMainColonyDO(colonyDO); + for (Object object : remotingWrapper.getObject().values()) { + AbstractRemotingService abstractRemotingService = (AbstractRemotingService) object; + abstractRemotingService.setColonyDO(mainColonyDO); + abstractRemotingService.update(); + } + } + + public RemotingWrapper getMainRemotingWrapper(ColonyDO colonyDO) { + Long clusterId = + colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId(); + if (Objects.isNull(clusterId)) { + return null; + } + return remotingWrapperMap.get(clusterId); + } + + public ColonyDO getMainColonyDO(ColonyDO colonyDO) { + Long clusterId = + colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId(); + return colonyDOMap.get(clusterId); + } + + public void unregister(ColonyDO colonyDO) { + remotingWrapperMap.remove(colonyDO.getClusterId()); + } + + public void loadingCompleted() throws Exception { + this.loading.set(false); + for (ColonyDO colonyDO : colonyDOMap.values()) { + if (colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster()) { + this.registerColony(colonyDO); + } + } + } + + + /** + * 解除完关系,才能删除 + * + * @param clusterEntityList + */ + public void cacheCluster(List clusterEntityList) { + for (ClusterMetadata cluster : clusterEntityList) { + Long clusterId = cluster.getId(); + if (cluster.getStatus() == 1) { + ColonyDO colonyDO = colonyDOMap.remove(cluster.getClusterId()); + this.unregister(colonyDO); + continue; + } + ColonyDO colonyDO = this.colonyDOMap.computeIfAbsent(clusterId, key -> { + ColonyDO newColonyDO = new ColonyDO(); + ClusterDO newClusterDO = new ClusterDO(); + newColonyDO.setClusterDO(newClusterDO); + return newColonyDO; + }); + if (Objects.isNull(colonyDO.getClusterDO().getClusterInfo())) { + colonyDO.getClusterDO().setClusterInfo(cluster); + + try { + this.registerColony(colonyDO); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } else { + colonyDO.getClusterDO().setClusterInfo(cluster); + this.updateColony(colonyDO); + } + } + } + + public void cacheRuntime(List runtimeMeatadataList) { + for (RuntimeMetadata runtimeMetadata : runtimeMeatadataList) { + ColonyDO colonyDO = this.colonyDOMap.get(runtimeMetadata.getClusterId()); + if (Objects.equals(runtimeMetadata.getStatus(), 1)) { + colonyDO.getClusterDO().getRuntimeMap().put(runtimeMetadata.getId(), runtimeMetadata); + } else { + colonyDO.getClusterDO().getRuntimeMap().remove(runtimeMetadata.getId()); + } + } + } + + /** + * 解除关系是解除关系,不是删除 + * + * @param clusterRelationshipEntityList + */ + public void cacheClusterRelationship(List clusterRelationshipEntityList) { + for (ClusterRelationshipMetadata clusterRelationshipEntity : clusterRelationshipEntityList) { + ClusterType relationshipType = clusterRelationshipEntity.getRelationshipType(); + ColonyDO colonyDO = this.colonyDOMap.get(clusterRelationshipEntity.getClusterId()); + if (Objects.equals(relationshipType.getAssemblyNodeType(), ClusterType.META)) { + this.relationship(colonyDO, colonyDO.getMetaColonyDOList(), clusterRelationshipEntity); + } else if (Objects.equals(relationshipType.getAssemblyNodeType(), ClusterType.RUNTIME)) { + this.relationship(colonyDO, colonyDO.getRuntimeColonyDOList(), clusterRelationshipEntity); + } else if (Objects.equals(relationshipType.getAssemblyNodeType(), ClusterType.STORAGE)) { + this.relationship(colonyDO, colonyDO.getStorageColonyDOList(), clusterRelationshipEntity); + } + } + } + + private void relationship(ColonyDO colonyDO, Map clusterDOList, ClusterRelationshipMetadata clusterRelationshipMetadata) { + if (Objects.equals(clusterRelationshipMetadata.getStatus(), 2)) { + clusterDOList.remove(clusterRelationshipMetadata.getRelationshipId()); + } else { + ColonyDO relationshiCcolonyDO = this.colonyDOMap.get(clusterRelationshipMetadata.getRelationshipId()); + clusterDOList.put(clusterRelationshipMetadata.getRelationshipId(), relationshiCcolonyDO); + relationshiCcolonyDO.setSuperiorId(colonyDO.getClusterId()); + } + this.updateColony(colonyDO); + } + + public List getEventMeshClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterer(ClusterType.EVENTMESH, clusterTrusteeshipType); + } + + public List getMetaNacosClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterer(ClusterType.EVENTMESH_META_ETCD, clusterTrusteeshipType); + } + + public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterer(ClusterType.EVENTMESH_META_NACOS, clusterTrusteeshipType); + } + + public List getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { + return this.filterer(ClusterType.STORAGE_ROCKETMQ, clusterTrusteeshipType); + } + + public List getStorageCluster(ClusterTrusteeshipType... clusterTrusteeshipType) { + List list = new ArrayList<>(); + for (ClusterType clusterType : ClusterType.STORAGE_TYPES) { + list.addAll(this.filterer(clusterType, clusterTrusteeshipType)); + } + return list; + } + + + public boolean isClusterTrusteeshipType(Long clusterId, ClusterTrusteeshipType clusterTrusteeshipType) { + ColonyDO colonyDO = this.colonyDOMap.get(clusterId); + if (Objects.isNull(colonyDO)) { + return false; + } + return Objects.equals(colonyDO.getClusterDO().getClusterInfo().getTrusteeshipType(), clusterTrusteeshipType); + } + + + private List filterer(ClusterType clusterType, ClusterTrusteeshipType... clusterTrusteeshipTypes) { + Set clusterTrusteeshipType = new HashSet<>(); + clusterTrusteeshipType.addAll(Arrays.asList(clusterTrusteeshipTypes)); + List remotingWrapperList = new ArrayList<>(); + for (RemotingWrapper remotingWrapper : remotingWrapperMap.values()) { + ClusterMetadata clusterMetadata = remotingWrapper.getColonyDO().getClusterDO().getClusterInfo(); + if (Objects.equals(clusterMetadata.getClusterType(), clusterType)) { + if (clusterTrusteeshipType.contains(clusterMetadata.getTrusteeshipType())) { + remotingWrapperList.add(remotingWrapper); + } + } + } + return remotingWrapperList; + } + + + public T request(RemotingRequestWrapper remotingRequestWrapper, List remotingWrapperList) { + List resultData = new ArrayList<>(); + + Class clazz = remotingRequestWrapper.getClass(); + Type superclass = clazz.getGenericSuperclass(); + Class globalRequestClass = null; + Class executeClass = null; + if (superclass instanceof ParameterizedType) { + ParameterizedType parameterizedType = (ParameterizedType) superclass; + Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); + executeClass = (Class) actualTypeArguments[0]; + globalRequestClass = (Class) actualTypeArguments[1]; + } + RemotingRequestWrapper remotingRequestWrapper1 = (RemotingRequestWrapper) remotingRequestWrapper; + for (RemotingWrapper remotingWrapper : remotingWrapperList) { + try { + GlobalRequest globalRequest = globalRequestClass.newInstance(); + globalRequest.setClusterId(remotingWrapper.getColonyDO().getClusterId()); + GlobalResult globalResult = remotingRequestWrapper1.request(globalRequest, executeClass); + if (globalResult.getData() instanceof List) { + resultData.addAll((List) globalResult.getData()); + } else { + resultData.add(globalResult.getData()); + } + } catch (Exception e) { + //TODO There should be no abnormal occurrence of InstantiationException, IllegalAccessException, Exception + // + } + } + return (T) resultData; + + } + + /** + * @param + * @param + */ + public interface RemotingRequestWrapper { + + GlobalResult request(T t, RE key); + } + + @Data + public static class RemotingWrapper { + + private ColonyDO colonyDO; + + private Map, Object> object = new HashMap<>(); + } + + + public class RemotingServiceHandler implements InvocationHandler { + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + + GlobalRequest globalRequest = (GlobalRequest) args[0]; + Long clusterId = globalRequest.getClusterId(); + // ClusterDO + RemotingWrapper remotingWrapper = remotingWrapperMap.get(clusterId); + // 完整执行对象 + Class declaringClass = method.getDeclaringClass(); + Object object = remotingWrapper.getObject().get(declaringClass); + if (Objects.isNull(object)) { + return null; + } + + Method currentMethod = object.getClass().getMethod(method.getName(), method.getParameterTypes()); + RemotingAction annotations = currentMethod.getAnnotation(RemotingAction.class); + if (Objects.nonNull(annotations)) { + if (!annotations.support()) { + ColonyDO colonyDO = remotingWrapper.getColonyDO(); + Map colonyDOMap1 = colonyDO.getStorageColonyDOList(); + for (ColonyDO c : colonyDOMap1.values()) { + RemotingWrapper newRemotingWrapper = remotingWrapperMap.get(c.getClusterId()); + Object newObject = newRemotingWrapper.getObject().get(declaringClass); + return method.invoke(newObject, args); + } + } + } + return method.invoke(object, args); + + } + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java new file mode 100644 index 00000000..2b76a70d --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java @@ -0,0 +1,37 @@ +/* + * 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.core.remoting; + +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; +import org.apache.eventmesh.dashboard.service.remoting.RemotingServiceType; + +import java.util.HashMap; +import java.util.Map; + +import lombok.Data; + +@Data +public class RemotingServiceRuntimeConfig { + + + private CreateSDKConfig runtimeConfig; + + private CreateSDKConfig storageConfig; + + private Map remotingServiceTypeStringMap = new HashMap<>(); +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java new file mode 100644 index 00000000..124ea575 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java @@ -0,0 +1,112 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; +import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager; +import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; +import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; +import org.apache.eventmesh.dashboard.core.remoting.AbstractRemotingService; + +import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; +import org.apache.rocketmq.tools.command.CommandUtil; + +import java.util.AbstractMap; +import java.util.Objects; +import java.util.Set; + +/** + * rocketmq 其他不同的是。 以nameservier 为主。那么可以多集群。一个eventmesh 可以操作多个集群 + */ +public abstract class AbstractRocketMQRemotingService extends AbstractRemotingService { + + + protected DefaultMQAdminExt defaultMQAdminExt; + + protected CreateRocketmqConfig createRocketmqConfig; + + + @Override + public void createConfig() { + createRocketmqConfig = new CreateRocketmqConfig(); + createRocketmqConfig.setNameServerUrl(this.getMetaString()); + } + + @Override + protected void doInit() { + AbstractMap.SimpleEntry clientSimple = + SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN, createRocketmqConfig); + this.defaultMQAdminExt = clientSimple.getValue(); + } + + protected T cluster(GlobalResult t, Function function) { + try { + + /*for(ColonyDO clusterDO : this.cache.getClusterDOList()){ + for(RuntimeMetadata runtimeMetadata : clusterDO.getRuntimeEntityList()){ + + } + }*/ + + Set masterSet = + CommandUtil.fetchMasterAddrByClusterName(defaultMQAdminExt, createRocketmqConfig.getClusterName()); + for (String masterName : masterSet) { + Object newResult = function.apply(masterName, t); + if (Objects.nonNull(newResult)) { + return (T) newResult; + } + } + t.setCode(200); + } catch (Exception exception) { + t.setCode(400); + t.setErrorMessages(exception.getMessage()); + t.setThrowable(exception); + } finally { + return (T) t; + } + } + + ; + + protected T clusterName(GlobalResult t, Function function) { + try { + + Object newResult = function.apply(createRocketmqConfig.getClusterName(), t); + if (Objects.nonNull(newResult)) { + return (T) newResult; + } + t.setCode(200); + } catch (Exception exception) { + t.setCode(400); + t.setErrorMessages(exception.getMessage()); + t.setThrowable(exception); + } finally { + return (T) t; + } + } + + /** + * @param + */ + protected interface Function { + + T apply(String masterName, T t) throws Exception; + } + + +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java new file mode 100644 index 00000000..00b52719 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java @@ -0,0 +1,46 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclResult; +import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.acl.DeleteAclResult; +import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsResult; +import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService; + +public class RocketMQAclRemotingService extends AbstractRocketMQRemotingService implements AclRemotingService { + + + @Override + public CreateAclResult createAcl(CreateAclRequest createAclRequest) { + //this.defaultMQAdminExt.createAndUpdatePlainAccessConfig(); + return null; + } + + @Override + public DeleteAclResult deleteAcl(DeleteAclRequest deleteAclRequest) { + return null; + } + + @Override + public GetAclsResult getAllAcls(GetAclsRequest getAclsRequest) { + return null; + } +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java similarity index 68% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java rename to eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java index c5564ffc..f64f4fb7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java @@ -15,22 +15,17 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.instanceoperation; +package org.apache.eventmesh.dashboard.core.remoting.rocketmq; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata; +import org.apache.eventmesh.dashboard.service.remoting.ClientRemotingService; import java.util.List; -import org.springframework.stereotype.Service; -/** - * TODO Pending interfaces - */ - -@Service -public class TopicConfigService { +public class RocketMQClientRemotingService extends AbstractRocketMQRemotingService implements ClientRemotingService { - public List getTopicConfigFromInstance(Long clusterId, String name) { + @Override + public List getClientList() { return null; } - } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java new file mode 100644 index 00000000..60d72cef --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java @@ -0,0 +1,43 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult; +import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult; +import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService; + +public class RocketMQConfigRemotingService extends AbstractRocketMQRemotingService implements ConfigRemotingService { + + @Override + public BaseGlobalResult addConfig(AddConfigRequest addConfigRequest) { + return null; + } + + @Override + public GetTopicsResult getConfig(GetConfigRequest getConfigRequest) { + return null; + } + + @Override + public GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest) { + return null; + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java new file mode 100644 index 00000000..50094447 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java @@ -0,0 +1,30 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupResult; +import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest; +import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService; + +public class RocketMQGroupRemotingService extends AbstractRocketMQRemotingService implements GroupRemotingService { + + @Override + public GetGroupResult getAllGroups(GetGroupsRequest getGroupsRequest) { + return null; + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java new file mode 100644 index 00000000..f3ae2927 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java @@ -0,0 +1,38 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.model.remoting.offset.GetOffsetRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.offset.GetOffsetResult; +import org.apache.eventmesh.dashboard.common.model.remoting.offset.ResetOffsetRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.offset.ResetOffsetResult; +import org.apache.eventmesh.dashboard.service.remoting.OffsetRemotingService; + +public class RocketMQOffsetRemotingService extends AbstractRocketMQRemotingService implements OffsetRemotingService { + + @Override + public GetOffsetResult getOffset(GetOffsetRequest getOffsetRequest) { + return null; + } + + @Override + public ResetOffsetResult resetOffset(ResetOffsetRequest resetOffsetRequest) { + return null; + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java new file mode 100644 index 00000000..66729a0e --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java @@ -0,0 +1,30 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionResult; +import org.apache.eventmesh.dashboard.service.remoting.SubscriptionRemotingService; + +public class RocketMQSubscriptionRemotingService extends AbstractRocketMQRemotingService implements SubscriptionRemotingService { + + @Override + public GetSubscriptionResult getSubscription(GetSubscriptionRequest request) { + return null; + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java new file mode 100644 index 00000000..8eaf7032 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java @@ -0,0 +1,81 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.enums.RemotingType; +import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.RemotingAction; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicResult; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicResult; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResponse; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult; +import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; + +import org.apache.rocketmq.common.TopicConfig; +import org.apache.rocketmq.remoting.protocol.body.TopicConfigSerializeWrapper; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + + +public class RocketMQTopicRemotingService extends AbstractRocketMQRemotingService implements TopicRemotingService { + + @Resource + @Override + @RemotingAction(support = false, substitution = RemotingType.STORAGE) + public CreateTopicResult createTopic(CreateTopicRequest createTopicRequest) { + CreateTopicResult createTopicResult = new CreateTopicResult(); + TopicConfig topicConfig = this.toDataOjbect(createTopicRequest.getTopicMetadata().getTopicConfig(), TopicConfig.class); + return this.cluster(createTopicResult, (master, result) -> { + this.defaultMQAdminExt.createAndUpdateTopicConfig(master, topicConfig); + return null; + }); + } + + @Override + public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) { + DeleteTopicResult deleteTopicResult = new DeleteTopicResult(); + return this.clusterName(deleteTopicResult, (master, result) -> { + this.defaultMQAdminExt.deleteTopic(deleteTopicRequest.getTopicMetadata().getTopicName(), master); + return null; + }); + } + + @Override + public GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest) { + GetTopicsResult getTopicsResult = new GetTopicsResult(); + GetTopicsResponse getTopicsResponse = new GetTopicsResponse(); + List list = new ArrayList<>(); + getTopicsResult.setData(getTopicsResponse); + return this.cluster(getTopicsResult, (master, result) -> { + TopicConfigSerializeWrapper topicConfigSerializeWrapper = this.defaultMQAdminExt.getAllTopicConfig(master, 3000); + if (!topicConfigSerializeWrapper.getTopicConfigTable().isEmpty()) { + topicConfigSerializeWrapper.getTopicConfigTable().forEach((k, v) -> { + TopicMetadata topicMetadata = new TopicMetadata(); + //topicMetadata.setClusterId(); + }); + } + return null; + }); + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java new file mode 100644 index 00000000..4568eca9 --- /dev/null +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java @@ -0,0 +1,42 @@ +/* + * 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.core.remoting.rocketmq; + +import org.apache.eventmesh.dashboard.common.model.remoting.user.CreateUserRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.user.DeleterUserRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.user.GetUserRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.user.GetUserResult; +import org.apache.eventmesh.dashboard.service.remoting.UserRemotingService; + +public class RocketMQUserRemotingService extends AbstractRocketMQRemotingService implements UserRemotingService { + + @Override + public CreateUserRequest createInstanceUser(CreateUserRequest request) { + return null; + } + + @Override + public DeleterUserRequest deleteInstanceUser(DeleterUserRequest request) { + return null; + } + + @Override + public GetUserResult getInstanceUser(GetUserRequest request) { + return null; + } +} diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java index b3810f0c..e1f9bac8 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java @@ -28,13 +28,13 @@ import org.apache.rocketmq.common.TopicConfig; import org.apache.rocketmq.common.TopicFilterType; import org.apache.rocketmq.common.constant.PermName; -import org.apache.rocketmq.common.protocol.RequestCode; -import org.apache.rocketmq.common.protocol.body.TopicConfigSerializeWrapper; -import org.apache.rocketmq.common.protocol.header.CreateTopicRequestHeader; -import org.apache.rocketmq.common.protocol.header.DeleteTopicRequestHeader; import org.apache.rocketmq.remoting.CommandCustomHeader; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.protocol.RemotingCommand; +import org.apache.rocketmq.remoting.protocol.RequestCode; +import org.apache.rocketmq.remoting.protocol.body.TopicConfigSerializeWrapper; +import org.apache.rocketmq.remoting.protocol.header.CreateTopicRequestHeader; +import org.apache.rocketmq.remoting.protocol.header.DeleteTopicRequestHeader; import java.util.ArrayList; import java.util.List; @@ -51,6 +51,10 @@ public class RocketmqTopicCore implements TopicCore { private final RocketmqProperties rocketmqProperties; + public RocketmqTopicCore(RocketmqProperties rocketmqProperties) { + this.rocketmqProperties = rocketmqProperties; + } + private RemotingClient createRemotingClient(String brokerUrl) { CreateSDKConfig createSDKConfig = () -> brokerUrl; @@ -58,11 +62,6 @@ private RemotingClient createRemotingClient(String brokerUrl) { return (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, brokerUrl); } - - public RocketmqTopicCore(RocketmqProperties rocketmqProperties) { - this.rocketmqProperties = rocketmqProperties; - } - @Override public Boolean createTopic(String topicName) { String namesrvAddr = rocketmqProperties.getNamesrvAddr(); diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java index 8f0670a0..badbd6b8 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java @@ -33,9 +33,8 @@ @Timeout(value = 5) public class EtcdSDKCreateOperationTest { - private final EtcdSDKOperation etcdSDKOperation = new EtcdSDKOperation(); - private static final String url = "http://localhost:2379"; + private final EtcdSDKOperation etcdSDKOperation = new EtcdSDKOperation(); @Test void testCreateClient() { diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java index 42f2d002..c348c532 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java @@ -19,6 +19,7 @@ import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcConsumerSDKOperation; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java index 826e4e28..86e18a2c 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java @@ -19,6 +19,7 @@ import org.apache.eventmesh.client.grpc.producer.EventMeshGrpcProducer; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcProducerSDKOperation; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java index d6808c4c..ec62b11d 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java @@ -21,6 +21,7 @@ import org.apache.eventmesh.common.utils.IPUtils; import org.apache.eventmesh.common.utils.ThreadUtils; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpConsumerSDKOperation; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java index 728364a3..8bdf4718 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java @@ -21,6 +21,7 @@ import org.apache.eventmesh.common.utils.IPUtils; import org.apache.eventmesh.common.utils.ThreadUtils; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpProducerSDKOperation; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperationTest.java index 68b190d9..5966bb3f 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeSDKOperationTest.java @@ -21,6 +21,7 @@ import org.apache.eventmesh.common.Constants; import org.apache.eventmesh.common.protocol.tcp.UserAgent; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.wrapper.RuntimeSDKWrapper; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java index f2a1a528..f3fa14d6 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java @@ -21,6 +21,7 @@ import org.apache.eventmesh.client.tcp.impl.cloudevent.CloudEventTCPClient; import org.apache.eventmesh.common.protocol.tcp.UserAgent; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpCloudEventSDKOperation; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java index 29e71010..1dc74957 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java @@ -21,6 +21,7 @@ import org.apache.eventmesh.client.tcp.impl.eventmeshmessage.EventMeshMessageTCPClient; import org.apache.eventmesh.common.protocol.tcp.UserAgent; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpEventMeshSDKOperation; import java.util.AbstractMap.SimpleEntry; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java index caf73020..66083179 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java @@ -18,6 +18,8 @@ package org.apache.eventmesh.dashboard.core.function.SDK.operation; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpOpenMessageSDKOperation; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java index d5603c78..9b7bf0ef 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java @@ -17,8 +17,6 @@ package org.apache.eventmesh.dashboard.core.meta.runtime; -import static org.junit.jupiter.api.Assertions.assertEquals; - import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; import org.junit.jupiter.api.Test; @@ -39,7 +37,8 @@ public void testGetRuntime() throws InterruptedException { getRuntimeRequest.setRegistryAddress("127.0.0.1:8848"); nacosRuntimeCore.getRuntime(getRuntimeRequest).getFuture().thenAccept( getRuntimeResponse -> { - log.info("testGetRuntime success, the first cluster name is {}",getRuntimeResponse.getRuntimeMetadataList().get(0).getClusterName()); + log.info("testGetRuntime success, the first cluster name is {}", + getRuntimeResponse.getRuntimeMetadataList().get(0).getClusterName()); } ); } catch (Exception e) { diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java new file mode 100644 index 00000000..3b7f0092 --- /dev/null +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java @@ -0,0 +1,136 @@ +/* + * 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.core.metadata; + +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; +import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; + +import org.apache.commons.lang3.reflect.FieldUtils; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class MetadataSyncManagerTest { + + private MetadataSyncManager metadataSyncManager = new MetadataSyncManager(); + + private Map, MetadataSyncManager.MetadataSyncWrapper> metadataSyncWrapperMap; + + + @Mock + private RemotingManager remotingManager; + + @Mock + private MetadataHandler dataBasesHandler; + + @Mock + private MetadataHandler clusterHandler; + + private List databasesList = new ArrayList<>(); + private List clusterList = new ArrayList<>(); + + @Before + public void init() throws IllegalAccessException { + MetadataSyncManager.MetadataSyncConfig metadataSyncConfig = new MetadataSyncManager.MetadataSyncConfig(); + metadataSyncConfig.setDataBasesHandler(dataBasesHandler); + metadataSyncConfig.setClusterService(clusterHandler); + metadataSyncConfig.setMetadataClass(RuntimeMetadata.class); + metadataSyncManager.setRemotingManager(this.remotingManager); + metadataSyncManager.register(metadataSyncConfig); + + Field metadataSyncWrapperMapField = FieldUtils.getField(MetadataSyncManager.class, "metadataSyncWrapperMap", true); + metadataSyncWrapperMap = (Map, MetadataSyncManager.MetadataSyncWrapper>) metadataSyncWrapperMapField.get(metadataSyncManager); + + } + + + @Test + public void test_sync_mock() { + // + // ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP 3 + // databases cluster + // A 5 3 2 + // B 3 5 -2 + // C 5(2) 5(2) 2 + // ClusterTrusteeshipType.TRUSTEESHIP 3 + // databases cluster + // E 5 5 0 + // F 3 5 -2 + // G 5 3 2 + + this.mock_data(1, 5, 3); + this.mock_data(2, 3, 5); + this.mock_data(3, 5, 5); + this.mock_data(5, 5, 3); + this.mock_data(6, 3, 5); + this.mock_data(7, 5, 5); + MetadataSyncManager.MetadataSyncWrapper metadataSyncWrapper = this.metadataSyncWrapperMap.get(RuntimeMetadata.class); + Mockito.when(this.dataBasesHandler.getData()).thenReturn(this.databasesList); + Mockito.when(this.clusterHandler.getData()).thenReturn(this.clusterList); + Mockito.when(this.remotingManager.isClusterTrusteeshipType(Mockito.anyLong(), Mockito.any())).thenAnswer((invocation) -> { + Long clusterId = (Long) invocation.getArgument(0); + ClusterTrusteeshipType clusterTrusteeshipType = (ClusterTrusteeshipType) invocation.getArgument(1); + if (Objects.equals(clusterTrusteeshipType, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP) && clusterId < 4) { + return true; + } + if (Objects.equals(clusterTrusteeshipType, ClusterTrusteeshipType.TRUSTEESHIP) && clusterId > 4) { + return true; + } + return false; + }); + + metadataSyncWrapper.run(); + } + + private void mock_data(long clusterId, int databasesCount, int clusterCount) { + int index = databasesCount > clusterCount ? databasesCount : clusterCount; + for (int i = 0; i < index; i++) { + RuntimeMetadata runtimeMetadata = new RuntimeMetadata(); + runtimeMetadata.setClusterId(clusterId); + runtimeMetadata.setPort(i); + runtimeMetadata.setHost(clusterId + "." + i + ""); + if (i < databasesCount) { + this.databasesList.add(runtimeMetadata); + } + if (i < clusterCount) { + if (databasesCount == clusterCount) { + if (i == 0 || i == 1) { + runtimeMetadata = new RuntimeMetadata(); + runtimeMetadata.setClusterId(clusterId); + runtimeMetadata.setPort(i); + runtimeMetadata.setHost(clusterId + ".." + i + " " + i); + } + } + this.clusterList.add(runtimeMetadata); + } + + } + } +} diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java new file mode 100644 index 00000000..cc168244 --- /dev/null +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java @@ -0,0 +1,166 @@ +/* + * 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.core.remoting; + +import org.apache.eventmesh.dashboard.common.enums.ClusterType; +import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; +import org.apache.eventmesh.dashboard.common.model.metadata.ClusterRelationshipMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest; +import org.apache.eventmesh.dashboard.service.remoting.RemotingIntegrationService; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicLong; + +import org.junit.Test; + +public class RemotingManagerTest { + + private RemotingManager remotingManager = new RemotingManager(); + + + @Test + public void init_test() { + RemotingIntegrationService proxyObject = (RemotingIntegrationService) remotingManager.getProxyObject(); + + CreateTopicRequest createTopicRequest = new CreateTopicRequest(); + createTopicRequest.setClusterId(1L); + + proxyObject.createTopic(createTopicRequest); + + } + + @Test + public void mock_overall_logic() { + List clusterRelationshipMetadataList = new ArrayList<>(); + AtomicLong clusterId = new AtomicLong(1); + List clusterMetadataList = new ArrayList<>(); + + // 两个 eventmesh 集群 + ClusterMetadata eventMeshCluster1 = new ClusterMetadata(); + eventMeshCluster1.setClusterType(ClusterType.EVENTMESH_CLUSTER); + eventMeshCluster1.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(eventMeshCluster1); + + ClusterMetadata eventMeshCluster2 = new ClusterMetadata(); + eventMeshCluster2.setClusterType(ClusterType.EVENTMESH_CLUSTER); + eventMeshCluster2.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(eventMeshCluster2); + + // 两个注册中心 + ClusterMetadata eventMeshMetaNacos1 = new ClusterMetadata(); + eventMeshMetaNacos1.setClusterType(ClusterType.EVENTMESH_META_NACOS); + eventMeshMetaNacos1.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(eventMeshMetaNacos1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshMetaNacos1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshMetaNacos1); + + ClusterMetadata eventMeshMetaNacos2 = new ClusterMetadata(); + eventMeshMetaNacos2.setClusterType(ClusterType.EVENTMESH_META_NACOS); + eventMeshMetaNacos2.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(eventMeshMetaNacos2); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshMetaNacos2); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshMetaNacos2); + + // 2个 eventmesh runtime + ClusterMetadata eventMeshRuntime1 = new ClusterMetadata(); + eventMeshRuntime1.setClusterType(ClusterType.EVENTMESH_RUNTIME); + eventMeshRuntime1.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(eventMeshRuntime1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshRuntime1); + + ClusterMetadata eventMeshRuntime2 = new ClusterMetadata(); + eventMeshRuntime2.setClusterType(ClusterType.EVENTMESH_RUNTIME); + eventMeshRuntime2.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(eventMeshRuntime2); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshRuntime2); + + // 两个个 rocketmq 集群 + ClusterMetadata rocketMCluster = new ClusterMetadata(); + rocketMCluster.setClusterType(ClusterType.STORAGE_ROCKETMQ_CLUSTER); + rocketMCluster.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(rocketMCluster); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, rocketMCluster); + + ClusterMetadata rocketMCluster1 = new ClusterMetadata(); + rocketMCluster1.setClusterType(ClusterType.STORAGE_ROCKETMQ_CLUSTER); + rocketMCluster1.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(rocketMCluster1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, rocketMCluster1); + + // 2个 rocketmq broker 集群 + ClusterMetadata rocketBroker = new ClusterMetadata(); + rocketBroker.setClusterType(ClusterType.STORAGE_ROCKETMQ_BROKER); + rocketBroker.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(rocketBroker); + this.relationship(clusterRelationshipMetadataList, rocketMCluster, rocketBroker); + + ClusterMetadata rocketBroker1 = new ClusterMetadata(); + rocketBroker1.setClusterType(ClusterType.STORAGE_ROCKETMQ_BROKER); + rocketBroker1.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(rocketBroker1); + this.relationship(clusterRelationshipMetadataList, rocketMCluster1, rocketBroker1); + + // 两个 nameservier + ClusterMetadata rocketMQNameserver = new ClusterMetadata(); + rocketMQNameserver.setClusterType(ClusterType.STORAGE_ROCKETMQ_NAMESERVER); + rocketMQNameserver.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(rocketMQNameserver); + this.relationship(clusterRelationshipMetadataList, rocketBroker, rocketMQNameserver); + this.relationship(clusterRelationshipMetadataList, rocketBroker1, rocketMQNameserver); + + ClusterMetadata rocketMQNameserver1 = new ClusterMetadata(); + rocketMQNameserver1.setClusterType(ClusterType.STORAGE_ROCKETMQ_NAMESERVER); + rocketMQNameserver1.setId(clusterId.incrementAndGet()); + clusterMetadataList.add(rocketMQNameserver1); + this.relationship(clusterRelationshipMetadataList, rocketBroker, rocketMQNameserver1); + this.relationship(clusterRelationshipMetadataList, rocketBroker1, rocketMQNameserver1); + + try { + remotingManager.cacheCluster(clusterMetadataList); + remotingManager.cacheClusterRelationship(clusterRelationshipMetadataList); + remotingManager.loadingCompleted(); + + RemotingIntegrationService proxyObject = (RemotingIntegrationService) remotingManager.getProxyObject(); + CreateTopicRequest createTopicRequest = new CreateTopicRequest(); + createTopicRequest.setClusterId(9L); + proxyObject.createTopic(createTopicRequest); + + } catch (Exception e) { + throw new RuntimeException(e); + } + + + } + + + private void relationship(List clusterRelationshipMetadataList, ClusterMetadata clusterMetadata, + ClusterMetadata relationship) { + clusterMetadata.setStatus(0); + relationship.setStatus(0); + + ClusterRelationshipMetadata clusterRelationshipMetadata = new ClusterRelationshipMetadata(); + clusterRelationshipMetadata.setClusterType(clusterMetadata.getClusterType()); + clusterRelationshipMetadata.setClusterId(clusterMetadata.getId()); + clusterRelationshipMetadata.setRelationshipId(relationship.getId()); + clusterRelationshipMetadata.setRelationshipType(relationship.getClusterType()); + clusterRelationshipMetadataList.add(clusterRelationshipMetadata); + } + + +} diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java index 7fbed105..818c6b35 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java @@ -18,9 +18,8 @@ package org.apache.eventmesh.dashboard.service.meta; /** - * "Connection" refers to the subscription relationship between connectors. - * It focuses on the configuration deployed on the source and sink connectors themselves, - * reported by the connector. + * "Connection" refers to the subscription relationship between connectors. It focuses on the configuration deployed on the source and sink connectors + * themselves, reported by the connector. */ public interface ConnectionCore { diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java index 2512a95a..e27974f7 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java @@ -23,9 +23,8 @@ import java.util.List; /** - * "Subscription" refers to the traditional MQ producer-consumer topic subscription relationship, - * emphasizing the subscription relationship between EventMesh clients (including SDK and connectors) and topics, - * reported by the EventMesh runtime. + * "Subscription" refers to the traditional MQ producer-consumer topic subscription relationship, emphasizing the subscription relationship between + * EventMesh clients (including SDK and connectors) and topics, reported by the EventMesh runtime. */ public interface SubscriptionCore { diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java index 3b89e608..44d7a3d5 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java @@ -23,10 +23,10 @@ import java.util.List; /** - * A remoting service for client operations. - Not implemented in eventmesh by now + * A remoting service for client operations. Not implemented in eventmesh by now */ public interface ClientRemotingService { + // get consumer only for now List getClientList(); } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java index 7a7448e0..e38954fc 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java @@ -17,19 +17,31 @@ package org.apache.eventmesh.dashboard.service.remoting; +import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult; +import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.config.DeleteConfigRequest; import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigResult; +import org.apache.eventmesh.dashboard.common.model.remoting.config.UpdateConfigRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult; /** - * A remoting service for config operations. Getting configs from different sources + * A remoting service for config operations. Getting configs from different sources 1. runtime 2. RocketMQ 3. connector to db */ public interface ConfigRemotingService { - // get from meta service - public GetConfigResult getConfigsFromRegistry(GetConfigRequest getConfigRequest); - public GetConfigResult getConfigsFromRuntime(GetConfigRequest getConfigRequest); - public GetConfigResult getConfigsFromKafka(GetConfigRequest getConfigRequest); + BaseGlobalResult addConfig(AddConfigRequest addConfigRequest); - public GetConfigResult getConfigsFromRocketMQ(GetConfigRequest getConfigRequest); + default BaseGlobalResult updateConfig(UpdateConfigRequest updateConfigRequest) { + return addConfig(updateConfigRequest); + } + + default BaseGlobalResult deleteConfig(DeleteConfigRequest deleteConfigRequest) { + return addConfig(deleteConfigRequest); + } + + GetTopicsResult getConfig(GetConfigRequest getConfigRequest); + + GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest); } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java index 2745d24c..de9876d1 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java @@ -24,5 +24,6 @@ * service to get data from remote meta */ public interface MetaRemotingService { + GetRuntimeResult getRuntime(GetRuntimeRequest getRuntimeRequest); } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java new file mode 100644 index 00000000..0f117427 --- /dev/null +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java @@ -0,0 +1,26 @@ +/* + * 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.service.remoting; + +/** + * + */ +public interface RemotingIntegrationService extends AclRemotingService, ClientRemotingService, ConfigRemotingService, ConnectorRemotingService, + GroupRemotingService, MetaRemotingService, OffsetRemotingService, SubscriptionRemotingService, TopicRemotingService, UserRemotingService { + +} diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java new file mode 100644 index 00000000..24cf7f89 --- /dev/null +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingOperate.java @@ -0,0 +1,27 @@ +/* + * 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.service.remoting; + +public enum RemotingOperate { + + ADD, + + UPDATE, + + DELETE; +} diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java new file mode 100644 index 00000000..2da47e62 --- /dev/null +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingServiceType.java @@ -0,0 +1,23 @@ +/* + * 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.service.remoting; + +public enum RemotingServiceType { + + +} diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java new file mode 100644 index 00000000..b673c27a --- /dev/null +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java @@ -0,0 +1,29 @@ +/* + * 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.service.remoting; + +import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; +import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult; + +/** + * + */ +public interface RuntimeRemotingService { + + GetRuntimeResult getRuntimeMetadata(GetRuntimeRequest request); +} diff --git a/pom.xml b/pom.xml index 0d84ecb1..cd42c312 100644 --- a/pom.xml +++ b/pom.xml @@ -141,5 +141,104 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + UTF-8 + + none + + + + org.mapstruct + mapstruct-processor + 1.5.3.Final + + + org.projectlombok + lombok + 1.18.22 + + + org.projectlombok + lombok-mapstruct-binding + 0.2.0 + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + + true + true + + + + + + org.apache.maven.plugins + maven-jdeps-plugin + 3.0.0 + + + + jdkinternals + test-jdkinternals + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + true + + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20.1 + + -Xmx512m -XX:PermSize=128m + -XX:MaxPermSize=128m + + true + + **/*Test*.java + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + true + + + + \ No newline at end of file diff --git a/style/checkStyle.xml b/style/checkStyle.xml index b59a83ee..55411805 100644 --- a/style/checkStyle.xml +++ b/style/checkStyle.xml @@ -59,11 +59,11 @@ - +