From 271aa9632c6f28044b80938dcd81ab7718645871 Mon Sep 17 00:00:00 2001 From: "jie@apache.org" <2732554140@qq.com> Date: Wed, 12 Jun 2024 21:22:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(*):1.=20=E5=AE=8C=E6=88=90=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E7=9A=84=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 +- README.zh-CN.md | 9 + .../dashboard/common/enums/BusinessType.java | 21 +- .../common/enums/ResetOffsetMode.java | 29 + .../remoting/offset/GetOffsetRequest.java | 1 + .../remoting/offset/ResetOffsetRequest.java | 14 +- eventmesh-dashboard-console/pom.xml | 10 + .../dashboard/console/cache/ClusterCache.java | 97 --- .../console/cache/ClusterDoCache.java | 94 --- .../dashboard/console/cache/RuntimeCache.java | 59 -- .../controller/ConnectionController.java | 4 +- .../{ => 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 | 6 +- .../{ => 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 | 8 +- .../entity/{config => }/DefaultConfigKey.java | 2 +- .../entity/{storage => }/StoreEntity.java | 4 +- .../entity/{acl => cluster}/AclEntity.java | 20 +- .../{client => cluster}/ClientEntity.java | 24 +- .../ClusterAndRelationshipEntity.java} | 24 +- .../console/entity/cluster/ClusterEntity.java | 11 +- .../cluster/ClusterRelationshipEntity.java | 2 +- .../ConnectionEntity.java | 23 +- .../InstanceUserEntity.java | 10 +- .../entity/cluster/NetConnectionEntity.java | 52 ++ .../{runtime => cluster}/RuntimeEntity.java | 15 +- .../entity/connector/ConnectorEntity.java | 8 +- .../{config => function}/ConfigEntity.java | 4 +- .../HealthCheckResultEntity.java | 12 +- .../entity/{log => function}/LogEntity.java | 5 +- .../{group => message}/GroupEntity.java | 4 +- .../GroupMemberEntity.java | 10 +- .../{topic => message}/TopicEntity.java | 4 +- .../console/entity/meta/MetaEntity.java | 83 --- .../function/health/HealthExecutor.java | 4 +- .../function/health/HealthService.java | 6 +- .../handler/MetadataHandlerWrapper.java | 7 - .../db/ConfigMetadataHandlerToDbImpl.java | 2 +- .../db/ConnectionMetadataHandlerToDbImpl.java | 165 ----- .../db/GroupMetadataHandlerToDbImpl.java | 2 +- .../db/RegistryMetadataHandlerToDbImpl.java | 68 -- .../db/RuntimeMetadataHandlerToDbImpl.java | 11 +- .../db/TopicMetadataHandlerToDbImpl.java | 4 +- .../dashboard/console/log/OprLog.java | 4 +- .../mapper/{acl => cluster}/AclMapper.java | 4 +- .../{client => cluster}/ClientMapper.java | 6 +- .../console/mapper/cluster/ClusterMapper.java | 54 +- .../cluster/ClusterRelationshipMapper.java | 23 +- .../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 + .../cluster/ClusterHomeListVO.java} | 19 +- .../cluster/CreateClusterDTO.java} | 38 +- .../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} | 20 +- .../message/offset/ResetOffsetDTO.java} | 24 +- .../console/service/DataServiceWrapper.java | 20 +- ...onfigService.java => OverviewService.java} | 18 +- .../service/{acl => cluster}/AclService.java | 4 +- .../ClientDataService.java | 8 +- .../cluster/ClusterRelationshipService.java | 4 + .../service/cluster/ClusterService.java | 17 +- .../ConnectionDataService.java | 6 +- .../InstanceUserService.java | 4 +- .../{runtime => cluster}/RuntimeService.java | 15 +- .../Impl => cluster/impl}/AclServiceImpl.java | 8 +- .../impl}/ClientDataServiceImpl.java | 19 +- .../impl/ClusterRelationshipServiceImpl.java | 6 + .../cluster/impl/ClusterServiceImpl.java | 70 +- .../impl}/InstanceUserServiceImpl.java | 10 +- .../impl}/RuntimeServiceImpl.java | 38 +- .../synchronous/SyncConnectorConfigTask.java | 95 --- .../synchronous/SyncRuntimeConfigTask.java | 97 --- .../synchronous/SyncStoreConfigTask.java | 96 --- .../synchronous/SyncTopicConfigTask.java | 97 --- .../ConnectionDataServiceDatabaseImpl.java | 200 ------ .../{config => function}/ConfigService.java | 4 +- .../HealthDataService.java | 4 +- .../HealthDataServiceMemoryStorage.java | 4 +- .../Impl/ConfigServiceImpl.java | 10 +- .../Impl}/HealthDataServiceDatabaseImpl.java | 16 +- .../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 | 12 +- .../impl}/TopicServiceImpl.java | 70 +- .../impl/RegistryDataServiceImpl.java | 53 -- .../service/store/Impl/StoreServiceImpl.java | 2 +- .../console/service/store/StoreService.java | 2 +- .../main/resources/eventmesh-dashboard.sql | 671 ++++++++---------- .../EventMeshDashboardApplicationTest.java | 5 - .../console/cache/ClusterCacheBase.java | 46 -- .../console/cache/ClusterCacheTest.java | 51 -- .../function/health/HealthExecutorTest.java | 4 +- .../function/health/HealthServiceTest.java | 2 +- .../ClusterMetadataHandlerToDbImplTest.java | 69 -- .../db/ConfigMetadataHandlerToDbImplTest.java | 2 +- ...ConnectionMetadataHandlerToDbImplTest.java | 8 +- .../db/GroupMetadataHandlerToDbImplTest.java | 4 +- .../RegistryMetadataHandlerToDbImplTest.java | 78 -- .../RuntimeMetadataHandlerToDbImplTest.java | 4 +- .../db/TopicMetadataHandlerToDbImplTest.java | 8 +- .../health/HealthServiceIntegrateTest.java | 4 +- .../console/linkage/log/TestOprLog.java | 8 +- .../console/mapper/acl/AclMapperTest.java | 120 ---- .../mapper/client/ClientMapperTest.java | 95 --- .../connection/ConnectionMapperTest.java | 123 ---- .../mapper/connector/ConnectorMapperTest.java | 127 ---- .../health/HealthCheckResultMapperTest.java | 142 ---- .../instanceuser/InstanceUserMapperTest.java | 87 --- .../console/mapper/meta/MetaMapperTest.java | 49 -- ...ConnectionDataServiceDatabaseImplTest.java | 2 +- .../console/unit/config/TestConfigMapper.java | 131 ---- .../console/unit/group/GroupMapperTest.java | 118 --- .../groupmember/GroupMemberMapperTest.java | 164 ----- .../unit/runtime/TestRuntimeMapper.java | 78 -- .../console/unit/store/TestStoreMapper.java | 78 -- .../console/unit/topic/TopicMapperTest.java | 134 ---- pom.xml | 99 +++ 155 files changed, 1929 insertions(+), 4038 deletions(-) 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/enums/BusinessType.java (64%) create mode 100644 eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ResetOffsetMode.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/ClusterDoCache.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 (88%) 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 (87%) 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 (91%) 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/RuntimeConfigService.java => entity/cluster/ClusterAndRelationshipEntity.java} (65%) 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 rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{runtime => cluster}/RuntimeEntity.java (77%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{config => function}/ConfigEntity.java (92%) 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 (91%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{group => message}/GroupEntity.java (90%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{groupmember => message}/GroupMemberEntity.java (79%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/{topic => message}/TopicEntity.java (92%) 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/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 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%) 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 rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{cache/ClusterDO.java => modle/cluster/ClusterHomeListVO.java} (67%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{adapter/DynamicsAdapter.java => modle/cluster/CreateClusterDTO.java} (57%) 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 rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{service/config/instanceoperation/ConnectorConfigService.java => modle/message/offset/QueryOffsetByMessageMetadataDTO.java} (65%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{service/registry/RegistryDataService.java => modle/message/offset/ResetOffsetDTO.java} (64%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{config/instanceoperation/TopicConfigService.java => OverviewService.java} (66%) 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%) 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 (71%) 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%) 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 (64%) 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 (93%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/{health => function}/HealthDataServiceMemoryStorage.java (95%) 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 (91%) 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 (89%) 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/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java 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/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/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/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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66f57ff5..68a92f7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,5 +111,5 @@ jobs: - name: Build Dashboard run: ./mvnw -B package -DskipTests --file pom.xml - # - name: Run Unit Tests - #run: ./mvnw -B test --file pom.xml + - name: Run Unit Tests + run: ./mvnw -B test --file pom.xml 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-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/enums/BusinessType.java similarity index 64% 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/enums/BusinessType.java index 32ad30a0..41ca551a 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/enums/BusinessType.java @@ -15,23 +15,14 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.instanceoperation; - -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; - -import java.util.List; - -import org.springframework.stereotype.Service; +package org.apache.eventmesh.dashboard.common.enums; /** - * TODO Pending interfaces + * 业务类型, + * 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)', */ - -@Service -public class StoreConfigService { - - public List getStorageConfigFromInstance(Long clusterId, String storeId) { - return null; - } +public enum BusinessType { } 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/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 ea62eb57..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,24 +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; + private Long timestamp; - Long offset; - ResetOffsetMode resetOffsetMode; + private Long offset; + private ResetOffsetMode resetOffsetMode; private String topic; private String bootstrapServers; private Integer partitionId; private String groupName; - public enum ResetOffsetMode { - EARLIEST, - LATEST, - TIMESTAMP, - OFFSET - } } diff --git a/eventmesh-dashboard-console/pom.xml b/eventmesh-dashboard-console/pom.xml index 249e3469..cdac182f 100644 --- a/eventmesh-dashboard-console/pom.xml +++ b/eventmesh-dashboard-console/pom.xml @@ -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 afb3151c..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.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.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(); - private static final Object lock = new Object(); - //cluster name - private HashMap clusterNameMap = new HashMap<>(); - private HashMap clusterIdMap = new HashMap<>(); - - public ClusterEntity getClusterById(Long id) { - return clusterIdMap.get(id); - } - - public ClusterEntity getClusterByName(String name) { - return clusterNameMap.get(name); - } - - public ClusterEntity getClusterByRegistryAddress(String registryAddress) { - for (ClusterEntity clusterEntity : 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) { - // TODO 性能问题严总 - 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/ClusterDoCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDoCache.java deleted file mode 100644 index 819faf69..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDoCache.java +++ /dev/null @@ -1,94 +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.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_ETCD, clusterTrusteeshipType); - } - - public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { - return this.filterate(ClusterType.EVENTMESH_META_NACOS, 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 (ClusterDO clusterDO : clusterDOList.values()) { - - newClusterDOList.add(clusterDO); - } - return newClusterDOList; - } - - -} 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 79e4ba4c..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java +++ /dev/null @@ -1,59 +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(); - // ip:port -> runtime - private Map runtimeMap = new ConcurrentHashMap<>(); - - private RuntimeCache() { - } - - public static final RuntimeCache getInstance() { - return INSTANCE; - } - - 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/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 88% 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 3f54f166..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,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.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.time.LocalDateTime; import java.util.List; 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 87% 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 1c3df39e..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.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; 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 91% 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 a49ba307..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,11 +15,9 @@ * 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 lombok.Data; import lombok.EqualsAndHashCode; 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 8e80b356..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,19 +86,6 @@ public class ClientEntity extends BaseEntity { */ private Timestamp endTime; - 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); - } public void setStatusEntity(RecordStatus status) { this.status = status.getNumber(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.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/RuntimeConfigService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java index dc28bf2c..78b008c8 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterAndRelationshipEntity.java @@ -15,23 +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.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import java.util.List; +import java.time.LocalDateTime; -import org.springframework.stereotype.Service; +import lombok.Data; -/** - * TODO Pending interfaces - */ +@Data +public class ClusterAndRelationshipEntity extends ClusterEntity { + + private LocalDateTime relationshipTime; + + private LocalDateTime unRelationshipTime; -@Service -public class RuntimeConfigService { + private ClusterType relationshipType; - public List getRuntimeConfigFromInstance(Long clusterId, String host) { - return null; - } + private Integer status; } 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 b9b250ff..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 @@ -19,7 +19,8 @@ import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; @@ -34,18 +35,10 @@ public class ClusterEntity extends BaseEntity { private ClusterType clusterType; - private String registryAddress; - - private String bootstrapServers; - private String version; - private String clientProperties; - private String jmxProperties; - private String regProperties; - private String description; private Integer authType; 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 index a25e0105..c930ed1a 100644 --- 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 @@ -19,7 +19,7 @@ import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import lombok.Data; 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 97ac8205..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,18 +80,6 @@ public class ConnectionEntity extends BaseEntity { private String description; - 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()); - } public void setStatusEnum(RecordStatus statusEnum) { this.status = statusEnum.getNumber(); 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/runtime/RuntimeEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java similarity index 77% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java index f0cf8a0d..750f265f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/RuntimeEntity.java @@ -15,10 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.runtime; +package org.apache.eventmesh.dashboard.console.entity.cluster; -import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; + +import java.time.LocalDateTime; import lombok.Data; import lombok.EqualsAndHashCode; @@ -30,19 +31,15 @@ @EqualsAndHashCode(callSuper = true, exclude = "status") public class RuntimeEntity extends BaseEntity { - private Long clusterId; - - private ClusterType clusterType; + private String name; private String host; - private Long storageClusterId; - private Integer port; private Integer jmxPort; - private Long startTimestamp; + private LocalDateTime startTimestamp; private String rack; 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/config/ConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java similarity index 92% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java index 375280c7..cdf31405 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/function/ConfigEntity.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.config; +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 lombok.Data; import lombok.EqualsAndHashCode; 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 91% 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 a490d00b..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; 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/message/GroupEntity.java similarity index 90% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java index 47861162..b081d44d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/message/GroupEntity.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.entity.group; +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 lombok.Data; import lombok.EqualsAndHashCode; 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 79% 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 faeae39e..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,21 +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 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; 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 92% 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 199a1865..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,9 +15,9 @@ * 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.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.entity.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; 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 87549f26..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 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()); - } - - public void setStatusEnum(RecordStatus statusEnum) { - this.status = statusEnum.getNumber(); - } -} 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 25ac13cd..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; 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 45e728d0..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; 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 03a8b160..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; @@ -46,14 +44,9 @@ public class MetadataHandlerWrapper { @Autowired private ConfigMetadataHandlerToDbImpl configMetadataHandlerToDb; - @Autowired - private ConnectionMetadataHandlerToDbImpl connectionMetadataHandlerToDb; - @Autowired private GroupMetadataHandlerToDbImpl groupMetadataHandlerToDb; - @Autowired - private RegistryMetadataHandlerToDbImpl registryMetadataHandlerToDb; @Autowired private RuntimeMetadataHandlerToDbImpl runtimeMetadataHandlerToDb; 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 63ee690b..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 @@ -19,7 +19,7 @@ import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; -import org.apache.eventmesh.dashboard.console.service.config.ConfigService; +import org.apache.eventmesh.dashboard.console.service.function.ConfigService; import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; 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 2445f5a4..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java +++ /dev/null @@ -1,165 +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.common.model.remoting.GlobalRequest; -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.service.client.ClientDataService; -import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; -import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; - -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) { - - } - - @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/GroupMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java index a9d38f88..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 @@ -19,7 +19,7 @@ import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; -import org.apache.eventmesh.dashboard.console.service.group.GroupService; +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/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 d004d3c8..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.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.function.metadata.handler.db; - -import org.apache.eventmesh.dashboard.common.model.metadata.RegistryMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; -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; - -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)); - } - - @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/RuntimeMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java index 5cf790e1..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 @@ -21,10 +21,9 @@ import org.apache.eventmesh.dashboard.common.enums.ClusterType; import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; -import org.apache.eventmesh.dashboard.console.cache.ClusterCache; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; 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; @@ -47,7 +46,7 @@ public class RuntimeMetadataHandlerToDbImpl implements MetadataHandler 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 index c6e3ccf9..f741ee8b 100644 --- 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 @@ -17,6 +17,7 @@ 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; @@ -33,16 +34,32 @@ public interface ClusterRelationshipMapper { - @Insert({" insert into cluster_relationship (cluster_type,cluster_id,relationship_type,relationship_id)values( #{clusterType},#{clusterId},", - "#{relationshipType},#{relationshipId})"}) + @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_date = #{updateData} and status in( 2 ,3)") + @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/cache/ClusterDO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java similarity index 67% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDO.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java index 59cb6975..3eaa45b0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/ClusterHomeListVO.java @@ -15,28 +15,21 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.cache; +package org.apache.eventmesh.dashboard.console.modle.cluster; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; - -import java.util.List; import lombok.Data; @Data -public class ClusterDO { - - private ClusterEntity clusterInfo; - - private List runtimeEntityList; +public class ClusterHomeListVO { - private ClusterDO storageCluster; - private List useClusterList; + @Data + public static class ClusterHomeListData { - private ClusterEntity k8sCLuster; + private ClusterEntity clusterEntity; - private Object registrationCenter; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/adapter/DynamicsAdapter.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java similarity index 57% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/adapter/DynamicsAdapter.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java index d9bfe995..2102c5c5 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/adapter/DynamicsAdapter.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/cluster/CreateClusterDTO.java @@ -15,30 +15,36 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.adapter; +package org.apache.eventmesh.dashboard.console.modle.cluster; -import java.util.HashMap; -import java.util.Map; +import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; +import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import com.alibaba.fastjson2.JSON; +import javax.validation.constraints.NotNull; -public class DynamicsAdapter { +import lombok.Data; - private static final DynamicsAdapter INSTANCE = new DynamicsAdapter(); - private Map, Class> objectMapper = new HashMap<>(); +@Data +public class CreateClusterDTO { - public DynamicsAdapter() { + @NotNull + private String name; - } + @NotNull + private ClusterTrusteeshipType trusteeshipType; - public static final DynamicsAdapter getInstance() { - return INSTANCE; - } + @NotNull + private ClusterType clusterType; - public T to(Object source, Class target) { - String sourceString = JSON.toJSONString(source); - return (T) JSON.to(target, sourceString); - } + @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/service/config/instanceoperation/ConnectorConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/QueryOffsetByMessageMetadataDTO.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/modle/message/offset/QueryOffsetByMessageMetadataDTO.java index 47929a2e..3e59a03a 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/modle/message/offset/QueryOffsetByMessageMetadataDTO.java @@ -15,23 +15,19 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.instanceoperation; +package org.apache.eventmesh.dashboard.console.modle.message.offset; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; -import java.util.List; +import lombok.Data; -import org.springframework.stereotype.Service; +@Data +public class QueryOffsetByMessageMetadataDTO extends ClusterIdDTO { -/** - * TODO Pending interfaces - */ -@Service -public class ConnectorConfigService { + private String groupName; + + private String topicName; - public List getConnectorConfigFromInstance(Long clusterId, Long id) { - return null; - } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java similarity index 64% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java index 344aad61..ca3b9d87 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/RegistryDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/message/offset/ResetOffsetDTO.java @@ -15,23 +15,25 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.registry; +package org.apache.eventmesh.dashboard.console.modle.message.offset; -import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import java.util.List; +import org.apache.eventmesh.dashboard.common.enums.ResetOffsetMode; +import org.apache.eventmesh.dashboard.console.modle.ClusterIdDTO; -/** - * Database service of registry(meta) such as nacos - */ -public interface RegistryDataService { +import lombok.Data; + +@Data +public class ResetOffsetDTO extends ClusterIdDTO { + + private Long groupId; - List selectAll(); + private String groupName; - void batchInsert(List metaEntities); + private Integer partitionId; - void insert(MetaEntity metaEntity); + private ResetOffsetMode resetOffsetMode; - void deactivate(MetaEntity metaEntity); + 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/config/instanceoperation/TopicConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java similarity index 66% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java index b9041cbd..e966e280 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/OverviewService.java @@ -15,23 +15,15 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.service.config.instanceoperation; +package org.apache.eventmesh.dashboard.console.service; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; - -import java.util.List; - -import org.springframework.stereotype.Service; +import org.apache.eventmesh.dashboard.console.modle.function.OverviewDTO; /** - * TODO Pending interfaces + * */ +public interface OverviewService { -@Service -public class TopicConfigService { - - public List getTopicConfigFromInstance(Long clusterId, String name) { - return null; - } + 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 index 23e4b4b1..9f81f132 100644 --- 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 @@ -17,6 +17,7 @@ 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; @@ -31,8 +32,11 @@ public interface ClusterRelationshipService { 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 6573bb7b..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,21 +18,26 @@ 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(); @@ -44,7 +49,7 @@ public interface ClusterService { 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 71% 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 92f971fb..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,19 +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 selectNewlyIncreased(RuntimeEntity runtimeEntity); - - 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 index 8c64a7e0..44cb33d6 100644 --- 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 @@ -17,6 +17,7 @@ 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; @@ -42,6 +43,11 @@ public Integer relieveRelationship(ClusterRelationshipEntity clusterRelationship return clusterRelationshipMapper.relieveRelationship(clusterRelationshipEntity); } + @Override + public List queryClusterAndRelationshipEntityListByClusterId(ClusterRelationshipEntity clusterRelationshipEntity) { + return this.clusterRelationshipMapper.queryClusterAndRelationshipEntityListByClusterId(clusterRelationshipEntity); + } + @Override public List selectAll() { return this.clusterRelationshipMapper.selectAll(); 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 5789db8c..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 @@ -106,8 +106,7 @@ public List selectNewlyIncreased(ClusterEntity clusterEntity) { @Override public void addCluster(ClusterEntity cluster) { - clusterMapper.addCluster(cluster); - updateClusterCache(); + clusterMapper.insertCluster(cluster); } @Override @@ -121,23 +120,18 @@ public ClusterEntity selectClusterById(ClusterEntity cluster) { } - public List selectIncrementCluster() { - return null; - } - @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 64% 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 aba2b229..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,26 +64,13 @@ public List selectAll() { return runtimeMapper.selectAll(); } - @Override - public List selectNewlyIncreased(RuntimeEntity runtimeEntity) { - return null; - } - - @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 9d2c0f01..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java +++ /dev/null @@ -1,200 +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 4bb7894d..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; 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 93% 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 5c6be2cd..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,9 +15,9 @@ * 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; 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 95% 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 4282a368..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,9 +15,9 @@ * 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; 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 91% 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 513e95ea..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,17 +15,17 @@ * 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; 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 89% 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 65873e49..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,14 +15,14 @@ * 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.time.LocalDateTime; import java.util.List; 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/registry/impl/RegistryDataServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.java deleted file mode 100644 index 741a326b..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/registry/impl/RegistryDataServiceImpl.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.service.registry.impl; - -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 java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class RegistryDataServiceImpl implements RegistryDataService { - - @Autowired - MetaMapper metaMapper; - - public List selectAll() { - return metaMapper.selectAll(); - } - - @Override - public void batchInsert(List metaEntities) { - metaMapper.batchInsert(metaEntities); - } - - @Override - public void insert(MetaEntity metaEntity) { - metaMapper.insert(metaEntity); - } - - @Override - public void deactivate(MetaEntity metaEntity) { - metaMapper.deactivate(metaEntity); - } -} 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/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql index b47768f1..50056d01 100644 --- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql +++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql @@ -1,436 +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, - cluster_type varchar(16) not null comment '集群类型', - trusteeship_type varchar(16) not null comment '托管类型', - 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 `cluster_relationship`; create table `cluster_relationship` ( - id bigint unsigned auto_increment primary key, - 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 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', - is_delete int default 0 not null 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`) + 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`; +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(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 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', - `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 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 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', + `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', - `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 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', - `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 6c7ccba7..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,13 +17,10 @@ package org.apache.eventmesh.dashboard.console; -import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; - import java.util.Objects; 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.TestPropertySource; @@ -50,8 +47,6 @@ }) class EventMeshDashboardApplicationTest { - @Autowired - private RegistryDataService registryDataService; @Test public void IntegrationTest() throws InterruptedException { 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 85184d99..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.setVersion("1.7.0"); - clusterEntity.setClientProperties(""); - clusterEntity.setJmxProperties(""); - clusterEntity.setRegProperties(""); - clusterEntity.setDescription(""); - clusterEntity.setAuthType(0); - clusterEntity.setRunState(0); - clusterEntity.setStatus(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 47fae456..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java +++ /dev/null @@ -1,51 +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.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.setVersion("1.7.0"); - clusterEntity.setClientProperties(""); - clusterEntity.setJmxProperties(""); - clusterEntity.setRegProperties(""); - clusterEntity.setDescription(""); - clusterEntity.setAuthType(0); - clusterEntity.setRunState(0); - clusterEntity.setStatus(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 86e0d592..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,11 +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.service.function.HealthDataService; import java.util.concurrent.CompletableFuture; 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/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 9dc15ef0..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.service.cluster.ClusterService; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; - -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 2a237152..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,11 +21,11 @@ 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.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; 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 fbb09379..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,8 +21,8 @@ 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.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 6264ecfc..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.service.registry.RegistryDataService; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; - -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 160bdc60..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,9 +21,9 @@ 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.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 6bb2583e..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,7 +23,8 @@ 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.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; @@ -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/integration/health/HealthServiceIntegrateTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java index 78222516..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; 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 cde56152..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; 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 893b99b1..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java +++ /dev/null @@ -1,120 +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 2a0a6ad3..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.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.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 69a5da87..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; 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 e6df7691..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java +++ /dev/null @@ -1,131 +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; - -import lombok.Builder; - - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TestConfigMapper { - - @Autowired - private ConfigMapper configMapper; - - private ConfigEntity config; - - private ConfigEntity config1; - - @Builder - public void init(){ - this.config = new ConfigEntity(); - this.config.setClusterId(1L); - this.config.setBusinessType("rocketmq"); - this.config.setInstanceType(2); - this.config.setInstanceId(2L); - this.config.setConfigName("port"); - this.config.setConfigValue("127.0.0.1"); - this.config.setStartVersion("1.0.0"); - this.config.setEndVersion("1.1.1"); - this.config.setDiffType(1); - this.config.setDescription("1.1.1.1.1"); - this.config.setEdit(-1); - - this.config1 = new ConfigEntity(); - this.config1.setClusterId(1L); - this.config1.setBusinessType("rocketmq"); - this.config1.setInstanceType(2); - this.config1.setInstanceId(2L); - this.config1.setConfigName("port"); - this.config1.setConfigValue("127.0.0.1"); - this.config1.setStartVersion("1.0.0"); - this.config1.setEndVersion("1.1.1"); - this.config1.setDiffType(1); - this.config1.setDescription("1.1.1.1.1"); - this.config1.setEdit(-1); - } - - @Test - public void testAddConfig() throws IllegalAccessException { - 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() { - configMapper.addConfig(config); - configMapper.deleteConfig(config); - ConfigEntity config1 = configMapper.selectByUnique(config); - Assert.assertEquals(config1, null); - } - - @Test - public void testSelectByInstanceId() { - 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() { - 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 f0ec5a98..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(); - 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 954e31e4..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java +++ /dev/null @@ -1,164 +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(); - groupMemberEntity.setClusterId((long)i); - groupMemberEntity.setTopicName(topicName); - groupMemberEntity.setGroupName(groupName); - groupMemberEntity.setEventMeshUser("admin"); - groupMemberEntity.setState("active"); - groupMemberEntity.setStatus(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 c7021c1b..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.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.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; - - private RuntimeEntity runtimeEntity; - - public void init(){ - this.runtimeEntity = new RuntimeEntity(); - } - - - @Test - public void testAddRuntimeMapper() { - 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() { - 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() { - 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 e76535ab..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.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.unit.store; - -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.Before; -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; - - private StoreEntity storeEntity; - - private StoreEntity storeEntity1; - - @Before - public void init() { - storeEntity = new StoreEntity(); - storeEntity1 = new StoreEntity(); - } - - @Test - public void testAddStore() { - storeMapper.addStore(storeEntity); - storeMapper.addStore(storeEntity1); - StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity); - - storeEntities.setUpdateTime(null); - storeEntities.setCreateTime(null); - - - } - - @Test - public void testDeleteStoreByUnique() { - storeMapper.addStore(storeEntity); - storeMapper.deleteStoreByUnique(storeEntity); - StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity); - Assert.assertNull(storeEntities); - } - - @Test - public void testUpdateStoreByUnique() { - 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 9c59dfd2..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java +++ /dev/null @@ -1,134 +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(); - topicEntity.setTopicName(topicName); - 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/pom.xml b/pom.xml index 6d950218..771839ea 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